@@ -25,13 +25,18 @@ class AssetPicker extends StatelessWidget {
25
25
AssetPicker ({
26
26
Key key,
27
27
@required this .provider,
28
+ this .pickerTheme,
28
29
int gridCount = 4 ,
29
30
Color themeColor = C .themeColor,
30
31
TextDelegate textDelegate,
31
32
}) : assert (
32
33
provider != null ,
33
34
'AssetPickerProvider must be provided and not null.' ,
34
35
),
36
+ assert (
37
+ pickerTheme == null || themeColor == null ,
38
+ 'Theme and theme color cannot be set at the same time.' ,
39
+ ),
35
40
gridCount = gridCount ?? 4 ,
36
41
themeColor = themeColor ?? C .themeColor,
37
42
super (key: key) {
@@ -50,6 +55,14 @@ class AssetPicker extends StatelessWidget {
50
55
/// 选择器的主题色
51
56
final Color themeColor;
52
57
58
+ /// Theme for the picker.
59
+ /// 选择器的主题
60
+ ///
61
+ /// Usually the WeChat uses the dark version (dark background color) for the picker,
62
+ /// but some developer wants a light theme version for some reasons.
63
+ /// 通常情况下微信选择器使用的是暗色(暗色背景)的主题,但某些情况下开发者需要亮色或自定义主题。
64
+ final ThemeData pickerTheme;
65
+
53
66
/// Static method to push with navigator.
54
67
/// 跳转至选择器的静态方法
55
68
static Future <List <AssetEntity >> pickAssets (
@@ -161,7 +174,7 @@ class AssetPicker extends StatelessWidget {
161
174
),
162
175
);
163
176
164
- ThemeData get theme => themeData (themeColor);
177
+ ThemeData get theme => pickerTheme ?? themeData (themeColor);
165
178
166
179
/// Path entity select widget.
167
180
/// 路径选择部件
0 commit comments