@@ -128,10 +128,19 @@ abstract class AssetPickerBuilderDelegate<A, P> {
128
128
/// 苹果系列系统布局方式下的模糊度
129
129
double get appleOSBlurRadius => 10.0 ;
130
130
131
+ /// Height for the bottom occupied section.
132
+ /// 底部区域占用的高度
133
+ double get bottomSectionHeight =>
134
+ bottomActionBarHeight + permissionLimitedBarHeight;
135
+
131
136
/// Height for bottom action bar.
132
137
/// 底部操作栏的高度
133
138
double get bottomActionBarHeight => kToolbarHeight / 1.1 ;
134
139
140
+ /// Height for the permission limited bar.
141
+ /// 权限受限栏的高度
142
+ double get permissionLimitedBarHeight => isPermissionLimited ? 75 : 0 ;
143
+
135
144
/// Notifier for the current [PermissionState] .
136
145
/// 当前 [PermissionState] 的监听
137
146
late final ValueNotifier <PermissionState > permission =
@@ -344,7 +353,8 @@ abstract class AssetPickerBuilderDelegate<A, P> {
344
353
return GestureDetector (
345
354
onTap: PhotoManager .openSetting,
346
355
child: Container (
347
- padding: const EdgeInsets .symmetric (horizontal: 10 , vertical: 15 ),
356
+ padding: const EdgeInsets .symmetric (horizontal: 10 ),
357
+ height: permissionLimitedBarHeight,
348
358
color: theme.primaryColor.withOpacity (isAppleOS ? 0.90 : 1.0 ),
349
359
child: Row (
350
360
children: < Widget > [
@@ -376,10 +386,8 @@ abstract class AssetPickerBuilderDelegate<A, P> {
376
386
/// 底部操作栏部件
377
387
Widget bottomActionBar (BuildContext context) {
378
388
Widget child = Container (
379
- height: bottomActionBarHeight + Screens .bottomSafeHeight,
380
- padding: EdgeInsetsDirectional .only (
381
- start: 20.0 ,
382
- end: 20.0 ,
389
+ height: bottomActionBarHeight + context.bottomPadding,
390
+ padding: const EdgeInsets .symmetric (horizontal: 20 ).copyWith (
383
391
bottom: Screens .bottomSafeHeight,
384
392
),
385
393
color: theme.primaryColor.withOpacity (isAppleOS ? 0.90 : 1.0 ),
@@ -389,23 +397,21 @@ abstract class AssetPickerBuilderDelegate<A, P> {
389
397
if (isAppleOS) confirmButton (context),
390
398
]),
391
399
);
392
- if (isAppleOS) {
393
- if (isPermissionLimited) {
394
- child = Column (
395
- mainAxisSize: MainAxisSize .min,
396
- children: < Widget > [accessLimitedBottomTip (context), child],
397
- );
398
- }
399
- child = ClipRect (
400
- child: BackdropFilter (
401
- filter: ui.ImageFilter .blur (
402
- sigmaX: appleOSBlurRadius,
403
- sigmaY: appleOSBlurRadius,
404
- ),
405
- child: child,
406
- ),
400
+ if (isPermissionLimited) {
401
+ child = Column (
402
+ mainAxisSize: MainAxisSize .min,
403
+ children: < Widget > [accessLimitedBottomTip (context), child],
407
404
);
408
405
}
406
+ child = ClipRect (
407
+ child: BackdropFilter (
408
+ filter: ui.ImageFilter .blur (
409
+ sigmaX: appleOSBlurRadius,
410
+ sigmaY: appleOSBlurRadius,
411
+ ),
412
+ child: child,
413
+ ),
414
+ );
409
415
return child;
410
416
}
411
417
@@ -826,14 +832,17 @@ class DefaultAssetPickerBuilderDelegate
826
832
827
833
return LayoutBuilder (
828
834
builder: (BuildContext c, BoxConstraints constraints) {
829
- final double _itemSize = constraints.maxWidth / gridCount;
835
+ final double itemSize = constraints.maxWidth / gridCount;
836
+ // Reduce [permissionLimitedBarHeight] for the final height.
837
+ final double height =
838
+ constraints.maxHeight - permissionLimitedBarHeight;
830
839
// Use [ScrollView.anchor] to determine where is the first place of
831
840
// the [SliverGrid]. Each row needs [dividedSpacing] to calculate,
832
841
// then minus one times of [itemSpacing] because spacing's count in the
833
842
// cross axis is always less than the rows.
834
843
final double anchor = math.min (
835
- (row * (_itemSize + dividedSpacing) + topPadding - itemSpacing) /
836
- constraints.maxHeight ,
844
+ (row * (itemSize + dividedSpacing) + topPadding - itemSpacing) /
845
+ height ,
837
846
1 ,
838
847
);
839
848
@@ -858,7 +867,7 @@ class DefaultAssetPickerBuilderDelegate
858
867
// Ignore the gap when the [anchor] is not equal to 1.
859
868
if (isAppleOS && anchor == 1 )
860
869
SliverGap .v (
861
- context.mediaQuery.padding.bottom + bottomActionBarHeight ,
870
+ context.mediaQuery.padding.bottom + bottomSectionHeight ,
862
871
),
863
872
if (isAppleOS)
864
873
SliverToBoxAdapter (
0 commit comments