@@ -27,7 +27,7 @@ class AssetPicker extends StatelessWidget {
27
27
@required this .provider,
28
28
this .pickerTheme,
29
29
int gridCount = 4 ,
30
- Color themeColor = C .themeColor ,
30
+ Color themeColor,
31
31
TextDelegate textDelegate,
32
32
}) : assert (
33
33
provider != null ,
@@ -38,7 +38,8 @@ class AssetPicker extends StatelessWidget {
38
38
'Theme and theme color cannot be set at the same time.' ,
39
39
),
40
40
gridCount = gridCount ?? 4 ,
41
- themeColor = themeColor ?? C .themeColor,
41
+ themeColor =
42
+ pickerTheme? .colorScheme? .primary ?? themeColor ?? C .themeColor,
42
43
super (key: key) {
43
44
Constants .textDelegate = textDelegate ?? DefaultTextDelegate ();
44
45
}
@@ -74,7 +75,7 @@ class AssetPicker extends StatelessWidget {
74
75
int gridCount = 4 ,
75
76
RequestType requestType = RequestType .image,
76
77
List <AssetEntity > selectedAssets,
77
- Color themeColor = C .themeColor ,
78
+ Color themeColor,
78
79
ThemeData pickerTheme,
79
80
TextDelegate textDelegate,
80
81
Curve routeCurve = Curves .easeIn,
@@ -183,8 +184,8 @@ class AssetPicker extends StatelessWidget {
183
184
/// 切换路径时的动画时长
184
185
Duration get switchingPathDuration => kThemeAnimationDuration * 1.5 ;
185
186
186
- /// [ThemeData] for picker .
187
- /// 选择器使用的主题
187
+ /// Build a dark theme according to the theme color .
188
+ /// 通过主题色构建一个默认的暗黑主题
188
189
static ThemeData themeData (Color themeColor) => ThemeData .dark ().copyWith (
189
190
buttonColor: themeColor,
190
191
brightness: Brightness .dark,
@@ -210,8 +211,18 @@ class AssetPicker extends StatelessWidget {
210
211
),
211
212
);
212
213
214
+ /// [ThemeData] for picker.
215
+ /// 选择器使用的主题
213
216
ThemeData get theme => pickerTheme ?? themeData (themeColor);
214
217
218
+ /// Return a system ui overlay style according to
219
+ /// the brightness of the theme data.
220
+ /// 根据主题返回状态栏的明暗样式
221
+ SystemUiOverlayStyle get overlayStyle =>
222
+ theme.brightness == Brightness .light
223
+ ? SystemUiOverlayStyle .dark
224
+ : SystemUiOverlayStyle .light;
225
+
215
226
/// Path entity select widget.
216
227
/// 路径选择部件
217
228
Widget get pathEntitySelector => UnconstrainedBox (
@@ -1082,7 +1093,7 @@ class AssetPicker extends StatelessWidget {
1082
1093
@override
1083
1094
Widget build (BuildContext context) {
1084
1095
return AnnotatedRegion <SystemUiOverlayStyle >(
1085
- value: SystemUiOverlayStyle .light ,
1096
+ value: overlayStyle ,
1086
1097
child: Theme (
1087
1098
data: theme,
1088
1099
child: ChangeNotifierProvider <AssetPickerProvider >.value (
0 commit comments