Skip to content

Commit

Permalink
hide fast scroller selection preview automatically and on tap
Browse files Browse the repository at this point in the history
- fixes #880
  • Loading branch information
Chaphasilor committed Sep 14, 2024
1 parent 9831ff4 commit f8f8a65
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 61 deletions.
44 changes: 32 additions & 12 deletions lib/components/MusicScreen/alphabet_item_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:finamp/services/feedback_helper.dart';
import 'package:finamp/services/finamp_settings_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
import 'package:focus_on_it/focus_on_it.dart';

enum Drag {
start,
Expand Down Expand Up @@ -128,18 +129,34 @@ class _AlphabetListState extends State<AlphabetList> {
child: widget.child,
)),
if (_currentSelected != null && _displayPreview)
Positioned(
left: 20,
top: 20,
child: Container(
width: MediaQuery.sizeOf(context).width / 3,
height: MediaQuery.sizeOf(context).width / 3,
decoration: BoxDecoration(
color: Theme.of(context).cardColor.withOpacity(0.85),
borderRadius: BorderRadius.circular(20)),
child: FittedBox(
child: Text(_currentSelected!,
style: const TextStyle(fontSize: 120))),
FocusOnIt(
onUnfocus: () {
setState(() {
_currentSelected = null;
_displayPreview = false;
});
},
child: Positioned(
left: 20,
top: 20,
child: GestureDetector(
onTap: () {
setState(() {
_currentSelected = null;
_displayPreview = false;
});
},
child: Container(
width: MediaQuery.sizeOf(context).width / 3,
height: MediaQuery.sizeOf(context).width / 3,
decoration: BoxDecoration(
color: Theme.of(context).cardColor.withOpacity(0.85),
borderRadius: BorderRadius.circular(20)),
child: FittedBox(
child: Text(_currentSelected!,
style: const TextStyle(fontSize: 120))),
),
),
),
),
Directionality.of(context) == TextDirection.rtl
Expand Down Expand Up @@ -188,6 +205,9 @@ class _AlphabetListState extends State<AlphabetList> {
_displayPreview = false;
_currentSelected = null;
});
} else {
_displayPreview = false;
_currentSelected = null;
}
});
} else if (_currentSelected != _toBeSelected) {
Expand Down
109 changes: 60 additions & 49 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
url: "https://pub.dev"
source: hosted
version: "72.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.3.2"
version: "67.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
url: "https://pub.dev"
source: hosted
version: "6.7.0"
version: "6.4.1"
analyzer_plugin:
dependency: transitive
description:
Expand Down Expand Up @@ -195,18 +190,18 @@ packages:
dependency: "direct dev"
description:
name: build_runner
sha256: dd09dd4e2b078992f42aac7f1a622f01882a8492fef08486b27ddde929c19f04
sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7"
url: "https://pub.dev"
source: hosted
version: "2.4.12"
version: "2.4.11"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0
sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe
url: "https://pub.dev"
source: hosted
version: "7.3.2"
version: "7.3.1"
built_collection:
dependency: transitive
description:
Expand Down Expand Up @@ -371,10 +366,10 @@ packages:
dependency: transitive
description:
name: dart_style
sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab"
sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9"
url: "https://pub.dev"
source: hosted
version: "2.3.7"
version: "2.3.6"
dartx:
dependency: transitive
description:
Expand Down Expand Up @@ -603,6 +598,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
focus_on_it:
dependency: "direct main"
description:
name: focus_on_it
sha256: bd75489d7cb3cbde483126316a753e1a442a35c01a2278ae9bf54a4d86b89f02
url: "https://pub.dev"
source: hosted
version: "2.0.1"
freezed_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -832,18 +835,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -876,14 +879,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
macros:
dependency: transitive
description:
name: macros
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
url: "https://pub.dev"
source: hosted
version: "0.1.2-main.4"
marquee:
dependency: "direct main"
description:
Expand All @@ -904,10 +899,10 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.8.0"
media_kit:
dependency: transitive
description:
Expand Down Expand Up @@ -937,10 +932,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.15.0"
version: "1.12.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1218,10 +1213,10 @@ packages:
dependency: transitive
description:
name: riverpod_analyzer_utils
sha256: ee72770090078e6841d51355292335f1bc254907c6694283389dcb8156d99a4d
sha256: "8b71f03fc47ae27d13769496a1746332df4cec43918aeba9aff1e232783a780f"
url: "https://pub.dev"
source: hosted
version: "0.5.3"
version: "0.5.1"
riverpod_annotation:
dependency: "direct main"
description:
Expand All @@ -1234,18 +1229,18 @@ packages:
dependency: "direct dev"
description:
name: riverpod_generator
sha256: "1ad626afbd8b01d168870b13c0b036f8a5bdb57c14cd426dc5b4595466bd6e2f"
sha256: d451608bf17a372025fc36058863737636625dfdb7e3cbf6142e0dfeb366ab22
url: "https://pub.dev"
source: hosted
version: "2.4.2"
version: "2.4.0"
riverpod_lint:
dependency: "direct dev"
description:
name: riverpod_lint
sha256: b95a8cdc6102397f7d51037131c25ce7e51be900be021af4bf0c2d6f1b8f7aa7
sha256: "3c67c14ccd16f0c9d53e35ef70d06cd9d072e2fb14557326886bbde903b230a5"
url: "https://pub.dev"
source: hosted
version: "2.3.12"
version: "2.3.10"
rxdart:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1392,10 +1387,10 @@ packages:
dependency: transitive
description:
name: sqflite_common
sha256: "7b41b6c3507854a159e24ae90a8e3e9cc01eb26a477c118d6dca065b5f55453e"
sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4"
url: "https://pub.dev"
source: hosted
version: "2.5.4+2"
version: "2.5.4"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -1440,10 +1435,10 @@ packages:
dependency: transitive
description:
name: synchronized
sha256: a824e842b8a054f91a728b783c177c1e4731f6b124f9192468457a8913371255
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "3.1.0+1"
term_glyph:
dependency: transitive
description:
Expand All @@ -1456,10 +1451,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.7.0"
time:
dependency: transitive
description:
Expand Down Expand Up @@ -1492,6 +1487,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_io:
dependency: transitive
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
universal_platform:
dependency: transitive
description:
Expand Down Expand Up @@ -1528,10 +1531,10 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: e35a698ac302dd68e41f73250bd9517fe3ab5fa4f18fe4647a0872db61bacbab
sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79
url: "https://pub.dev"
source: hosted
version: "6.3.10"
version: "6.3.9"
url_launcher_ios:
dependency: transitive
description:
Expand Down Expand Up @@ -1620,14 +1623,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
visibility_detector:
dependency: transitive
description:
name: visibility_detector
sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420
url: "https://pub.dev"
source: hosted
version: "0.4.0+2"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.5"
version: "14.2.1"
wakelock_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1733,5 +1744,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.22.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ dependencies:
url_launcher: ^6.2.6
wakelock_plus: ^1.2.8
battery_plus: ^6.0.2
focus_on_it: ^2.0.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit f8f8a65

Please sign in to comment.