Skip to content

Commit

Permalink
fix: screen breakpoints and persist lyrics delay across screens
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Jun 28, 2023
1 parent 6b4584e commit df79638
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lib/extensions/constrains.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:flutter/widgets.dart';
extension ContainerBreakpoints on BoxConstraints {
bool get isXs => biggest.width <= 480;
bool get isSm => biggest.width > 480 && biggest.width <= 640;
bool get isMd => biggest.width > 640 && biggest.width <= 768;
bool get isLg => biggest.width > 768 && biggest.width <= 1024;
bool get isMd => biggest.width > 640 && biggest.width <= 820;
bool get isLg => biggest.width > 820 && biggest.width <= 1024;
bool get isXl => biggest.width > 1024 && biggest.width <= 1280;
bool get is2Xl => biggest.width > 1280;

Expand All @@ -22,8 +22,8 @@ extension ContainerBreakpoints on BoxConstraints {
extension ScreenBreakpoints on MediaQueryData {
bool get isXs => size.width <= 480;
bool get isSm => size.width > 480 && size.width <= 640;
bool get isMd => size.width > 640 && size.width <= 768;
bool get isLg => size.width > 768 && size.width <= 1024;
bool get isMd => size.width > 640 && size.width <= 820;
bool get isLg => size.width > 820 && size.width <= 1024;
bool get isXl => size.width > 1024 && size.width <= 1280;
bool get is2Xl => size.width > 1280;

Expand Down
12 changes: 6 additions & 6 deletions lib/pages/lyrics/synced_lyrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ class SyncedLyrics extends HookConsumerWidget {

final textTheme = Theme.of(context).textTheme;

useEffect(() {
controller.scrollToIndex(0);
WidgetsBinding.instance.addPostFrameCallback((_) {
ref.listen(
ProxyPlaylistNotifier.provider.select((s) => s.activeTrack),
(previous, next) {
controller.scrollToIndex(0);
ref.read(_delay.notifier).state = 0;
});
return null;
}, [playlist.activeTrack]);
},
);

final headlineTextStyle = (mediaQuery.mdAndUp
? textTheme.displaySmall
Expand Down

0 comments on commit df79638

Please sign in to comment.