@@ -264,7 +264,7 @@ abstract class AssetPickerBuilderDelegate<A, P> {
264
264
},
265
265
child: PlatformProgressIndicator (
266
266
color: theme.iconTheme.color,
267
- size: Screens .width / gridCount / 3 ,
267
+ size: context.mediaQuery.size .width / gridCount / 3 ,
268
268
),
269
269
),
270
270
);
@@ -388,7 +388,7 @@ abstract class AssetPickerBuilderDelegate<A, P> {
388
388
Widget child = Container (
389
389
height: bottomActionBarHeight + context.bottomPadding,
390
390
padding: const EdgeInsets .symmetric (horizontal: 20 ).copyWith (
391
- bottom: Screens .bottomSafeHeight ,
391
+ bottom: context.bottomPadding ,
392
392
),
393
393
color: theme.primaryColor.withOpacity (isAppleOS ? 0.90 : 1.0 ),
394
394
child: Row (children: < Widget > [
@@ -787,7 +787,7 @@ class DefaultAssetPickerBuilderDelegate
787
787
// [gridCount] since every grid item is squeezed by the [itemSpacing],
788
788
// and it's actual size is reduced with [itemSpacing / gridCount].
789
789
final double dividedSpacing = itemSpacing / gridCount;
790
- final double topPadding = context.mediaQuery.padding.top + kToolbarHeight;
790
+ final double topPadding = context.topPadding + kToolbarHeight;
791
791
792
792
Widget _sliverGrid (BuildContext ctx, List <AssetEntity > assets) {
793
793
return SliverGrid (
@@ -860,15 +860,11 @@ class DefaultAssetPickerBuilderDelegate
860
860
center: isAppleOS ? gridRevertKey : null ,
861
861
slivers: < Widget > [
862
862
if (isAppleOS)
863
- SliverGap .v (
864
- context.mediaQuery.padding.top + kToolbarHeight,
865
- ),
863
+ SliverGap .v (context.topPadding + kToolbarHeight),
866
864
_sliverGrid (_, assets),
867
865
// Ignore the gap when the [anchor] is not equal to 1.
868
866
if (isAppleOS && anchor == 1 )
869
- SliverGap .v (
870
- context.mediaQuery.padding.bottom + bottomSectionHeight,
871
- ),
867
+ SliverGap .v (context.bottomPadding + bottomSectionHeight),
872
868
if (isAppleOS)
873
869
SliverToBoxAdapter (
874
870
key: gridRevertKey,
@@ -1164,7 +1160,7 @@ class DefaultAssetPickerBuilderDelegate
1164
1160
}
1165
1161
return PlatformProgressIndicator (
1166
1162
color: theme.iconTheme.color,
1167
- size: Screens .width / gridCount / 3 ,
1163
+ size: context.mediaQuery.size .width / gridCount / 3 ,
1168
1164
);
1169
1165
},
1170
1166
),
@@ -1198,7 +1194,7 @@ class DefaultAssetPickerBuilderDelegate
1198
1194
@override
1199
1195
Widget pathEntityListWidget (BuildContext context) {
1200
1196
return Positioned .fill (
1201
- top: isAppleOS ? context.mediaQuery.padding.top + kToolbarHeight : 0 ,
1197
+ top: isAppleOS ? context.topPadding + kToolbarHeight : 0 ,
1202
1198
bottom: null ,
1203
1199
child: Selector <DefaultAssetPickerProvider , bool >(
1204
1200
selector: (_, DefaultAssetPickerProvider p) => p.isSwitchingPath,
@@ -1212,7 +1208,7 @@ class DefaultAssetPickerBuilderDelegate
1212
1208
curve: switchingPathCurve,
1213
1209
opacity: ! isAppleOS || isSwitchingPath ? 1.0 : 0.0 ,
1214
1210
child: Container (
1215
- height: Screens . height * 0.8 ,
1211
+ height: context.mediaQuery.size. height * (isAppleOS ? . 6 : . 8 ) ,
1216
1212
decoration: BoxDecoration (
1217
1213
borderRadius: isAppleOS
1218
1214
? const BorderRadius .vertical (bottom: Radius .circular (10.0 ))
@@ -1227,23 +1223,30 @@ class DefaultAssetPickerBuilderDelegate
1227
1223
children: < Widget > [
1228
1224
ValueListenableBuilder <PermissionState >(
1229
1225
valueListenable: permission,
1230
- builder: (_, PermissionState ps, __ ) {
1226
+ builder: (_, PermissionState ps, Widget ? child ) {
1231
1227
if (isPermissionLimited) {
1232
- return Padding (
1233
- padding: const EdgeInsets .symmetric (
1234
- horizontal: 20 ,
1235
- vertical: 12 ,
1236
- ),
1237
- child: Text (
1238
- Constants .textDelegate.viewingLimitedAssetsTip,
1239
- style: context.themeData.textTheme.caption? .copyWith (
1240
- fontSize: 15 ,
1241
- ),
1242
- ),
1243
- );
1228
+ return child! ;
1244
1229
}
1245
1230
return const SizedBox .shrink ();
1246
1231
},
1232
+ child: Padding (
1233
+ padding: const EdgeInsets .symmetric (
1234
+ horizontal: 20 ,
1235
+ vertical: 12 ,
1236
+ ),
1237
+ child: Text .rich (
1238
+ TextSpan (
1239
+ children: < TextSpan > [
1240
+ TextSpan (
1241
+ text: Constants .textDelegate.viewingLimitedAssetsTip,
1242
+ ),
1243
+ ],
1244
+ ),
1245
+ style: context.themeData.textTheme.caption? .copyWith (
1246
+ fontSize: 15 ,
1247
+ ),
1248
+ ),
1249
+ ),
1247
1250
),
1248
1251
Expanded (
1249
1252
child: Selector <DefaultAssetPickerProvider , int >(
@@ -1290,7 +1293,9 @@ class DefaultAssetPickerBuilderDelegate
1290
1293
onTap: () => provider.isSwitchingPath = ! provider.isSwitchingPath,
1291
1294
child: Container (
1292
1295
height: appBarItemHeight,
1293
- constraints: BoxConstraints (maxWidth: Screens .width * 0.5 ),
1296
+ constraints: BoxConstraints (
1297
+ maxWidth: context.mediaQuery.size.width * 0.5 ,
1298
+ ),
1294
1299
padding: const EdgeInsetsDirectional .only (start: 12.0 , end: 6.0 ),
1295
1300
decoration: BoxDecoration (
1296
1301
borderRadius: BorderRadius .circular (999 ),
@@ -1514,7 +1519,8 @@ class DefaultAssetPickerBuilderDelegate
1514
1519
(DefaultAssetPickerProvider p) => p.selectedAssets,
1515
1520
);
1516
1521
final bool selected = selectedAssets.contains (asset);
1517
- final double indicatorSize = Screens .width / gridCount / 3 ;
1522
+ final double indicatorSize =
1523
+ context.mediaQuery.size.width / gridCount / 3 ;
1518
1524
final Widget innerSelector = AnimatedContainer (
1519
1525
duration: switchingPathDuration,
1520
1526
width: indicatorSize / (isAppleOS ? 1.25 : 1.5 ),
@@ -1562,7 +1568,7 @@ class DefaultAssetPickerBuilderDelegate
1562
1568
},
1563
1569
child: Container (
1564
1570
margin: EdgeInsets .all (
1565
- Screens . width / gridCount / (isAppleOS ? 12.0 : 15.0 ),
1571
+ context.mediaQuery.size. width / gridCount / (isAppleOS ? 12 : 15 ),
1566
1572
),
1567
1573
width: isPreviewEnabled ? indicatorSize : null ,
1568
1574
height: isPreviewEnabled ? indicatorSize : null ,
0 commit comments