mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-22 20:11:15 +02:00
Use more specific MediaQuery methods to reduce unnecessary rebuilds (#467)
This commit is contained in:
@@ -178,7 +178,7 @@ class _AlbumScreenState extends ConsumerState<AlbumScreen> {
|
||||
}
|
||||
|
||||
double _calculateExpandedHeight(BuildContext context, {bool tall = false}) {
|
||||
final mediaSize = MediaQuery.of(context).size;
|
||||
final mediaSize = MediaQuery.sizeOf(context);
|
||||
if (tall) {
|
||||
return (mediaSize.height * 0.68).clamp(440.0, 660.0);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class _DownloadedAlbumScreenState extends ConsumerState<DownloadedAlbumScreen> {
|
||||
}
|
||||
|
||||
double _calculateExpandedHeight(BuildContext context) {
|
||||
final mediaSize = MediaQuery.of(context).size;
|
||||
final mediaSize = MediaQuery.sizeOf(context);
|
||||
return (mediaSize.height * 0.6).clamp(400.0, 580.0);
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ class _DownloadedAlbumScreenState extends ConsumerState<DownloadedAlbumScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||
final bottomPadding = MediaQuery.paddingOf(context).bottom;
|
||||
final bottomInset = context.navBarBottomInset;
|
||||
|
||||
final tracksValue = ref.watch(
|
||||
|
||||
@@ -1205,8 +1205,7 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
final isShowingRecentAccess = ref.watch(
|
||||
trackProvider.select((s) => s.isShowingRecentAccess),
|
||||
);
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final screenHeight = mediaQuery.size.height;
|
||||
final screenHeight = MediaQuery.sizeOf(context).height;
|
||||
final topPadding = normalizedHeaderTopPadding(context);
|
||||
final bottomInset = context.navBarBottomInset;
|
||||
final hasHistoryItems = ref.watch(
|
||||
|
||||
@@ -68,7 +68,7 @@ class _LibraryTracksFolderScreenState
|
||||
}
|
||||
|
||||
double _calculateExpandedHeight(BuildContext context) {
|
||||
final mediaSize = MediaQuery.of(context).size;
|
||||
final mediaSize = MediaQuery.sizeOf(context);
|
||||
return (mediaSize.height * 0.6).clamp(400.0, 580.0);
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ class _LibraryTracksFolderScreenState
|
||||
)
|
||||
.maybeWhen(data: (keys) => keys, orElse: () => const <String>{});
|
||||
|
||||
final bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||
final bottomPadding = MediaQuery.paddingOf(context).bottom;
|
||||
final bottomInset = context.navBarBottomInset;
|
||||
|
||||
return PopScope(
|
||||
|
||||
@@ -97,7 +97,7 @@ class _LocalAlbumScreenState extends ConsumerState<LocalAlbumScreen> {
|
||||
}
|
||||
|
||||
double _calculateExpandedHeight(BuildContext context) {
|
||||
final mediaSize = MediaQuery.of(context).size;
|
||||
final mediaSize = MediaQuery.sizeOf(context);
|
||||
return (mediaSize.height * 0.6).clamp(400.0, 580.0);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ class _LocalAlbumScreenState extends ConsumerState<LocalAlbumScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||
final bottomPadding = MediaQuery.paddingOf(context).bottom;
|
||||
final bottomInset = context.navBarBottomInset;
|
||||
final tracks = _sortedTracksCache;
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ class _MainShellState extends ConsumerState<MainShell>
|
||||
|
||||
final trackState = ref.read(trackProvider);
|
||||
|
||||
final isKeyboardVisible = MediaQuery.of(context).viewInsets.bottom > 0;
|
||||
final isKeyboardVisible = MediaQuery.viewInsetsOf(context).bottom > 0;
|
||||
|
||||
_log.d(
|
||||
'Back: state check - tab=$_currentIndex, '
|
||||
|
||||
@@ -6085,7 +6085,7 @@ class _QueueTabState extends ConsumerState<QueueTab> {
|
||||
if (_isSelectionMode) {
|
||||
_syncSelectionOverlay(
|
||||
items: allItems,
|
||||
bottomPadding: MediaQuery.of(context).padding.bottom,
|
||||
bottomPadding: MediaQuery.paddingOf(context).bottom,
|
||||
);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -800,7 +800,7 @@ class _DownloadSettingsPageState extends ConsumerState<DownloadSettingsPage> {
|
||||
),
|
||||
builder: (context) => SafeArea(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.7,
|
||||
height: MediaQuery.sizeOf(context).height * 0.7,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -747,7 +747,7 @@ class _FilesSettingsPageState extends ConsumerState<FilesSettingsPage> {
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(28)),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.7,
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.7,
|
||||
),
|
||||
builder: (context) => SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
@@ -846,7 +846,7 @@ class _FilesSettingsPageState extends ConsumerState<FilesSettingsPage> {
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(28)),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.7,
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.7,
|
||||
),
|
||||
builder: (context) => SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
@@ -1072,7 +1072,7 @@ class _FilenameFormatEditorSheetState
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||
padding: EdgeInsets.only(bottom: MediaQuery.viewInsetsOf(context).bottom),
|
||||
child: SingleChildScrollView(
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
|
||||
@@ -326,7 +326,7 @@ class LyricsSettingsPage extends ConsumerWidget {
|
||||
left: 24,
|
||||
right: 24,
|
||||
top: 24,
|
||||
bottom: 24 + MediaQuery.of(context).viewInsets.bottom,
|
||||
bottom: 24 + MediaQuery.viewInsetsOf(context).bottom,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -1250,7 +1250,7 @@ class _EditMetadataSheetState extends State<_EditMetadataSheet> {
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||
bottom: MediaQuery.viewInsetsOf(context).bottom,
|
||||
),
|
||||
child: DraggableScrollableSheet(
|
||||
initialChildSize: 0.85,
|
||||
|
||||
@@ -262,7 +262,7 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
}
|
||||
|
||||
double _calculateExpandedHeight(BuildContext context) {
|
||||
final mediaSize = MediaQuery.of(context).size;
|
||||
final mediaSize = MediaQuery.sizeOf(context);
|
||||
return (mediaSize.height * 0.55).clamp(360.0, 520.0);
|
||||
}
|
||||
|
||||
@@ -3438,7 +3438,7 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
return SafeArea(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(sheetContext).size.height * 0.85,
|
||||
maxHeight: MediaQuery.sizeOf(sheetContext).height * 0.85,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
@@ -3916,7 +3916,7 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||
bottom: MediaQuery.viewInsetsOf(context).bottom,
|
||||
),
|
||||
child: DraggableScrollableSheet(
|
||||
initialChildSize: 0.85,
|
||||
|
||||
@@ -421,7 +421,7 @@ class _CollectionHeaderSkeleton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final screenWidth = MediaQuery.sizeOf(context).width;
|
||||
final coverSize = (screenWidth * 0.5).clamp(150.0, 210.0).toDouble();
|
||||
|
||||
return Padding(
|
||||
@@ -542,7 +542,7 @@ class ArtistScreenSkeleton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final screenWidth = MediaQuery.sizeOf(context).width;
|
||||
return ShimmerLoading(
|
||||
child: SingleChildScrollView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
|
||||
@@ -75,7 +75,7 @@ class _BatchConvertSheetState extends State<BatchConvertSheet> {
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||
bottom: MediaQuery.viewInsetsOf(context).bottom,
|
||||
),
|
||||
child: DraggableScrollableSheet(
|
||||
initialChildSize: 0.85,
|
||||
|
||||
@@ -68,7 +68,7 @@ class _TrackOptionsSheet extends ConsumerWidget {
|
||||
return SafeArea(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.82,
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.82,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user