Skip to content

Commit f7500fa

Browse files
committed
⚡️ Use the buildTheme from the library
1 parent 3e2e221 commit f7500fa

File tree

1 file changed

+1
-110
lines changed

1 file changed

+1
-110
lines changed

lib/src/delegates/asset_picker_delegate.dart

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -243,115 +243,6 @@ class AssetPickerDelegate {
243243
/// 设置 [light] 为 true 时可以获取浅色版本的主题。
244244
/// {@endtemplate}
245245
ThemeData themeData(Color? themeColor, {bool light = false}) {
246-
themeColor ??= defaultThemeColorWeChat;
247-
if (light) {
248-
final base = ThemeData.light();
249-
return base.copyWith(
250-
primaryColor: Colors.grey[50],
251-
primaryColorLight: Colors.grey[50],
252-
primaryColorDark: Colors.grey[50],
253-
canvasColor: Colors.grey[100],
254-
scaffoldBackgroundColor: Colors.grey[50],
255-
cardColor: Colors.grey[50],
256-
highlightColor: Colors.transparent,
257-
textSelectionTheme: base.textSelectionTheme.copyWith(
258-
cursorColor: themeColor,
259-
selectionColor: themeColor.withAlpha(100),
260-
selectionHandleColor: themeColor,
261-
),
262-
// ignore: deprecated_member_use
263-
indicatorColor: themeColor,
264-
appBarTheme: base.appBarTheme.copyWith(
265-
backgroundColor: Colors.grey[100],
266-
systemOverlayStyle: const SystemUiOverlayStyle(
267-
statusBarBrightness: Brightness.light,
268-
statusBarIconBrightness: Brightness.dark,
269-
),
270-
iconTheme:
271-
base.appBarTheme.iconTheme?.copyWith(color: Colors.grey[900]) ??
272-
IconThemeData(color: Colors.grey[900]),
273-
elevation: 0,
274-
),
275-
bottomAppBarTheme: base.bottomAppBarTheme.copyWith(
276-
color: Colors.grey[100],
277-
),
278-
buttonTheme: base.buttonTheme.copyWith(buttonColor: themeColor),
279-
iconTheme: base.iconTheme.copyWith(color: Colors.grey[900]),
280-
checkboxTheme: base.checkboxTheme.copyWith(
281-
checkColor: WidgetStateProperty.all(Colors.black),
282-
fillColor: WidgetStateProperty.resolveWith((states) {
283-
if (states.contains(WidgetState.selected)) {
284-
return themeColor;
285-
}
286-
return null;
287-
}),
288-
side: const BorderSide(color: Colors.black),
289-
),
290-
colorScheme: base.colorScheme.copyWith(
291-
primary: Colors.grey[50]!,
292-
secondary: themeColor,
293-
surface: Colors.grey[50]!,
294-
brightness: Brightness.light,
295-
error: const Color(0xffcf6679),
296-
onPrimary: Colors.white,
297-
onSecondary: Colors.grey[100]!,
298-
onSurface: Colors.black,
299-
onError: Colors.white,
300-
),
301-
);
302-
}
303-
final base = ThemeData.dark();
304-
return base.copyWith(
305-
primaryColor: Colors.grey[900],
306-
primaryColorLight: Colors.grey[900],
307-
primaryColorDark: Colors.grey[900],
308-
canvasColor: Colors.grey[850],
309-
scaffoldBackgroundColor: Colors.grey[900],
310-
cardColor: Colors.grey[900],
311-
highlightColor: Colors.transparent,
312-
textSelectionTheme: base.textSelectionTheme.copyWith(
313-
cursorColor: themeColor,
314-
selectionColor: themeColor.withAlpha(100),
315-
selectionHandleColor: themeColor,
316-
),
317-
// ignore: deprecated_member_use
318-
indicatorColor: themeColor,
319-
appBarTheme: base.appBarTheme.copyWith(
320-
backgroundColor: Colors.grey[850],
321-
systemOverlayStyle: const SystemUiOverlayStyle(
322-
statusBarBrightness: Brightness.dark,
323-
statusBarIconBrightness: Brightness.light,
324-
),
325-
iconTheme: base.appBarTheme.iconTheme?.copyWith(color: Colors.white) ??
326-
const IconThemeData(color: Colors.white),
327-
elevation: 0,
328-
),
329-
bottomAppBarTheme: base.bottomAppBarTheme.copyWith(
330-
color: Colors.grey[850],
331-
),
332-
buttonTheme: base.buttonTheme.copyWith(buttonColor: themeColor),
333-
iconTheme: base.iconTheme.copyWith(color: Colors.white),
334-
checkboxTheme: base.checkboxTheme.copyWith(
335-
checkColor: WidgetStateProperty.all(Colors.white),
336-
fillColor: WidgetStateProperty.resolveWith((states) {
337-
if (states.contains(WidgetState.selected)) {
338-
return themeColor;
339-
}
340-
return null;
341-
}),
342-
side: const BorderSide(color: Colors.white),
343-
),
344-
colorScheme: base.colorScheme.copyWith(
345-
primary: Colors.grey[900]!,
346-
secondary: themeColor,
347-
surface: Colors.grey[900]!,
348-
brightness: Brightness.dark,
349-
error: const Color(0xffcf6679),
350-
onPrimary: Colors.black,
351-
onSecondary: Colors.grey[850]!,
352-
onSurface: Colors.white,
353-
onError: Colors.black,
354-
),
355-
);
246+
return buildTheme(themeColor, light: light);
356247
}
357248
}

0 commit comments

Comments
 (0)