Skip to content

Commit efeda8d

Browse files
committed
♻️ Refactored theme passing with static method.
1 parent 0895ff2 commit efeda8d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/src/widget/asset_picker.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class AssetPicker extends StatelessWidget {
7575
RequestType requestType = RequestType.image,
7676
List<AssetEntity> selectedAssets,
7777
Color themeColor = C.themeColor,
78+
ThemeData pickerTheme,
7879
TextDelegate textDelegate,
7980
Curve routeCurve = Curves.easeIn,
8081
Duration routeDuration = const Duration(milliseconds: 300),
@@ -83,6 +84,10 @@ class AssetPicker extends StatelessWidget {
8384
pageSize % gridCount == 0 || pageSize == null,
8485
'pageSize must be a multiple of gridCount.',
8586
);
87+
assert(
88+
pickerTheme == null || themeColor == null,
89+
'Theme and theme color cannot be set at the same time.',
90+
);
8691
try {
8792
final bool isPermissionGranted = await PhotoManager.requestPermission();
8893
if (isPermissionGranted) {
@@ -100,6 +105,7 @@ class AssetPicker extends StatelessWidget {
100105
gridCount: gridCount,
101106
textDelegate: textDelegate,
102107
themeColor: themeColor,
108+
pickerTheme: pickerTheme,
103109
);
104110
final List<AssetEntity> result =
105111
await Navigator.of(context).push<List<AssetEntity>>(

0 commit comments

Comments
 (0)