@@ -538,35 +538,44 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
538
538
/// Action bar widget aligned to bottom.
539
539
/// 底部操作栏部件
540
540
Widget bottomActionBar (BuildContext context) {
541
- Widget child = Container (
542
- height: bottomActionBarHeight + context.bottomPadding,
543
- padding: const EdgeInsets .symmetric (horizontal: 20 ).copyWith (
544
- bottom: context.bottomPadding,
545
- ),
546
- color: theme.primaryColor.withOpacity (isAppleOS (context) ? 0.90 : 1 ),
547
- child: Row (
548
- children: < Widget > [
549
- previewButton (context),
550
- const Spacer (),
551
- confirmButton (context),
552
- ],
541
+ final children = < Widget > [
542
+ if (isPermissionLimited) accessLimitedBottomTip (context),
543
+ Container (
544
+ height: bottomActionBarHeight + context.bottomPadding,
545
+ padding: const EdgeInsets .symmetric (horizontal: 20 ).copyWith (
546
+ bottom: context.bottomPadding,
547
+ ),
548
+ color: theme.bottomAppBarTheme.color? .withOpacity (
549
+ theme.bottomAppBarTheme.color! .opacity *
550
+ (isAppleOS (context) ? .9 : 1 ),
551
+ ),
552
+ child: Row (
553
+ children: < Widget > [
554
+ previewButton (context),
555
+ if (! isSingleAssetMode) const Spacer (),
556
+ if (! isSingleAssetMode) confirmButton (context),
557
+ ],
558
+ ),
553
559
),
560
+ ];
561
+ if (children.isEmpty) {
562
+ return const SizedBox .shrink ();
563
+ }
564
+ Widget child = Column (
565
+ mainAxisSize: MainAxisSize .min,
566
+ children: children,
554
567
);
555
- if (isPermissionLimited) {
556
- child = Column (
557
- mainAxisSize: MainAxisSize .min,
558
- children: < Widget > [accessLimitedBottomTip (context), child],
568
+ if (isAppleOS (context)) {
569
+ child = ClipRect (
570
+ child: BackdropFilter (
571
+ filter: ui.ImageFilter .blur (
572
+ sigmaX: appleOSBlurRadius,
573
+ sigmaY: appleOSBlurRadius,
574
+ ),
575
+ child: child,
576
+ ),
559
577
);
560
578
}
561
- child = ClipRect (
562
- child: BackdropFilter (
563
- filter: ui.ImageFilter .blur (
564
- sigmaX: appleOSBlurRadius,
565
- sigmaY: appleOSBlurRadius,
566
- ),
567
- child: child,
568
- ),
569
- );
570
579
return child;
571
580
}
572
581
@@ -800,6 +809,9 @@ class DefaultAssetPickerBuilderDelegate
800
809
@override
801
810
bool get isSingleAssetMode => provider.maxAssets == 1 ;
802
811
812
+ /// Whether the bottom actions bar should display.
813
+ bool get hasBottomActions => isPreviewEnabled || ! isSingleAssetMode;
814
+
803
815
/// The listener to track the scroll position of the [gridScrollController]
804
816
/// if [keepScrollOffset] is true.
805
817
/// 当 [keepScrollOffset] 为 true 时,跟踪 [gridScrollController] 位置的监听。
@@ -1086,8 +1098,7 @@ class DefaultAssetPickerBuilderDelegate
1086
1098
child: Column (
1087
1099
children: < Widget > [
1088
1100
Expanded (child: assetsGridBuilder (context)),
1089
- if (isPreviewEnabled || ! isSingleAssetMode)
1090
- bottomActionBar (context),
1101
+ bottomActionBar (context),
1091
1102
],
1092
1103
),
1093
1104
),
@@ -1113,8 +1124,7 @@ class DefaultAssetPickerBuilderDelegate
1113
1124
child: Stack (
1114
1125
children: < Widget > [
1115
1126
Positioned .fill (child: assetsGridBuilder (context)),
1116
- if (isPreviewEnabled || ! isSingleAssetMode)
1117
- Positioned .fill (top: null , child: bottomActionBar (context)),
1127
+ Positioned .fill (top: null , child: bottomActionBar (context)),
1118
1128
],
1119
1129
),
1120
1130
),
@@ -2296,29 +2306,81 @@ class DefaultAssetPickerBuilderDelegate
2296
2306
}
2297
2307
2298
2308
@override
2299
- Widget bottomActionBar (BuildContext context) {
2300
- Widget child = Container (
2301
- height: bottomActionBarHeight + context.bottomPadding,
2302
- padding: const EdgeInsets .symmetric (horizontal: 20 ).copyWith (
2303
- bottom: context.bottomPadding,
2304
- ),
2305
- color: theme.bottomAppBarTheme.color? .withOpacity (
2306
- theme.bottomAppBarTheme.color! .opacity * (isAppleOS (context) ? .9 : 1 ),
2307
- ),
2308
- child: Row (
2309
- children: < Widget > [
2310
- if (isPreviewEnabled) previewButton (context),
2311
- if (isPreviewEnabled || ! isSingleAssetMode) const Spacer (),
2312
- if (isPreviewEnabled || ! isSingleAssetMode) confirmButton (context),
2313
- ],
2309
+ Widget accessLimitedBottomTip (BuildContext context) {
2310
+ final double bottomPadding;
2311
+ if (hasBottomActions) {
2312
+ bottomPadding = 0 ;
2313
+ } else {
2314
+ bottomPadding = MediaQuery .paddingOf (context).bottom;
2315
+ }
2316
+ return GestureDetector (
2317
+ onTap: () {
2318
+ Feedback .forTap (context);
2319
+ PhotoManager .openSetting ();
2320
+ },
2321
+ child: Container (
2322
+ padding: const EdgeInsets .symmetric (horizontal: 10 )
2323
+ .add (EdgeInsets .only (bottom: bottomPadding)),
2324
+ height: permissionLimitedBarHeight + bottomPadding,
2325
+ color: theme.primaryColor.withOpacity (isAppleOS (context) ? 0.90 : 1 ),
2326
+ child: Row (
2327
+ children: < Widget > [
2328
+ const SizedBox (width: 5 ),
2329
+ Icon (
2330
+ Icons .warning,
2331
+ color: Colors .orange[400 ]! .withOpacity (.8 ),
2332
+ ),
2333
+ const SizedBox (width: 15 ),
2334
+ Expanded (
2335
+ child: ScaleText (
2336
+ textDelegate.accessAllTip,
2337
+ style: context.textTheme.bodySmall? .copyWith (
2338
+ fontSize: 14 ,
2339
+ ),
2340
+ semanticsLabel: semanticsTextDelegate.accessAllTip,
2341
+ ),
2342
+ ),
2343
+ Icon (
2344
+ Icons .keyboard_arrow_right,
2345
+ color: context.iconTheme.color? .withOpacity (.5 ),
2346
+ ),
2347
+ ],
2348
+ ),
2314
2349
),
2315
2350
);
2316
- if (isPermissionLimited) {
2317
- child = Column (
2318
- mainAxisSize: MainAxisSize .min,
2319
- children: < Widget > [accessLimitedBottomTip (context), child],
2320
- );
2351
+ }
2352
+
2353
+ @override
2354
+ Widget bottomActionBar (BuildContext context) {
2355
+ final children = < Widget > [
2356
+ if (isPermissionLimited) accessLimitedBottomTip (context),
2357
+ if (hasBottomActions)
2358
+ Container (
2359
+ height: bottomActionBarHeight + context.bottomPadding,
2360
+ padding: const EdgeInsets .symmetric (horizontal: 20 ).copyWith (
2361
+ bottom: context.bottomPadding,
2362
+ ),
2363
+ color: theme.bottomAppBarTheme.color? .withOpacity (
2364
+ theme.bottomAppBarTheme.color! .opacity *
2365
+ (isAppleOS (context) ? .9 : 1 ),
2366
+ ),
2367
+ child: Row (
2368
+ children: < Widget > [
2369
+ if (isPreviewEnabled) previewButton (context),
2370
+ if (isPreviewEnabled || ! isSingleAssetMode) const Spacer (),
2371
+ if (isPreviewEnabled || ! isSingleAssetMode)
2372
+ confirmButton (context),
2373
+ ],
2374
+ ),
2375
+ ),
2376
+ ];
2377
+ if (children.isEmpty) {
2378
+ return const SizedBox .shrink ();
2321
2379
}
2380
+ Widget child = Column (
2381
+ mainAxisSize: MainAxisSize .min,
2382
+ children: children,
2383
+ );
2322
2384
if (isAppleOS (context)) {
2323
2385
child = ClipRect (
2324
2386
child: BackdropFilter (
0 commit comments