Skip to content

Commit f870524

Browse files
committed
✨ Add changeAccessibleLimitedAssets for text delegate
1 parent 40cb7cf commit f870524

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

lib/src/delegates/asset_picker_builder_delegate.dart

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'dart:typed_data';
88
import 'dart:ui' as ui;
99

1010
import 'package:flutter/material.dart';
11+
import 'package:flutter/gestures.dart';
1112
import 'package:flutter/services.dart';
1213

1314
import '../constants/constants.dart';
@@ -108,6 +109,14 @@ abstract class AssetPickerBuilderDelegate<A, P> {
108109
? SystemUiOverlayStyle.light
109110
: SystemUiOverlayStyle.dark);
110111

112+
/// The color for interactive texts.
113+
/// 可交互的文字的颜色
114+
Color interactiveTextColor(BuildContext context) => Color.lerp(
115+
context.themeData.iconTheme.color?.withOpacity(.7) ?? Colors.white,
116+
Colors.blueAccent,
117+
0.4,
118+
)!;
119+
111120
/// Whether the current platform is Apple OS.
112121
/// 当前平台是否苹果系列系统 (iOS & MacOS)
113122
bool get isAppleOS => Platform.isIOS || Platform.isMacOS;
@@ -514,13 +523,7 @@ abstract class AssetPickerBuilderDelegate<A, P> {
514523
onTap: () => permissionOverlayHidden.value = true,
515524
child: Text(
516525
Constants.textDelegate.accessLimitedAssets,
517-
style: TextStyle(
518-
color: Color.lerp(
519-
context.themeData.iconTheme.color?.withOpacity(.5),
520-
Colors.blue,
521-
0.3,
522-
),
523-
),
526+
style: TextStyle(color: interactiveTextColor(context)),
524527
),
525528
);
526529

@@ -1240,6 +1243,13 @@ class DefaultAssetPickerBuilderDelegate
12401243
TextSpan(
12411244
text: Constants.textDelegate.viewingLimitedAssetsTip,
12421245
),
1246+
TextSpan(
1247+
text: ' '
1248+
'${Constants.textDelegate.changeAccessibleLimitedAssets}',
1249+
style: TextStyle(color: interactiveTextColor(context)),
1250+
recognizer: TapGestureRecognizer()
1251+
..onTap = PhotoManager.presentLimited,
1252+
),
12431253
],
12441254
),
12451255
style: context.themeData.textTheme.caption?.copyWith(

lib/src/delegates/assets_picker_text_delegate.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class AssetsPickerTextDelegate {
5151

5252
String get viewingLimitedAssetsTip => '应用只能访问部分资源和相册';
5353

54+
String get changeAccessibleLimitedAssets => '设置可访问的资源';
55+
5456
String get accessAllTip => '你已设置应用只能访问设备部分资源,'
5557
'建议允许访问「所有资源」';
5658

@@ -115,6 +117,10 @@ class EnglishTextDelegate extends AssetsPickerTextDelegate {
115117
String get viewingLimitedAssetsTip =>
116118
'Only view assets and albums accessible to app.';
117119

120+
@override
121+
String get changeAccessibleLimitedAssets =>
122+
'Change accessible limited assets';
123+
118124
@override
119125
String get accessAllTip => 'App can only access some assets on the device.'
120126
'Go to system settings and allow app to access all assets on the device.';

0 commit comments

Comments
 (0)