-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Opened on behalf of @anamikamohod
In version 0.20.2, when switching the theme to dark mode, the ZetaButton text color automatically changed to white.
However, in version 1.4.2, this behavior no longer occurs—the button text color remains black even in dark mode.
Is there any configuration or recommended approach in Zeta 1.4.2 to restore this behavior?
Widget build(BuildContext context) {
return ZetaProvider(
key: const ValueKey(AppKeyHelper.myApp),
initialTheme: 'purple',
initialThemeMode: StorageUtil.getBool(StorageHelper.isDarkMode) ? ThemeMode.dark : ThemeMode.light,
initialContrast: StorageUtil.getBool(StorageHelper.isContrast) ? ZetaContrast.aaa : ZetaContrast.aa,
customThemes: [
ZetaCustomTheme(
id: 'purple',
primary: ZetaPrimitivesLight().purple,
primaryDark: ZetaPrimitivesDark().purple,
),
],
builder: (context, lightTheme, darkTheme, themeMode) {
final dark = darkTheme;
final light = lightTheme;
return ToastificationWrapper(
child: MaterialApp.router(
routerConfig: AppRouter().router,
debugShowCheckedModeBanner: false,
themeMode: themeMode,
theme: ThemeData(
fontFamily: Zeta.of(context).textStyles.fontFamily,
scaffoldBackgroundColor: ColorHelper.surfaceLight,
colorScheme: light.colorScheme,
useMaterial3: true,
textTheme: TextTheme(
titleSmall: TextStyle(
fontSize: 16,
color: ColorHelper.mainDefaultLight,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
),
titleLarge: TextStyle(
fontSize: 24,
color: ColorHelper.mainDefaultLight,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
fontWeight: FontWeight.w500,
),
titleMedium: TextStyle(
fontSize: 18,
color: ColorHelper.mainDefaultLight,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
fontWeight: FontWeight.w500,
),
labelSmall: TextStyle(
color: ColorHelper.subtitleLight,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
),
),
),
darkTheme: ThemeData(
fontFamily: Zeta.of(context).textStyles.fontFamily,
scaffoldBackgroundColor: ColorHelper.surfaceDark,
colorScheme: dark.colorScheme,
useMaterial3: true,
textTheme: TextTheme(
labelSmall: TextStyle(
color: ColorHelper.subtitleDark,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
),
titleSmall: TextStyle(
color: ColorHelper.mainDefaultDark,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
),
titleLarge: TextStyle(
fontSize: 24,
color: ColorHelper.mainDefaultDark,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
fontWeight: FontWeight.w500,
),
titleMedium: TextStyle(
fontSize: 18,
color: ColorHelper.mainDefaultDark,
height: StorageUtil.getBool(StorageHelper.isCompactComfy) ? .9 : null,
fontWeight: FontWeight.w500,
),
),
),
builder: (context, child) {
_context = context;
if (errorMessage.isNotEmpty) {
WidgetsBinding.instance.addPostFrameCallback((_) {
CommonToastMessage.showToastMessage(msg: context.getLocalization(errorMessage));
errorMessage = '';
});
}
return MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaler: TextScaler.noScaling,
boldText: false,
),
child: child!,
);
},
),
);
},
);
}Button example:
ZetaButton(
label: primaryButtonLabel,
onPressed: () {},
borderType: ZetaWidgetBorder.full,
type: ZetaButtonType.primary,
size: ZetaWidgetSize.medium,
),Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels