diff --git a/README.md b/README.md
index 3557897e..e68c8f0b 100644
--- a/README.md
+++ b/README.md
@@ -78,7 +78,6 @@ builder: (context, themeData, themeMode) {
To tie everything together, use the `ZetaProvider` constructor. The `builder` argument is mandatory, while the others are optional but allow you to set initial values:
```dart
-
@override
Widget build(BuildContext context) {
return ZetaProvider(
@@ -104,6 +103,67 @@ To tie everything together, use the `ZetaProvider` constructor. The `builder` ar
}
```
+### Customization
+
+#### Creating custom themes
+
+Custom themes can be made by creating `ZetaCustomTheme` objects. `ZetaCustomTheme` can be constructed by passing in a primary or secondary color and, optionally, their dark variants:
+
+```dart
+ZetaCustomTheme(
+ id: 'custom-theme-red',
+ primary: Colors.red,
+ primaryDark : // Dark variant here,
+ secondary: Colors.blue,
+ secondaryDark: // Dark variant here,
+)
+```
+
+Color arguments can be of type `ZetaColorSwatch`, `MaterialColor`, or `Color`. If only a `Color` is provided, Zeta will generate a `ZetaColorSwatch`. To have control over every shade of a given color, we reccomend providing either a `ZetaColorSwatch` or a `MaterialColor`.
+
+If a dark variant of a color is not provided, Zeta generate one by inverting the corresponding color swatch.
+
+#### Adding custom themes
+
+Once you have defined the custom themes for your app, give them to the ZetaProvider by passing them through the construtor. You can also initialize the custom theme by setting the `initialTheme` argument to the id of the desired theme.
+
+```dart
+ ZetaProvider(
+ initialTheme: 'custom-theme-red'
+ customThemes: [
+ ZetaCustomTheme(
+ id: 'custom-theme-red',
+ primary: Colors.red,
+ secondary: Colors.purple
+ ),
+ ZetaCustomTheme(
+ id: 'custom-theme-purple',
+ primary: Colors.purple,
+ secondary: Colors.green
+ ),
+ ]
+ )
+```
+
+You can also get and set the custom themes via the `ZetaProvider`:
+
+`ZetaProvider.of(context).customThemes`
+`ZetaProvider.of(context).setCustomThemes(newCustomThemes)`
+
+#### Changing the custom theme
+
+To change the custom theme, call the `updateCustomTheme` function on `ZetaProvider` with an id corresponding to a `ZetaCustomTheme` object:
+
+`ZetaProvider.of(context).updateCustomTheme('custom-theme-purple')`
+
+If the id provided does not correspond to a given theme, Zeta will fall back to its default theme.
+
+You can fetch the id of the currently applied custom theme via the `Zeta` object:
+
+`Zeta.of(context).customThemeId`
+
+This will return null if no custom theme is in use.
+
With these configurations, Zeta makes it easy to achieve consistent theming throughout your Flutter application.
## Licensing
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 3bffbb27..f713dc16 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -1,46 +1,58 @@
import 'package:flutter/material.dart';
-import 'package:shared_preferences/shared_preferences.dart';
-import 'package:zeta_example/theme_service.dart';
import 'package:zeta_flutter/zeta_flutter.dart';
import 'home.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
- final preferences = await SharedPreferences.getInstance();
- final themeService = SharedPrefsThemeService(preferences);
- final themePreferences = await themeService.loadTheme();
-
- runApp(
- ZetaExample(
- themeService: themeService,
- initialZetaThemeData: themePreferences.$1 ?? ZetaThemeData(),
- initialThemeMode: themePreferences.$2 ?? ThemeMode.system,
- initialContrast: themePreferences.$3 ?? ZetaContrast.aa,
- ),
- );
+ runApp(ZetaExample());
}
class ZetaExample extends StatelessWidget {
- const ZetaExample({
- super.key,
- required this.themeService,
- required this.initialContrast,
- required this.initialThemeMode,
- required this.initialZetaThemeData,
- });
-
- final ZetaThemeService themeService;
- final ZetaContrast initialContrast;
- final ThemeMode initialThemeMode;
- final ZetaThemeData initialZetaThemeData;
+ const ZetaExample({super.key});
@override
Widget build(BuildContext context) {
- return ZetaProvider.base(
- initialZetaThemeData: initialZetaThemeData,
- initialThemeMode: initialThemeMode,
- initialContrast: initialContrast,
+ return ZetaProvider(
+ // initialContrast: ZetaContrast.aa,
+ // initialThemeMode: ThemeMode.system,
+ customThemes: [
+ ZetaCustomTheme(
+ id: 'teal',
+ primary: ZetaPrimitivesLight().teal,
+ primaryDark: ZetaPrimitivesDark().teal,
+ secondary: ZetaPrimitivesLight().yellow,
+ secondaryDark: ZetaPrimitivesDark().yellow,
+ ),
+ ZetaCustomTheme(
+ id: 'yellow',
+ primary: ZetaPrimitivesLight().yellow,
+ primaryDark: ZetaPrimitivesDark().yellow,
+ secondary: ZetaPrimitivesLight().red,
+ secondaryDark: ZetaPrimitivesDark().red,
+ ),
+ ZetaCustomTheme(
+ id: 'red',
+ primary: ZetaPrimitivesLight().red,
+ primaryDark: ZetaPrimitivesDark().red,
+ secondary: ZetaPrimitivesLight().purple,
+ secondaryDark: ZetaPrimitivesDark().purple,
+ ),
+ ZetaCustomTheme(
+ id: 'purple',
+ primary: ZetaPrimitivesLight().purple,
+ primaryDark: ZetaPrimitivesDark().purple,
+ secondary: ZetaPrimitivesLight().green,
+ secondaryDark: ZetaPrimitivesDark().green,
+ ),
+ ZetaCustomTheme(
+ id: 'green',
+ primary: ZetaPrimitivesLight().green,
+ primaryDark: ZetaPrimitivesDark().green,
+ secondary: ZetaPrimitivesLight().blue,
+ secondaryDark: ZetaPrimitivesDark().blue,
+ ),
+ ],
builder: (context, lightTheme, darkTheme, themeMode) {
return MaterialApp.router(
routerConfig: router,
diff --git a/example/lib/pages/components/avatar_example.dart b/example/lib/pages/components/avatar_example.dart
index ff3aaa90..1454f0a7 100644
--- a/example/lib/pages/components/avatar_example.dart
+++ b/example/lib/pages/components/avatar_example.dart
@@ -22,7 +22,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
initials: 'W W',
size: ZetaAvatarSize.xxs,
- backgroundColor: Zeta.of(context).colors.green,
+ backgroundColor: Zeta.of(context).colors.borderPositive,
),
],
name: AvatarExample.name,
@@ -35,7 +35,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
initials: 'WW',
size: ZetaAvatarSize.xxs,
- backgroundColor: Zeta.of(context).colors.green,
+ backgroundColor: Zeta.of(context).colors.borderPositive,
),
Column(
children: [
@@ -69,7 +69,7 @@ class AvatarExample extends StatelessWidget {
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
- ZetaAvatar.image(size: size),
+ ZetaAvatar.image(size: size, image: image),
const SizedBox(height: 20),
],
))
@@ -82,7 +82,8 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
- borderColor: Zeta.of(context).colors.green,
+ image: image,
+ borderColor: Zeta.of(context).colors.borderPositive,
),
const SizedBox(height: 20),
],
@@ -110,7 +111,7 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
image: image,
),
const SizedBox(height: 20),
@@ -171,7 +172,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
size: size,
initials: 'AB',
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
),
const SizedBox(height: 20),
],
@@ -230,7 +231,7 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
upperBadge: ZetaAvatarBadge.notification(value: 3),
),
const SizedBox(height: 20),
@@ -260,7 +261,7 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
upperBadge: ZetaAvatarBadge.notification(value: 3),
image: image,
),
@@ -323,7 +324,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
size: size,
initials: 'AB',
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
upperBadge: ZetaAvatarBadge.notification(value: 3),
),
const SizedBox(height: 20),
@@ -383,7 +384,7 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
lowerBadge: ZetaAvatarBadge.icon(),
),
const SizedBox(height: 20),
@@ -413,7 +414,7 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
lowerBadge: ZetaAvatarBadge.icon(),
image: image,
),
@@ -476,7 +477,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
size: size,
initials: 'AB',
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
lowerBadge: ZetaAvatarBadge.icon(),
),
const SizedBox(height: 20),
@@ -539,7 +540,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.image(
size: size,
image: image,
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
upperBadge: ZetaAvatarBadge.notification(value: 3),
lowerBadge: ZetaAvatarBadge.icon(),
),
@@ -571,7 +572,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
size: size,
initials: 'AB',
- borderColor: Zeta.of(context).colors.green,
+ borderColor: Zeta.of(context).colors.borderPositive,
upperBadge: ZetaAvatarBadge.notification(value: 3),
lowerBadge: ZetaAvatarBadge.icon(),
),
diff --git a/example/lib/pages/components/list_item_example.dart b/example/lib/pages/components/list_item_example.dart
index 7a271232..18572b55 100644
--- a/example/lib/pages/components/list_item_example.dart
+++ b/example/lib/pages/components/list_item_example.dart
@@ -26,7 +26,7 @@ class _ListItemExampleState extends State {
return ExampleScaffold(
name: ListItemExample.name,
child: Container(
- color: zetaColors.surfaceSecondary,
+ color: zetaColors.surfaceWarm,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
diff --git a/example/lib/pages/components/navigation_rail_example.dart b/example/lib/pages/components/navigation_rail_example.dart
index f1429f9b..9c1c5101 100644
--- a/example/lib/pages/components/navigation_rail_example.dart
+++ b/example/lib/pages/components/navigation_rail_example.dart
@@ -63,7 +63,7 @@ class _NavigationRailExampleState extends State {
_titles[_selectedIndex!],
textAlign: TextAlign.center,
style: ZetaTextStyles.titleMedium.copyWith(
- color: zeta.colors.textDefault,
+ color: zeta.colors.mainDefault,
fontWeight: FontWeight.bold,
),
),
diff --git a/example/lib/pages/components/notification_list_example.dart b/example/lib/pages/components/notification_list_example.dart
index 1b203145..79a61122 100644
--- a/example/lib/pages/components/notification_list_example.dart
+++ b/example/lib/pages/components/notification_list_example.dart
@@ -32,7 +32,7 @@ class NotificationListItemExample extends StatelessWidget {
avatar: ZetaAvatar.initials(
initials: "JS",
lowerBadge: ZetaAvatarBadge.icon(
- color: ZetaColors().surfacePositive,
+ color: Zeta.of(context).colors.surfacePositive,
icon: Icons.check,
),
)),
@@ -63,7 +63,7 @@ class NotificationListItemExample extends StatelessWidget {
avatar: ZetaAvatar.initials(
initials: "JS",
lowerBadge: ZetaAvatarBadge.icon(
- color: ZetaColors().surfacePositive,
+ color: Zeta.of(context).colors.surfacePositive,
icon: Icons.check,
),
)),
@@ -88,7 +88,7 @@ class NotificationListItemExample extends StatelessWidget {
initials: "JS",
semanticUpperBadgeLabel: 'Urgent',
lowerBadge: ZetaAvatarBadge.icon(
- color: ZetaColors().surfacePositive,
+ color: Zeta.of(context).colors.surfacePositive,
icon: Icons.check,
),
),
diff --git a/example/lib/pages/theme/color_example.dart b/example/lib/pages/theme/color_example.dart
index 9bb96c64..9b6f5602 100644
--- a/example/lib/pages/theme/color_example.dart
+++ b/example/lib/pages/theme/color_example.dart
@@ -16,117 +16,131 @@ class _ColorExampleState extends State {
@override
Widget build(BuildContext context) {
- final zeta = Zeta.of(context);
- final colors = zeta.colors;
+ final colors = Zeta.of(context).colors;
return LayoutBuilder(
builder: (context, constraints) {
- final Map swatches = {
- 'Blue': colors.blue,
- 'Green': colors.green,
- 'Red': colors.red,
- 'Orange': colors.orange,
- 'Purple': colors.purple,
- 'Yellow': colors.yellow,
- 'Teal': colors.teal,
- 'Pink': colors.pink,
- 'Grey Warm': colors.warm,
- 'Grey Cool': colors.cool,
+ final blockSize = constraints.maxWidth / 11;
+ final Map primitives = {
+ 'cool': colors.primitives.cool,
+ 'warm': colors.primitives.warm,
+ 'blue': colors.primitives.blue,
+ 'green': colors.primitives.green,
+ 'red': colors.primitives.red,
+ 'orange': colors.primitives.orange,
+ 'purple': colors.primitives.purple,
+ 'yellow': colors.primitives.yellow,
+ 'teal': colors.primitives.teal,
+ 'pink': colors.primitives.pink,
};
-
- final Map generatedSwatches = {
- 'Gen-Blue': ZetaColorSwatch.fromColor(
- colors.blue,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Blue': colors.blue,
- 'Gen-Green': ZetaColorSwatch.fromColor(
- colors.green,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Green': colors.green,
- 'Gen-Red': ZetaColorSwatch.fromColor(
- colors.red,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Red': colors.red,
- 'Gen-Orange': ZetaColorSwatch.fromColor(
- colors.orange,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Orange': colors.orange,
- 'Gen-Purple': ZetaColorSwatch.fromColor(
- colors.purple,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Purple': colors.purple,
- 'Gen-Yellow': ZetaColorSwatch.fromColor(
- colors.yellow,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Yellow': colors.yellow,
- 'Gen-Teal': ZetaColorSwatch.fromColor(
- colors.teal,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Teal': colors.teal,
- 'Gen-Pink': ZetaColorSwatch.fromColor(
- colors.pink,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Pink': colors.pink,
- 'Gen-Grey Warm': ZetaColorSwatch.fromColor(
- colors.warm,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Grey Warm': colors.warm,
- 'Gen-Grey Cool': ZetaColorSwatch.fromColor(
- colors.cool,
- brightness: zeta.brightness,
- contrast: colors.contrast,
- ),
- 'Grey Cool': colors.cool,
+ final Map primitivesPure = {
+ 'white': colors.primitives.pure.shade0,
+ 'mid': colors.primitives.pure.shade500,
+ 'black': colors.primitives.pure.shade1000,
};
- final Map textIcon = {
- 'textDefault': colors.textDefault,
- 'textSubtle': colors.textSubtle,
- 'textDisabled': colors.textDisabled,
- 'textInverse': colors.textInverse,
- };
- final Map border = {
- 'borderDefault': colors.borderDefault,
- 'borderSubtle': colors.borderSubtle,
- 'borderDisabled': colors.borderDisabled,
- 'borderSelected': colors.borderSelected,
+ final Map mainColors = {
+ 'defaultColor': colors.mainDefault,
+ 'subtle': colors.mainSubtle,
+ 'light': colors.mainLight,
+ 'inverse': colors.mainInverse,
+ 'disabled': colors.mainDisabled,
+ 'primary': colors.mainPrimary,
+ 'secondary': colors.mainSecondary,
+ 'positive': colors.mainPositive,
+ 'warning': colors.mainWarning,
+ 'negative': colors.mainNegative,
+ 'info': colors.mainInfo,
};
- final Map backdrop = {
- 'surfacePrimary': colors.surfacePrimary,
- 'surfaceDisabled': colors.surfaceDisabled,
- 'surfaceHover': colors.surfaceHover,
- 'surfaceSecondary': colors.surfaceSecondary,
- 'surfaceTertiary': colors.surfaceTertiary,
- 'surfaceSelectedHover': colors.surfaceSelectedHover,
- 'surfaceSelected': colors.surfaceSelected,
+ final Map borderColors = {
+ 'defaultColor': colors.borderDefault,
+ 'subtle': colors.borderSubtle,
+ 'hover': colors.borderHover,
+ 'selected': colors.borderSelected,
+ 'disabled': colors.borderDisabled,
+ 'pure': colors.borderPure,
+ 'primaryMain': colors.borderPrimaryMain,
+ 'primary': colors.borderPrimary,
+ 'secondary': colors.borderSecondary,
+ 'positive': colors.borderPositive,
+ 'warning': colors.borderWarning,
+ 'negative': colors.borderNegative,
+ 'info': colors.borderInfo,
};
-
- final Map primaries = {
- 'primaryColor': colors.primary.text,
- 'secondaryColor': colors.secondary.text,
- };
-
- final Map alerts = {
- 'negative': colors.surfaceNegative,
+ final Map surfaceColors = {
+ 'defaultColor': colors.surfaceDefault,
+ 'defaultInverse': colors.surfaceDefaultInverse,
+ 'hover': colors.surfaceHover,
+ 'selected': colors.surfaceSelected,
+ 'selectedHover': colors.surfaceSelectedHover,
+ 'disabled': colors.surfaceDisabled,
+ 'cool': colors.surfaceCool,
+ 'warm': colors.surfaceWarm,
+ 'primary': colors.surfacePrimary,
+ 'primarySubtle': colors.surfacePrimarySubtle,
+ 'secondary': colors.surfaceSecondary,
+ 'secondarySubtle': colors.surfaceSecondarySubtle,
+ 'positive': colors.surfacePositive,
+ 'positiveSubtle': colors.surfacePositiveSubtle,
'warning': colors.surfaceWarning,
+ 'warningSubtle': colors.surfaceWarningSubtle,
+ 'negative': colors.surfaceNegative,
+ 'negativeSubtle': colors.surfaceNegativeSubtle,
'info': colors.surfaceInfo,
+ 'infoSubtle': colors.surfaceInfoSubtle,
+ };
+ final Map avatarColors = {
+ 'blue': colors.surfaceAvatarBlue,
+ 'green': colors.surfaceAvatarGreen,
+ 'orange': colors.surfaceAvatarOrange,
+ 'pink': colors.surfaceAvatarPink,
+ 'purple': colors.surfaceAvatarPurple,
+ 'teal': colors.surfaceAvatarTeal,
+ 'yellow': colors.surfaceAvatarYellow,
+ };
+ final Map disabled = {
+ 'disabled': colors.stateDisabledDisabled,
+ };
+ final Map defaultColors = {
+ 'enabled': colors.stateDefaultEnabled,
+ 'hover': colors.stateDefaultHover,
+ 'selected': colors.stateDefaultSelected,
+ 'focus': colors.stateDefaultFocus,
+ };
+ final Map primary = {
+ 'enabled': colors.statePrimaryEnabled,
+ 'hover': colors.statePrimaryHover,
+ 'selected': colors.statePrimarySelected,
+ 'focus': colors.statePrimaryFocus,
+ };
+ final Map secondary = {
+ 'enabled': colors.stateSecondaryEnabled,
+ 'hover': colors.stateSecondaryHover,
+ 'selected': colors.stateSecondarySelected,
+ 'focus': colors.stateSecondaryFocus,
+ };
+ final Map positive = {
+ 'enabled': colors.statePositiveEnabled,
+ 'hover': colors.statePositiveHover,
+ 'selected': colors.statePositiveSelected,
+ 'focus': colors.statePositiveFocus,
+ };
+ final Map negative = {
+ 'enabled': colors.stateNegativeEnabled,
+ 'hover': colors.stateNegativeHover,
+ 'selected': colors.stateNegativeSelected,
+ 'focus': colors.stateNegativeFocus,
+ };
+ final Map info = {
+ 'enabled': colors.stateInfoEnabled,
+ 'hover': colors.stateInfoHover,
+ 'selected': colors.stateInfoSelected,
+ 'focus': colors.stateInfoFocus,
+ };
+ final Map inverse = {
+ 'enabled': colors.stateInverseEnabled,
+ 'hover': colors.stateInverseHover,
+ 'selected': colors.stateInverseSelected,
+ 'focus': colors.stateInverseFocus,
};
return ExampleScaffold(
@@ -135,90 +149,53 @@ class _ColorExampleState extends State {
padding: EdgeInsets.all(Zeta.of(context).spacing.medium),
child: Column(
children: [
- MyRow(children: textIcon, title: 'Text and icon styles'),
- MyRow(children: border, title: 'Border styles'),
- MyRow(children: backdrop, title: 'Backdrop colors'),
- MyRow(children: primaries, title: 'Primary colors'),
- MyRow(children: alerts, title: 'Alert colors'),
- Row(children: [Text('Full color swatches', style: ZetaTextStyles.displayMedium)])
- .paddingVertical(Zeta.of(context).spacing.xl_4),
- ...swatches.entries.map(
- (value) => Row(
- children: List.generate(10, (index) => 100 - (10 * index))
- .map(
- (e) => Expanded(
- child: Container(
- height: constraints.maxWidth / 10,
- color: value.value[e],
- child: FittedBox(
- fit: BoxFit.scaleDown,
- child: Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
- DefaultTextStyle(
- style: ZetaTextStyles.bodyMedium
- .copyWith(color: calculateTextColor(value.value[e] ?? Colors.white)),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Text('${value.key.toLowerCase().replaceAll(' ', '')}-$e'),
- Text(value.value[e].toString().replaceAll('Color(0xff', '#').substring(0, 7)),
- ],
- ),
- ),
- ]),
- ),
- ),
- ),
- )
- .toList(),
- ),
+ Text('Semantic colors', style: ZetaTextStyles.displaySmall),
+ MyRow(children: mainColors, title: 'Main Colors'),
+ MyRow(children: borderColors, title: 'Main Colors'),
+ MyRow(children: surfaceColors, title: 'Surface Colors'),
+ MyRow(children: avatarColors, title: 'Surface / Avatar Colors'),
+ MyRow(children: disabled, title: 'State / disabled Colors'),
+ MyRow(children: defaultColors, title: 'State / default Colors'),
+ MyRow(children: primary, title: 'State / primary Colors'),
+ MyRow(children: secondary, title: 'State / secondary Colors'),
+ MyRow(children: positive, title: 'State / positive Colors'),
+ MyRow(children: negative, title: 'State / negative Colors'),
+ MyRow(children: info, title: 'State / info Colors'),
+ MyRow(children: inverse, title: 'State / inverse Colors'),
+ Row(children: [
+ Text('Full color swatches', style: ZetaTextStyles.displayMedium),
+ ]).paddingVertical(Zeta.of(context).spacing.xl_4),
+ Row(
+ children: primitivesPure.entries
+ .map(
+ (value) => SwatchBox(
+ color: value.value,
+ name: 'pure',
+ blockSize: blockSize,
+ value: value.key == 'mid'
+ ? 500
+ : value.key == 'white'
+ ? 0
+ : 1000,
+ ),
+ )
+ .toList(),
),
- ElevatedButton(
- onPressed: () => setState(() => showGeneratedColors = !showGeneratedColors),
- child: const Text('Toggle generated colors').paddingAll(Zeta.of(context).spacing.medium),
- ).paddingAll(Zeta.of(context).spacing.medium),
- if (showGeneratedColors)
- Row(children: [Text('Generated color swatches', style: ZetaTextStyles.displayMedium)])
- .paddingVertical(Zeta.of(context).spacing.xl_4),
- if (showGeneratedColors)
- ...generatedSwatches.entries.map(
- (value) => Row(
- children: List.generate(11, (index) => 110 - (10 * index))
- .map(
- (e) => Expanded(
- child: Container(
- height: constraints.maxWidth / 10,
- color: e == 110 ? colors.surfacePrimary : value.value[e],
- child: e == 110
- ? Nothing()
- : FittedBox(
- fit: BoxFit.scaleDown,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- DefaultTextStyle(
- style: ZetaTextStyles.bodyMedium
- .copyWith(color: calculateTextColor(value.value[e] ?? Colors.white)),
- child: Column(
- children: [
- Text('${value.key.toLowerCase().replaceAll(' ', '')}-$e'),
- Text(
- value.value[e]
- .toString()
- .replaceAll('Color(0xff', '#')
- .substring(0, 7),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- )
- .toList(),
- ),
- ),
+ ...primitives.entries
+ .map(
+ (value) => Row(
+ children: List.generate(10, (index) => 100 - (10 * index))
+ .map(
+ (e) => SwatchBox(
+ color: value.value[e] ?? Colors.white,
+ name: value.key,
+ blockSize: blockSize,
+ value: e,
+ ),
+ )
+ .toList()),
+ )
+ .toList(),
],
),
),
@@ -228,6 +205,39 @@ class _ColorExampleState extends State {
}
}
+class SwatchBox extends StatelessWidget {
+ const SwatchBox({super.key, required this.color, required this.name, required this.blockSize, required this.value});
+
+ final Color color;
+ final int value;
+ final String name;
+ final double blockSize;
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ height: blockSize,
+ width: blockSize,
+ color: color,
+ child: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
+ DefaultTextStyle(
+ style: ZetaTextStyles.bodyMedium.copyWith(color: calculateTextColor(color)),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+ children: [
+ Text('${name.toLowerCase().replaceAll(' ', '')}-$value'),
+ Text(color.toString().replaceAll('Color(0xff', '#').substring(0, 7)),
+ ],
+ ),
+ ),
+ ]),
+ ),
+ );
+ }
+}
+
class MyRow extends StatelessWidget {
final Map children;
final String title;
diff --git a/example/lib/pages/theme/radius_example.dart b/example/lib/pages/theme/radius_example.dart
index 199ce397..6137da88 100644
--- a/example/lib/pages/theme/radius_example.dart
+++ b/example/lib/pages/theme/radius_example.dart
@@ -31,21 +31,21 @@ class RadiusExample extends StatelessWidget {
height: 100,
decoration: BoxDecoration(
borderRadius: rad,
- color: Zeta.of(context).colors.blue.shade30,
- border: Border.all(color: colors.blue.shade80, width: 3),
+ color: Zeta.of(context).colors.surfacePrimarySubtle,
+ border: Border.all(color: colors.borderPrimary, width: 3),
),
child: Center(
child: Container(
decoration: BoxDecoration(
borderRadius: rad,
- color: Zeta.of(context).colors.surfacePrimary,
- border: Border.all(color: colors.blue.shade50, width: 3),
+ color: Zeta.of(context).colors.surfaceDefault,
+ border: Border.all(color: colors.borderPrimary, width: 3),
),
padding: EdgeInsets.all(Zeta.of(context).spacing.large),
child: Text(
rad.radiusString.split('.').last.capitalize(),
style: ZetaTextStyles.titleMedium.apply(
- color: Zeta.of(context).colors.textDefault,
+ color: Zeta.of(context).colors.mainDefault,
fontStyle: FontStyle.normal,
decoration: TextDecoration.none,
),
diff --git a/example/lib/pages/theme/spacing_example.dart b/example/lib/pages/theme/spacing_example.dart
index 4be2cb92..2dce69b1 100644
--- a/example/lib/pages/theme/spacing_example.dart
+++ b/example/lib/pages/theme/spacing_example.dart
@@ -59,8 +59,8 @@ class SpacingExample extends StatelessWidget {
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
- children: baseSpacings.entries.map((obj) => _SpacingDemo(obj)).toList(),
- ),
+ children: baseSpacings.entries.map((obj) => _SpacingDemo(obj, true)).toList(),
+ )
],
),
),
@@ -71,26 +71,27 @@ class SpacingExample extends StatelessWidget {
class _SpacingDemo extends StatelessWidget {
final MapEntry size;
+ final bool primitive;
- const _SpacingDemo(this.size);
+ const _SpacingDemo(this.size, [this.primitive = false]);
@override
Widget build(BuildContext context) {
final colors = Zeta.of(context).colors;
return Container(
- color: colors.blue.shade30,
+ color: colors.primitives.blue.shade30,
margin: EdgeInsets.all(Zeta.of(context).spacing.xl_2),
child: CustomPaint(
- painter: _TagPainter(color: colors.pink),
+ painter: _TagPainter(color: colors.primitives.pink),
child: LayoutBuilder(builder: (context, c2) {
return Container(
margin: EdgeInsets.all(size.value),
padding: EdgeInsets.all(Zeta.of(context).spacing.medium),
- color: colors.surfacePrimary,
+ color: colors.surfaceDefault,
child: Text(
'Zeta.of(context).spacing.' + size.key,
style: ZetaTextStyles.titleMedium.apply(
- color: Zeta.of(context).colors.textDefault,
+ color: Zeta.of(context).colors.mainDefault,
fontStyle: FontStyle.normal,
decoration: TextDecoration.none,
),
diff --git a/example/lib/theme_service.dart b/example/lib/theme_service.dart
deleted file mode 100644
index 3c80a1b9..00000000
--- a/example/lib/theme_service.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-import 'package:flutter/src/material/app.dart';
-import 'package:shared_preferences/shared_preferences.dart';
-import 'package:zeta_example/utils/theme_color_switch.dart';
-import 'package:zeta_flutter/zeta_flutter.dart';
-
-class SharedPrefsThemeService extends ZetaThemeService {
- SharedPrefsThemeService(this.preferences);
-
- final SharedPreferences preferences;
-
- @override
- Future<(ZetaThemeData?, ThemeMode?, ZetaContrast?)> loadTheme() async {
- final theme = preferences.getString('theme') ?? 'default';
- final themeData = appThemes[theme];
-
- final modeString = preferences.getString('themeMode');
- final themeMode = modeString == 'light'
- ? ThemeMode.light
- : modeString == 'dark'
- ? ThemeMode.dark
- : ThemeMode.system;
-
- final contrastString = preferences.getString('contrast');
- final contrast = contrastString == 'aaa' ? ZetaContrast.aaa : ZetaContrast.aa;
-
- return (themeData, themeMode, contrast);
- }
-
- @override
- Future saveTheme({
- required ZetaThemeData themeData,
- required ThemeMode themeMode,
- required ZetaContrast contrast,
- }) async {
- await preferences.setString('theme', themeData.identifier);
-
- final modeString = themeMode == ThemeMode.light
- ? 'light'
- : themeMode == ThemeMode.dark
- ? 'dark'
- : 'system';
- await preferences.setString('themeMode', modeString);
-
- final contrastString = contrast == ZetaContrast.aaa ? 'aaa' : 'aa';
- await preferences.setString('contrast', contrastString);
- }
-}
diff --git a/example/lib/utils/rounded_switch.dart b/example/lib/utils/rounded_switch.dart
index f8d3acd7..3d555518 100644
--- a/example/lib/utils/rounded_switch.dart
+++ b/example/lib/utils/rounded_switch.dart
@@ -21,11 +21,11 @@ class ZetaRoundedSwitch extends StatelessWidget {
alignment: Alignment.center,
child: ZetaAvatar(
size: ZetaAvatarSize.xxs,
- image: Icon(e ? Icons.circle : Icons.square, color: zeta.colors.primary),
+ image: Icon(e ? Icons.circle : Icons.square, color: zeta.colors.mainPrimary),
initialTextStyle: TextStyle(
fontSize: 28,
letterSpacing: Zeta.of(context).spacing.none,
- color: Zeta.of(context).colors.primary,
+ color: Zeta.of(context).colors.mainPrimary,
fontWeight: FontWeight.w500,
),
),
diff --git a/example/lib/utils/theme_color_switch.dart b/example/lib/utils/theme_color_switch.dart
index c205ed11..6c71234d 100644
--- a/example/lib/utils/theme_color_switch.dart
+++ b/example/lib/utils/theme_color_switch.dart
@@ -1,66 +1,57 @@
import 'package:flutter/material.dart';
import 'package:zeta_flutter/zeta_flutter.dart';
-late final appThemes = {
- "default": ZetaThemeData(),
- "teal": ZetaThemeData(
- identifier: 'teal',
- primary: ZetaColorBase.teal,
- ),
- "yellow": ZetaThemeData(
- identifier: 'yellow',
- primary: ZetaColorBase.yellow,
- ),
- "red": ZetaThemeData(
- identifier: 'red',
- primary: ZetaColorBase.red,
- ),
- "purple": ZetaThemeData(
- identifier: 'purple',
- primary: ZetaColorBase.purple,
- ),
-};
-
-class ZetaThemeColorSwitch extends StatelessWidget {
+class ZetaThemeColorSwitch extends StatefulWidget {
ZetaThemeColorSwitch({super.key});
+ @override
+ State createState() => _ZetaThemeColorSwitchState();
+}
+
+class _ZetaThemeColorSwitchState extends State {
@override
Widget build(BuildContext context) {
final zeta = Zeta.of(context);
+ final zetaProvider = ZetaProvider.of(context);
+
+ final Map items = {};
+ items.putIfAbsent(null, () => ZetaIcon(ZetaIcons.block));
- ZetaColors primary(ZetaThemeData data) {
- if (zeta.brightness == Brightness.light) {
- return data.colorsLight;
- } else {
- return data.colorsDark;
- }
- }
+ zetaProvider.customThemes.forEach((e) {
+ final color = e.primary;
+ final name = e.id;
+ items.putIfAbsent(
+ name,
+ () => ZetaAvatar(
+ size: ZetaAvatarSize.xxs,
+ backgroundColor: zeta.colors.surfaceDefault,
+ image: ZetaIcon(
+ Icons.color_lens,
+ color: color ??
+ (Zeta.of(context).brightness == Brightness.light
+ ? ZetaPrimitivesLight().blue
+ : ZetaPrimitivesDark().blue),
+ ),
+ ),
+ );
+ });
return DropdownButtonHideUnderline(
- child: DropdownButton(
- value: zeta.themeData.identifier,
+ child: DropdownButton(
+ value: zeta.customThemeId,
elevation: 0,
padding: EdgeInsets.all(8),
icon: Nothing(),
dropdownColor: zeta.colors.borderDisabled,
- items: appThemes.entries.map((e) {
- final zetaColors = primary(appThemes[e.key]!);
- final color = zetaColors.primary;
- return DropdownMenuItem(
- value: e.value.identifier,
- alignment: Alignment.center,
- child: ZetaAvatar(
- size: ZetaAvatarSize.xxs,
- backgroundColor: color.surface,
- image: ZetaIcon(Icons.color_lens, color: color),
- ),
- );
- }).toList(),
+ items: items.entries
+ .map((e) => DropdownMenuItem(
+ value: e.key,
+ alignment: Alignment.center,
+ child: e.value,
+ ))
+ .toList(),
onChanged: (value) {
- final theme = appThemes[value];
- if (theme != null) {
- ZetaProvider.of(context).updateThemeData(theme);
- }
+ ZetaProvider.of(context).updateCustomTheme(themeId: value);
},
),
);
diff --git a/example/lib/utils/theme_constrast_switch.dart b/example/lib/utils/theme_constrast_switch.dart
index de59993d..658e6b82 100644
--- a/example/lib/utils/theme_constrast_switch.dart
+++ b/example/lib/utils/theme_constrast_switch.dart
@@ -13,14 +13,6 @@ class ZetaThemeContrastSwitch extends StatelessWidget {
Widget build(BuildContext context) {
final zeta = Zeta.of(context);
- ZetaColors zetaColors(ZetaContrast contrast) {
- if (zeta.brightness == Brightness.light) {
- return zeta.themeData.apply(contrast: contrast).colorsLight;
- } else {
- return zeta.themeData.apply(contrast: contrast).colorsDark;
- }
- }
-
return DropdownButtonHideUnderline(
child: DropdownButton(
value: zeta.contrast,
@@ -29,18 +21,20 @@ class ZetaThemeContrastSwitch extends StatelessWidget {
icon: Nothing(),
dropdownColor: zeta.colors.borderDisabled,
items: _themes.map((e) {
- final colors = zetaColors(e);
+ final ZetaColors colors = (e == ZetaContrast.aa
+ ? ZetaColorsAA(primitives: Zeta.of(context).colors.primitives)
+ : ZetaColorsAAA(primitives: Zeta.of(context).colors.primitives)) as ZetaColors;
return DropdownMenuItem(
value: e,
alignment: Alignment.center,
child: ZetaAvatar(
size: ZetaAvatarSize.xxs,
- backgroundColor: colors.primary.surface,
- initials: e == ZetaContrast.aa ? 'AA' : 'AAA',
+ backgroundColor: colors.surfaceDefault,
+ initials: e.name.toUpperCase(),
initialTextStyle: TextStyle(
fontSize: 14,
letterSpacing: Zeta.of(context).spacing.none,
- color: colors.primary,
+ color: colors.mainPrimary,
fontWeight: FontWeight.w500,
),
),
diff --git a/example/lib/utils/theme_mode_switch.dart b/example/lib/utils/theme_mode_switch.dart
index 1250c93b..f642cb20 100644
--- a/example/lib/utils/theme_mode_switch.dart
+++ b/example/lib/utils/theme_mode_switch.dart
@@ -13,15 +13,7 @@ class ZetaThemeModeSwitch extends StatelessWidget {
@override
Widget build(BuildContext context) {
final zeta = Zeta.of(context);
-
- ZetaColors zetaColors(ThemeMode mode) {
- if ((mode == ThemeMode.system && MediaQuery.of(context).platformBrightness == Brightness.light) ||
- mode == ThemeMode.light) {
- return zeta.themeData.colorsLight;
- } else {
- return zeta.themeData.colorsDark;
- }
- }
+ final colors = zeta.colors;
return DropdownButtonHideUnderline(
child: DropdownButton(
@@ -31,20 +23,19 @@ class ZetaThemeModeSwitch extends StatelessWidget {
icon: Nothing(),
dropdownColor: zeta.colors.borderDisabled,
items: _themes.map((e) {
- final colors = zetaColors(e);
return DropdownMenuItem(
value: e,
alignment: Alignment.center,
child: ZetaAvatar(
size: ZetaAvatarSize.xxs,
- backgroundColor: colors.primary.surface,
+ backgroundColor: colors.surfaceDefault,
image: ZetaIcon(
e == ThemeMode.system
? Icons.system_security_update_good
: e == ThemeMode.light
? Icons.light_mode
: Icons.dark_mode,
- color: colors.primary,
+ color: colors.mainPrimary,
),
),
);
diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock
index fbd492e5..1aff447e 100644
--- a/example/macos/Podfile.lock
+++ b/example/macos/Podfile.lock
@@ -35,7 +35,7 @@ SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
- sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13
+ sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift
index 8e02df28..b3c17614 100644
--- a/example/macos/Runner/AppDelegate.swift
+++ b/example/macos/Runner/AppDelegate.swift
@@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
+
+ override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
+ return true
+ }
}
diff --git a/example/widgetbook/pages/components/avatar_rail_widgetbook.dart b/example/widgetbook/pages/components/avatar_rail_widgetbook.dart
index 1b738085..a70122be 100644
--- a/example/widgetbook/pages/components/avatar_rail_widgetbook.dart
+++ b/example/widgetbook/pages/components/avatar_rail_widgetbook.dart
@@ -23,18 +23,19 @@ Widget avatarRailUseCase(BuildContext context) {
upperBadge: context.knobs.boolean(label: 'Status Badge', initialValue: false)
? ZetaAvatarBadge.icon(
icon: ZetaIcons.close,
- color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.green) ??
- colors.iconDefault,
+ color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.primitives.green) ??
+ colors.mainDefault,
)
: null,
- borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.green),
+ borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.primitives.green),
lowerBadge: context.knobs.boolean(label: 'Notification Badge', initialValue: false)
? ZetaAvatarBadge.notification(
value: context.knobs.intOrNull.input(label: "Value", initialValue: 1),
)
: null,
initials: context.knobs.stringOrNull(label: 'Initials', initialValue: 'AZ'),
- backgroundColor: context.knobs.colorOrNull(label: 'Background color', initialValue: colors.purple.shade80),
+ backgroundColor:
+ context.knobs.colorOrNull(label: 'Background color', initialValue: colors.primitives.purple.shade80),
onTap: () => print('Avatar tapped'),
label: context.knobs.stringOrNull(label: 'Label', initialValue: 'ABC'),
),
@@ -49,18 +50,19 @@ Widget avatarRailUseCase(BuildContext context) {
upperBadge: context.knobs.boolean(label: 'Status Badge', initialValue: false)
? ZetaAvatarBadge.icon(
icon: ZetaIcons.close,
- color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.green) ??
- colors.iconDefault,
+ color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.primitives.green) ??
+ colors.mainDefault,
)
: null,
- borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.green),
+ borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.primitives.green),
lowerBadge: context.knobs.boolean(label: 'Notification Badge', initialValue: false)
? ZetaAvatarBadge.notification(
value: context.knobs.intOrNull.input(label: "Value", initialValue: 1),
)
: null,
initials: context.knobs.stringOrNull(label: 'Initials', initialValue: 'AZ'),
- backgroundColor: context.knobs.colorOrNull(label: 'Background color', initialValue: colors.purple.shade80),
+ backgroundColor:
+ context.knobs.colorOrNull(label: 'Background color', initialValue: colors.primitives.purple.shade80),
onTap: () => print('Avatar tapped'),
label: context.knobs.stringOrNull(label: 'Label', initialValue: 'ABC'),
),
@@ -75,18 +77,19 @@ Widget avatarRailUseCase(BuildContext context) {
upperBadge: context.knobs.boolean(label: 'Status Badge', initialValue: false)
? ZetaAvatarBadge.icon(
icon: ZetaIcons.close,
- color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.green) ??
- colors.iconDefault,
+ color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.primitives.green) ??
+ colors.mainDefault,
)
: null,
- borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.green),
+ borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.primitives.green),
lowerBadge: context.knobs.boolean(label: 'Notification Badge', initialValue: false)
? ZetaAvatarBadge.notification(
value: context.knobs.intOrNull.input(label: "Value", initialValue: 1),
)
: null,
initials: context.knobs.stringOrNull(label: 'Initials', initialValue: 'AZ'),
- backgroundColor: context.knobs.colorOrNull(label: 'Background color', initialValue: colors.purple.shade80),
+ backgroundColor:
+ context.knobs.colorOrNull(label: 'Background color', initialValue: colors.primitives.purple.shade80),
onTap: () => print('Avatar tapped'),
label: context.knobs.stringOrNull(label: 'Label', initialValue: 'ABC'),
),
@@ -101,18 +104,19 @@ Widget avatarRailUseCase(BuildContext context) {
upperBadge: context.knobs.boolean(label: 'Status Badge', initialValue: false)
? ZetaAvatarBadge.icon(
icon: ZetaIcons.close,
- color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.green) ??
- colors.iconDefault,
+ color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.primitives.green) ??
+ colors.mainDefault,
)
: null,
- borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.green),
+ borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.primitives.green),
lowerBadge: context.knobs.boolean(label: 'Notification Badge', initialValue: false)
? ZetaAvatarBadge.notification(
value: context.knobs.intOrNull.input(label: "Value", initialValue: 1),
)
: null,
initials: context.knobs.stringOrNull(label: 'Initials', initialValue: 'AZ'),
- backgroundColor: context.knobs.colorOrNull(label: 'Background color', initialValue: colors.purple.shade80),
+ backgroundColor:
+ context.knobs.colorOrNull(label: 'Background color', initialValue: colors.primitives.purple.shade80),
onTap: () => print('Avatar tapped'),
label: context.knobs.stringOrNull(label: 'Label', initialValue: 'ABC'),
),
@@ -127,18 +131,19 @@ Widget avatarRailUseCase(BuildContext context) {
upperBadge: context.knobs.boolean(label: 'Status Badge', initialValue: false)
? ZetaAvatarBadge.icon(
icon: ZetaIcons.close,
- color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.green) ??
- colors.iconDefault,
+ color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.primitives.green) ??
+ colors.mainDefault,
)
: null,
- borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.green),
+ borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.primitives.green),
lowerBadge: context.knobs.boolean(label: 'Notification Badge', initialValue: false)
? ZetaAvatarBadge.notification(
value: context.knobs.intOrNull.input(label: "Value", initialValue: 1),
)
: null,
initials: context.knobs.stringOrNull(label: 'Initials', initialValue: 'AZ'),
- backgroundColor: context.knobs.colorOrNull(label: 'Background color', initialValue: colors.purple.shade80),
+ backgroundColor:
+ context.knobs.colorOrNull(label: 'Background color', initialValue: colors.primitives.purple.shade80),
onTap: () => print('Avatar tapped'),
label: context.knobs.stringOrNull(label: 'Label', initialValue: 'ABC'),
),
@@ -153,18 +158,19 @@ Widget avatarRailUseCase(BuildContext context) {
upperBadge: context.knobs.boolean(label: 'Status Badge', initialValue: false)
? ZetaAvatarBadge.icon(
icon: ZetaIcons.close,
- color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.green) ??
- colors.iconDefault,
+ color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.primitives.green) ??
+ colors.mainDefault,
)
: null,
- borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.green),
+ borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.primitives.green),
lowerBadge: context.knobs.boolean(label: 'Notification Badge', initialValue: false)
? ZetaAvatarBadge.notification(
value: context.knobs.intOrNull.input(label: "Value", initialValue: 1),
)
: null,
initials: context.knobs.stringOrNull(label: 'Initials', initialValue: 'AZ'),
- backgroundColor: context.knobs.colorOrNull(label: 'Background color', initialValue: colors.purple.shade80),
+ backgroundColor:
+ context.knobs.colorOrNull(label: 'Background color', initialValue: colors.primitives.purple.shade80),
onTap: () => print('Avatar tapped'),
label: context.knobs.stringOrNull(label: 'Label', initialValue: 'ABC'),
),
diff --git a/example/widgetbook/pages/components/avatar_widgetbook.dart b/example/widgetbook/pages/components/avatar_widgetbook.dart
index 8751ee0d..4bab90c1 100644
--- a/example/widgetbook/pages/components/avatar_widgetbook.dart
+++ b/example/widgetbook/pages/components/avatar_widgetbook.dart
@@ -20,18 +20,19 @@ Widget avatarUseCase(BuildContext context) {
upperBadge: context.knobs.boolean(label: 'Status Badge', initialValue: false)
? ZetaAvatarBadge.icon(
icon: ZetaIcons.close,
- color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.green) ??
- colors.iconDefault,
+ color: context.knobs.colorOrNull(label: "Upper Badge Color", initialValue: colors.primitives.green) ??
+ colors.mainDefault,
)
: null,
- borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.green),
+ borderColor: context.knobs.colorOrNull(label: 'Outline', initialValue: colors.primitives.green),
lowerBadge: context.knobs.boolean(label: 'Notification Badge', initialValue: false)
? ZetaAvatarBadge.notification(
value: context.knobs.intOrNull.input(label: "Value", initialValue: 1),
)
: null,
initials: context.knobs.stringOrNull(label: 'Initials', initialValue: 'AZ'),
- backgroundColor: context.knobs.colorOrNull(label: 'Background color', initialValue: colors.purple.shade80),
+ backgroundColor:
+ context.knobs.colorOrNull(label: 'Background color', initialValue: colors.primitives.purple.shade80),
onTap: () => print('Avatar tapped'),
label: context.knobs.stringOrNull(label: 'Label', initialValue: 'ABC'),
labelMaxLines: context.knobs.int.slider(label: 'Label Max Lines', min: 1, max: 3, initialValue: 1),
diff --git a/example/widgetbook/pages/components/navigation_rail_widgetbook.dart b/example/widgetbook/pages/components/navigation_rail_widgetbook.dart
index bafbf9f2..4b4016e5 100644
--- a/example/widgetbook/pages/components/navigation_rail_widgetbook.dart
+++ b/example/widgetbook/pages/components/navigation_rail_widgetbook.dart
@@ -48,7 +48,7 @@ Widget navigationRailUseCase(BuildContext context) {
itemsList[selectedIndex!],
textAlign: TextAlign.center,
style: ZetaTextStyles.titleMedium.copyWith(
- color: zeta.colors.textDefault,
+ color: zeta.colors.mainDefault,
fontWeight: FontWeight.bold,
),
),
diff --git a/example/widgetbook/pages/introduction.dart b/example/widgetbook/pages/introduction.dart
index a72d8f3c..56bc2bc1 100644
--- a/example/widgetbook/pages/introduction.dart
+++ b/example/widgetbook/pages/introduction.dart
@@ -42,7 +42,7 @@ class _IntroductionWidgetbookState extends State {
children: [
Container(
decoration: BoxDecoration(
- color: colors.cool.shade20,
+ color: colors.surfaceHover,
borderRadius: BorderRadius.only(topLeft: radius, topRight: radius),
),
child: Padding(
@@ -82,7 +82,7 @@ class _IntroductionWidgetbookState extends State {
),
Container(
decoration: BoxDecoration(
- color: isDark ? colors.warm.shade10 : colors.surfacePrimary,
+ color: colors.surfaceDefault,
borderRadius: BorderRadius.only(bottomLeft: radius, bottomRight: radius),
),
width: double.infinity,
@@ -97,7 +97,7 @@ class _IntroductionWidgetbookState extends State {
configs: [
LinkConfig(
style: TextStyle(
- color: colors.blue.shade50,
+ color: colors.mainPrimary,
decoration: TextDecoration.underline,
),
onTap: (url) {
@@ -151,7 +151,7 @@ class _CodeWrapperWidget extends StatelessWidget {
return Stack(
children: [
DefaultTextStyle(
- style: GoogleFonts.ibmPlexMono(color: Zeta.of(context).colors.textDefault),
+ style: GoogleFonts.ibmPlexMono(color: Zeta.of(context).colors.mainDefault),
child: child,
),
if (language.isNotEmpty)
@@ -163,7 +163,8 @@ class _CodeWrapperWidget extends StatelessWidget {
child: Text(language),
padding: EdgeInsets.symmetric(
vertical: Zeta.of(context).spacing.minimum, horizontal: Zeta.of(context).spacing.medium),
- decoration: BoxDecoration(color: colors.cool.shade40, borderRadius: Zeta.of(context).radius.rounded),
+ decoration:
+ BoxDecoration(color: colors.surfaceSelectedHover, borderRadius: Zeta.of(context).radius.rounded),
),
),
),
diff --git a/example/widgetbook/pages/theme/color_widgetbook.dart b/example/widgetbook/pages/theme/color_widgetbook.dart
index 23ccec58..ec98f8ef 100644
--- a/example/widgetbook/pages/theme/color_widgetbook.dart
+++ b/example/widgetbook/pages/theme/color_widgetbook.dart
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:zeta_example/pages/theme/color_example.dart';
import 'package:zeta_flutter/zeta_flutter.dart';
+import '../../utils/scaffold.dart';
+
Widget colorUseCase(BuildContext context) => ColorBody();
class ColorBody extends StatelessWidget {
@@ -9,107 +11,185 @@ class ColorBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return LayoutBuilder(builder: (_, constraints) {
- final colors = Zeta.of(context).colors;
+ final colors = Zeta.of(context).colors;
- final Map swatches = {
- 'Blue': colors.blue,
- 'Green': colors.green,
- 'Red': colors.red,
- 'Orange': colors.orange,
- 'Purple': colors.purple,
- 'Yellow': colors.yellow,
- 'Teal': colors.teal,
- 'Pink': colors.pink,
- 'Grey Warm': colors.warm,
- 'Grey Cool': colors.cool,
+ return WidgetbookScaffold(builder: (context, constraints) {
+ final blockSize = constraints.maxWidth / 11;
+ final Map primitives = {
+ 'cool': colors.primitives.cool,
+ 'warm': colors.primitives.warm,
+ 'blue': colors.primitives.blue,
+ 'green': colors.primitives.green,
+ 'red': colors.primitives.red,
+ 'orange': colors.primitives.orange,
+ 'purple': colors.primitives.purple,
+ 'yellow': colors.primitives.yellow,
+ 'teal': colors.primitives.teal,
+ 'pink': colors.primitives.pink,
};
- final Map textIcon = {
- 'textDefault': colors.textDefault,
- 'textSubtle': colors.textSubtle,
- 'textDisabled': colors.textDisabled,
- 'textInverse': colors.textInverse,
+ final Map primitivesPure = {
+ 'white': colors.primitives.pure.shade0,
+ 'mid': colors.primitives.pure.shade500,
+ 'black': colors.primitives.pure.shade1000,
};
- final Map border = {
- 'borderDefault': colors.borderDefault,
- 'borderSubtle': colors.borderSubtle,
- 'borderDisabled': colors.borderDisabled,
- 'borderSelected': colors.borderSelected,
+
+ final Map mainColors = {
+ 'defaultColor': colors.mainDefault,
+ 'subtle': colors.mainSubtle,
+ 'light': colors.mainLight,
+ 'inverse': colors.mainInverse,
+ 'disabled': colors.mainDisabled,
+ 'primary': colors.mainPrimary,
+ 'secondary': colors.mainSecondary,
+ 'positive': colors.mainPositive,
+ 'warning': colors.mainWarning,
+ 'negative': colors.mainNegative,
+ 'info': colors.mainInfo,
};
- final Map backdrop = {
- 'surfacePrimary': colors.surfacePrimary,
- 'surfaceDisabled': colors.surfaceDisabled,
- 'surfaceHover': colors.surfaceHover,
- 'surfaceSecondary': colors.surfaceSecondary,
- 'surfaceTertiary': colors.surfaceTertiary,
- 'surfaceSelectedHover': colors.surfaceSelectedHover,
- 'surfaceSelected': colors.surfaceSelected,
+ final Map borderColors = {
+ 'defaultColor': colors.borderDefault,
+ 'subtle': colors.borderSubtle,
+ 'hover': colors.borderHover,
+ 'selected': colors.borderSelected,
+ 'disabled': colors.borderDisabled,
+ 'pure': colors.borderPure,
+ 'primaryMain': colors.borderPrimaryMain,
+ 'primary': colors.borderPrimary,
+ 'secondary': colors.borderSecondary,
+ 'positive': colors.borderPositive,
+ 'warning': colors.borderWarning,
+ 'negative': colors.borderNegative,
+ 'info': colors.borderInfo,
};
- final Map alerts = {
+ final Map surfaceColors = {
+ 'defaultColor': colors.surfaceDefault,
+ 'defaultInverse': colors.surfaceDefaultInverse,
+ 'hover': colors.surfaceHover,
+ 'selected': colors.surfaceSelected,
+ 'selectedHover': colors.surfaceSelectedHover,
+ 'disabled': colors.surfaceDisabled,
+ 'cool': colors.surfaceCool,
+ 'warm': colors.surfaceWarm,
+ 'primary': colors.surfacePrimary,
+ 'primarySubtle': colors.surfacePrimarySubtle,
+ 'secondary': colors.surfaceSecondary,
+ 'secondarySubtle': colors.surfaceSecondarySubtle,
'positive': colors.surfacePositive,
- 'negative': colors.surfaceNegative,
+ 'positiveSubtle': colors.surfacePositiveSubtle,
'warning': colors.surfaceWarning,
+ 'warningSubtle': colors.surfaceWarningSubtle,
+ 'negative': colors.surfaceNegative,
+ 'negativeSubtle': colors.surfaceNegativeSubtle,
'info': colors.surfaceInfo,
+ 'infoSubtle': colors.surfaceInfoSubtle,
+ };
+ final Map avatarColors = {
+ 'blue': colors.surfaceAvatarBlue,
+ 'green': colors.surfaceAvatarGreen,
+ 'orange': colors.surfaceAvatarOrange,
+ 'pink': colors.surfaceAvatarPink,
+ 'purple': colors.surfaceAvatarPurple,
+ 'teal': colors.surfaceAvatarTeal,
+ 'yellow': colors.surfaceAvatarYellow,
+ };
+ final Map disabled = {
+ 'disabled': colors.stateDisabledDisabled,
+ };
+ final Map defaultColors = {
+ 'enabled': colors.stateDefaultEnabled,
+ 'hover': colors.stateDefaultHover,
+ 'selected': colors.stateDefaultSelected,
+ 'focus': colors.stateDefaultFocus,
+ };
+ final Map primary = {
+ 'enabled': colors.statePrimaryEnabled,
+ 'hover': colors.statePrimaryHover,
+ 'selected': colors.statePrimarySelected,
+ 'focus': colors.statePrimaryFocus,
+ };
+ final Map secondary = {
+ 'enabled': colors.stateSecondaryEnabled,
+ 'hover': colors.stateSecondaryHover,
+ 'selected': colors.stateSecondarySelected,
+ 'focus': colors.stateSecondaryFocus,
+ };
+ final Map positive = {
+ 'enabled': colors.statePositiveEnabled,
+ 'hover': colors.statePositiveHover,
+ 'selected': colors.statePositiveSelected,
+ 'focus': colors.statePositiveFocus,
+ };
+ final Map negative = {
+ 'enabled': colors.stateNegativeEnabled,
+ 'hover': colors.stateNegativeHover,
+ 'selected': colors.stateNegativeSelected,
+ 'focus': colors.stateNegativeFocus,
+ };
+ final Map info = {
+ 'enabled': colors.stateInfoEnabled,
+ 'hover': colors.stateInfoHover,
+ 'selected': colors.stateInfoSelected,
+ 'focus': colors.stateInfoFocus,
+ };
+ final Map inverse = {
+ 'enabled': colors.stateInverseEnabled,
+ 'hover': colors.stateInverseHover,
+ 'selected': colors.stateInverseSelected,
+ 'focus': colors.stateInverseFocus,
};
- return DefaultTextStyle(
- style: ZetaTextStyles.displayMedium.apply(
- color: Zeta.of(context).colors.cool,
- decoration: TextDecoration.none,
- ),
- child: Container(
- padding: EdgeInsets.symmetric(horizontal: Zeta.of(context).spacing.xl_4),
- child: SingleChildScrollView(
- key: PageStorageKey(0),
- child: Column(
- children: [
- SizedBox(height: Zeta.of(context).spacing.xl_4),
- MyRow(children: textIcon, title: 'Text and icon styles'),
- MyRow(children: border, title: 'Border styles'),
- MyRow(children: backdrop, title: 'Backdrop colors'),
- MyRow(children: alerts, title: 'Alert colors'),
- Row(children: [Text('Full color swatches')]).paddingVertical(Zeta.of(context).spacing.xl_4),
- ...swatches.entries.map(
- (value) {
- return Row(
- children: List.generate(10, (index) => 100 - (10 * index)).map(
- (e) {
- return Expanded(
- child: Container(
- height: constraints.maxWidth / 10,
- color: value.value[e],
- child: FittedBox(
- fit: BoxFit.scaleDown,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- DefaultTextStyle(
- style: ZetaTextStyles.bodyMedium.copyWith(
- color: calculateTextColor(value.value[e] ?? Colors.white),
- ),
- child: Column(
- children: [
- Text('${value.key.toLowerCase().replaceAll(' ', '')}-$e'),
- Text(
- value.value[e].toString().replaceAll('Color(0xff', '#').substring(0, 7),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- );
- },
- ).toList(),
- );
- },
- ),
- SizedBox(height: Zeta.of(context).spacing.xl_4),
- ],
+ return SingleChildScrollView(
+ padding: EdgeInsets.all(Zeta.of(context).spacing.medium),
+ child: Column(
+ children: [
+ Text('Semantic colors', style: ZetaTextStyles.displaySmall),
+ MyRow(children: mainColors, title: 'Main Colors'),
+ MyRow(children: borderColors, title: 'Main Colors'),
+ MyRow(children: surfaceColors, title: 'Surface Colors'),
+ MyRow(children: avatarColors, title: 'Surface / Avatar Colors'),
+ MyRow(children: disabled, title: 'State / disabled Colors'),
+ MyRow(children: defaultColors, title: 'State / default Colors'),
+ MyRow(children: primary, title: 'State / primary Colors'),
+ MyRow(children: secondary, title: 'State / secondary Colors'),
+ MyRow(children: positive, title: 'State / positive Colors'),
+ MyRow(children: negative, title: 'State / negative Colors'),
+ MyRow(children: info, title: 'State / info Colors'),
+ MyRow(children: inverse, title: 'State / inverse Colors'),
+ Row(children: [
+ Text('Full color swatches', style: ZetaTextStyles.displayMedium),
+ ]).paddingVertical(Zeta.of(context).spacing.xl_4),
+ Row(
+ children: primitivesPure.entries
+ .map(
+ (value) => SwatchBox(
+ color: value.value,
+ name: 'pure',
+ blockSize: blockSize,
+ value: value.key == 'mid'
+ ? 500
+ : value.key == 'white'
+ ? 0
+ : 1000,
+ ),
+ )
+ .toList(),
),
- ),
+ ...primitives.entries
+ .map(
+ (value) => Row(
+ children: List.generate(10, (index) => 100 - (10 * index))
+ .map(
+ (e) => SwatchBox(
+ color: value.value[e] ?? Colors.white,
+ name: value.key,
+ blockSize: blockSize,
+ value: e,
+ ),
+ )
+ .toList()),
+ )
+ .toList(),
+ ],
),
);
});
diff --git a/example/widgetbook/pages/theme/radius_widgetbook.dart b/example/widgetbook/pages/theme/radius_widgetbook.dart
index 69a3a72e..e680cfcc 100644
--- a/example/widgetbook/pages/theme/radius_widgetbook.dart
+++ b/example/widgetbook/pages/theme/radius_widgetbook.dart
@@ -27,21 +27,21 @@ Widget radiusUseCase(BuildContext context) {
height: 250,
decoration: BoxDecoration(
borderRadius: rad,
- color: Zeta.of(context).colors.blue.shade30,
- border: Border.all(color: colors.blue.shade80, width: 3),
+ color: Zeta.of(context).colors.surfacePrimarySubtle,
+ border: Border.all(color: colors.borderPrimary, width: 3),
),
child: Center(
child: Container(
decoration: BoxDecoration(
borderRadius: rad,
- color: Zeta.of(context).colors.surfacePrimary,
- border: Border.all(color: colors.blue.shade50, width: 3),
+ color: Zeta.of(context).colors.surfaceDefault,
+ border: Border.all(color: colors.borderPrimary, width: 3),
),
padding: EdgeInsets.all(Zeta.of(context).spacing.large),
child: Text(
rad.radiusString.split('.').last.capitalize(),
style: ZetaTextStyles.titleMedium.apply(
- color: Zeta.of(context).colors.textDefault,
+ color: Zeta.of(context).colors.mainDefault,
fontStyle: FontStyle.normal,
decoration: TextDecoration.none,
),
diff --git a/example/widgetbook/pages/theme/spacing_widgetbook.dart b/example/widgetbook/pages/theme/spacing_widgetbook.dart
index 51a441c1..462958d2 100644
--- a/example/widgetbook/pages/theme/spacing_widgetbook.dart
+++ b/example/widgetbook/pages/theme/spacing_widgetbook.dart
@@ -66,10 +66,10 @@ class _SpacingDemo extends StatelessWidget {
Widget build(BuildContext context) {
final colors = Zeta.of(context).colors;
return Container(
- color: colors.blue.shade30,
+ color: colors.surfacePrimarySubtle,
margin: EdgeInsets.all(Zeta.of(context).spacing.xl_2),
child: CustomPaint(
- painter: _TagPainter(color: colors.pink),
+ painter: _TagPainter(color: colors.primitives.pink),
child: LayoutBuilder(builder: (context, c2) {
return Container(
margin: EdgeInsets.all(size.value),
@@ -78,7 +78,7 @@ class _SpacingDemo extends StatelessWidget {
child: Text(
'Zeta.of(context).spacing.' + size.key,
style: ZetaTextStyles.titleMedium.apply(
- color: Zeta.of(context).colors.textDefault,
+ color: Zeta.of(context).colors.mainDefault,
fontStyle: FontStyle.normal,
decoration: TextDecoration.none,
),
diff --git a/example/widgetbook/pages/theme/typography_widgetbook.dart b/example/widgetbook/pages/theme/typography_widgetbook.dart
index 900e36b1..8bb108e3 100644
--- a/example/widgetbook/pages/theme/typography_widgetbook.dart
+++ b/example/widgetbook/pages/theme/typography_widgetbook.dart
@@ -23,7 +23,8 @@ const Map allTypes = {
'Label indicator': ZetaTextStyles.labelIndicator,
};
-Widget typographyUseCase(BuildContext context) => Padding(
+Widget typographyUseCase(BuildContext context) => Container(
+ color: Zeta.of(context).colors.surfaceDefault,
padding: EdgeInsets.all(Zeta.of(context).spacing.xl_2),
child: Text(
context.knobs.string(label: 'Text', initialValue: 'The quick brown fox jumps over the lazy dog.'),
@@ -34,7 +35,7 @@ Widget typographyUseCase(BuildContext context) => Padding(
options: allTypes.values.toList(),
)
.apply(
- color: Zeta.of(context).colors.textDefault,
+ color: Zeta.of(context).colors.mainDefault,
fontStyle: FontStyle.normal,
decoration: TextDecoration.none,
),
diff --git a/example/widgetbook/utils/zeta_addon.dart b/example/widgetbook/utils/zeta_addon.dart
index 9b28b3c4..01094b3f 100644
--- a/example/widgetbook/utils/zeta_addon.dart
+++ b/example/widgetbook/utils/zeta_addon.dart
@@ -17,7 +17,7 @@ class ZetaAddon extends WidgetbookAddon<_ZetaAddon> {
@override
Widget buildUseCase(BuildContext context, Widget child, _ZetaAddon data) {
- return ZetaProvider.base(
+ return ZetaProvider(
initialRounded: data.rounded,
initialThemeMode: data.themeMode,
initialContrast: data.contrast,
diff --git a/lib/generated/tokens/semantics.g.dart b/lib/generated/tokens/semantics.g.dart
index 475c4a5e..07b35439 100644
--- a/lib/generated/tokens/semantics.g.dart
+++ b/lib/generated/tokens/semantics.g.dart
@@ -1,11 +1,12 @@
+import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'primitives.g.dart';
// This file is automatically generated by the zeta repository
// DO NOT MODIFY
-/// Semantic tokens for Colors.
-abstract interface class ZetaSemanticColors {
+/// The semantic tokens for colors
+abstract interface class ZetaColors {
/// Primitives used to construct semantic colors
ZetaPrimitives get primitives;
@@ -42,6 +43,33 @@ abstract interface class ZetaSemanticColors {
/// Main Inverse color
Color get mainInverse;
+ /// Text Default color
+ Color get textDefault;
+
+ /// Icon Subtle color
+ Color get iconSubtle;
+
+ /// Icon Inverse color
+ Color get iconInverse;
+
+ /// Icon Disabled color
+ Color get iconDisabled;
+
+ /// Icon Flavor Primary color
+ Color get iconFlavorPrimary;
+
+ /// Icon Flavor Positive color
+ Color get iconFlavorPositive;
+
+ /// Icon Flavor Warning color
+ Color get iconFlavorWarning;
+
+ /// Icon Flavor Negative color
+ Color get iconFlavorNegative;
+
+ /// Icon Flavor Info color
+ Color get iconFlavorInfo;
+
/// Border Default color
Color get borderDefault;
@@ -250,63 +278,63 @@ abstract interface class ZetaSemanticColors {
Color get statePositiveFocus;
}
-/// Semantic tokens for Size.
-abstract interface class ZetaSpacingSemantics {
- /// Primitives used to construct semantic spaces
+/// The semantic tokens for spacing
+abstract interface class ZetaSpacing {
+ /// Primitives used to construct semantic spacing
ZetaPrimitives get primitives;
- /// None space
+ /// None spacing
double get none;
- /// Minimum space
+ /// Minimum spacing
double get minimum;
- /// Small space
+ /// Small spacing
double get small;
- /// Medium space
+ /// Medium spacing
double get medium;
- /// Large space
+ /// Large spacing
double get large;
- /// Xl space
+ /// Xl spacing
double get xl;
- /// Xl_2 space
+ /// Xl_2 spacing
double get xl_2;
- /// Xl_3 space
+ /// Xl_3 spacing
double get xl_3;
- /// Xl_4 space
+ /// Xl_4 spacing
double get xl_4;
- /// Xl_5 space
+ /// Xl_5 spacing
double get xl_5;
- /// Xl_6 space
+ /// Xl_6 spacing
double get xl_6;
- /// Xl_7 space
+ /// Xl_7 spacing
double get xl_7;
- /// Xl_8 space
+ /// Xl_8 spacing
double get xl_8;
- /// Xl_9 space
+ /// Xl_9 spacing
double get xl_9;
- /// Xl_10 space
+ /// Xl_10 spacing
double get xl_10;
- /// Xl_11 space
+ /// Xl_11 spacing
double get xl_11;
}
-/// Semantic tokens for Radii.
-abstract interface class ZetaRadiiSemantics {
- /// Primitives used to construct semantic radii
+/// The semantic tokens for radius
+abstract interface class ZetaRadius {
+ /// Primitives used to construct semantic radius
ZetaPrimitives get primitives;
/// None radius
@@ -328,64 +356,82 @@ abstract interface class ZetaRadiiSemantics {
BorderRadius get full;
}
-/// The semantic colors for AA
-class ZetaSemanticColorsAA implements ZetaSemanticColors {
- /// Constructor for ZetaSemanticColorsAA
- const ZetaSemanticColorsAA({required this.primitives});
+/// The semantic colors for AAA
+class ZetaColorsAAA extends Equatable implements ZetaColors {
+ /// Constructor for [ZetaColorsAAA]
+ const ZetaColorsAAA({required this.primitives});
@override
final ZetaPrimitives primitives;
@override
- Color get mainDefault => primitives.cool.shade90;
+ Color get mainDefault => primitives.cool.shade100;
@override
- Color get mainSubtle => primitives.cool.shade70;
+ Color get mainSubtle => primitives.cool.shade90;
@override
- Color get mainPrimary => primitives.primary.shade60;
+ Color get mainPrimary => primitives.primary.shade80;
@override
- Color get mainSecondary => primitives.secondary.shade60;
+ Color get mainSecondary => primitives.secondary.shade80;
@override
- Color get mainPositive => primitives.green.shade60;
+ Color get mainPositive => primitives.green.shade80;
@override
- Color get mainWarning => primitives.orange.shade60;
+ Color get mainWarning => primitives.orange.shade80;
@override
- Color get mainNegative => primitives.red.shade60;
+ Color get mainNegative => primitives.red.shade80;
@override
- Color get mainInfo => primitives.purple.shade60;
+ Color get mainInfo => primitives.purple.shade80;
@override
- Color get mainDisabled => primitives.cool.shade50;
+ Color get mainDisabled => primitives.cool.shade60;
@override
- Color get mainLight => primitives.cool.shade30;
+ Color get mainLight => primitives.pure.shade0;
@override
- Color get mainInverse => primitives.cool.shade20;
+ Color get mainInverse => primitives.pure.shade0;
@override
- Color get borderDefault => primitives.cool.shade40;
+ Color get textDefault => primitives.cool.shade100;
+ @override
+ Color get iconSubtle => primitives.cool.shade80;
+ @override
+ Color get iconInverse => primitives.pure.shade0;
+ @override
+ Color get iconDisabled => primitives.cool.shade60;
+ @override
+ Color get iconFlavorPrimary => primitives.primary.shade80;
+ @override
+ Color get iconFlavorPositive => primitives.green.shade80;
+ @override
+ Color get iconFlavorWarning => primitives.orange.shade80;
+ @override
+ Color get iconFlavorNegative => primitives.red.shade80;
+ @override
+ Color get iconFlavorInfo => primitives.purple.shade80;
+ @override
+ Color get borderDefault => primitives.cool.shade100;
@override
Color get borderSelected => primitives.cool.shade90;
@override
Color get borderHover => primitives.cool.shade90;
@override
- Color get borderSubtle => primitives.cool.shade30;
+ Color get borderSubtle => primitives.cool.shade80;
@override
Color get borderDisabled => primitives.cool.shade20;
@override
Color get borderPure => primitives.pure.shade0;
@override
- Color get borderPrimaryMain => primitives.primary.shade60;
+ Color get borderPrimaryMain => primitives.primary.shade80;
@override
- Color get borderPrimary => primitives.primary.shade50;
+ Color get borderPrimary => primitives.primary.shade70;
@override
- Color get borderSecondary => primitives.secondary.shade50;
+ Color get borderSecondary => primitives.secondary.shade70;
@override
- Color get borderPositive => primitives.green.shade50;
+ Color get borderPositive => primitives.green.shade70;
@override
- Color get borderWarning => primitives.orange.shade50;
+ Color get borderWarning => primitives.orange.shade70;
@override
- Color get borderNegative => primitives.red.shade50;
+ Color get borderNegative => primitives.red.shade70;
@override
- Color get borderInfo => primitives.purple.shade50;
+ Color get borderInfo => primitives.purple.shade70;
@override
Color get surfaceDefault => primitives.pure.shade0;
@override
- Color get surfaceDefaultInverse => primitives.warm.shade100;
+ Color get surfaceDefaultInverse => primitives.pure.shade1000;
@override
Color get surfaceHover => primitives.cool.shade20;
@override
@@ -399,11 +445,11 @@ class ZetaSemanticColorsAA implements ZetaSemanticColors {
@override
Color get surfaceWarm => primitives.warm.shade10;
@override
- Color get surfacePrimary => primitives.primary.shade60;
+ Color get surfacePrimary => primitives.primary.shade80;
@override
Color get surfacePrimarySubtle => primitives.primary.shade10;
@override
- Color get surfaceSecondary => primitives.secondary.shade60;
+ Color get surfaceSecondary => primitives.secondary.shade80;
@override
Color get surfaceAvatarBlue => primitives.blue.shade80;
@override
@@ -421,19 +467,19 @@ class ZetaSemanticColorsAA implements ZetaSemanticColors {
@override
Color get surfaceSecondarySubtle => primitives.secondary.shade10;
@override
- Color get surfacePositive => primitives.green.shade60;
+ Color get surfacePositive => primitives.green.shade80;
@override
Color get surfacePositiveSubtle => primitives.green.shade10;
@override
- Color get surfaceWarning => primitives.orange.shade60;
+ Color get surfaceWarning => primitives.orange.shade80;
@override
Color get surfaceWarningSubtle => primitives.orange.shade10;
@override
- Color get surfaceNegative => primitives.red.shade60;
+ Color get surfaceNegative => primitives.red.shade80;
@override
Color get surfaceNegativeSubtle => primitives.red.shade10;
@override
- Color get surfaceInfo => primitives.purple.shade60;
+ Color get surfaceInfo => primitives.purple.shade80;
@override
Color get surfaceInfoSubtle => primitives.purple.shade10;
@override
@@ -447,113 +493,223 @@ class ZetaSemanticColorsAA implements ZetaSemanticColors {
@override
Color get stateDefaultFocus => primitives.pure.shade0;
@override
- Color get statePrimaryEnabled => primitives.primary.shade60;
+ Color get statePrimaryEnabled => primitives.primary.shade80;
@override
- Color get statePrimaryHover => primitives.primary.shade50;
+ Color get statePrimaryHover => primitives.primary.shade70;
@override
- Color get statePrimarySelected => primitives.primary.shade70;
+ Color get statePrimarySelected => primitives.primary.shade90;
@override
- Color get statePrimaryFocus => primitives.primary.shade60;
+ Color get statePrimaryFocus => primitives.primary.shade80;
@override
- Color get stateSecondaryEnabled => primitives.secondary.shade40;
+ Color get stateSecondaryEnabled => primitives.secondary.shade80;
@override
- Color get stateSecondaryHover => primitives.secondary.shade30;
+ Color get stateSecondaryHover => primitives.secondary.shade70;
@override
- Color get stateSecondarySelected => primitives.secondary.shade50;
+ Color get stateSecondarySelected => primitives.secondary.shade90;
@override
- Color get stateSecondaryFocus => primitives.secondary.shade40;
+ Color get stateSecondaryFocus => primitives.secondary.shade80;
@override
- Color get stateNegativeEnabled => primitives.red.shade60;
+ Color get stateNegativeEnabled => primitives.red.shade80;
@override
- Color get stateNegativeHover => primitives.red.shade50;
+ Color get stateNegativeHover => primitives.red.shade70;
@override
- Color get stateNegativeSelected => primitives.red.shade70;
+ Color get stateNegativeSelected => primitives.red.shade90;
@override
- Color get stateNegativeFocus => primitives.red.shade60;
+ Color get stateNegativeFocus => primitives.red.shade80;
@override
- Color get stateInfoEnabled => primitives.purple.shade60;
+ Color get stateInfoEnabled => primitives.purple.shade80;
@override
- Color get stateInfoHover => primitives.purple.shade50;
+ Color get stateInfoHover => primitives.purple.shade70;
@override
- Color get stateInfoSelected => primitives.purple.shade70;
+ Color get stateInfoSelected => primitives.purple.shade90;
@override
- Color get stateInfoFocus => primitives.purple.shade60;
+ Color get stateInfoFocus => primitives.purple.shade80;
@override
- Color get stateInverseEnabled => primitives.cool.shade100;
+ Color get stateInverseEnabled => primitives.pure.shade1000;
@override
Color get stateInverseHover => primitives.cool.shade90;
@override
- Color get stateInverseSelected => primitives.cool.shade100;
+ Color get stateInverseSelected => primitives.pure.shade1000;
@override
- Color get stateInverseFocus => primitives.cool.shade100;
+ Color get stateInverseFocus => primitives.pure.shade1000;
@override
- Color get statePositiveEnabled => primitives.green.shade60;
+ Color get statePositiveEnabled => primitives.green.shade80;
@override
- Color get statePositiveHover => primitives.green.shade50;
+ Color get statePositiveHover => primitives.green.shade70;
@override
- Color get statePositiveSelected => primitives.green.shade70;
+ Color get statePositiveSelected => primitives.green.shade90;
@override
- Color get statePositiveFocus => primitives.green.shade60;
+ Color get statePositiveFocus => primitives.green.shade80;
+ @override
+ List