Skip to content

Commit

Permalink
chore: Integrate color tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Aug 28, 2024
1 parent d22898f commit a3d7482
Show file tree
Hide file tree
Showing 131 changed files with 2,585 additions and 2,752 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: ZebraDevs/flutter-code-quality@main
with:
token: ${{secrets.GITHUB_TOKEN}}
coverage-pass-score: '1'
coverage-pass-score: '90'


check-secret:
Expand Down
52 changes: 31 additions & 21 deletions example/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,30 +161,40 @@ class _HomeState extends State<Home> {
child: SingleChildScrollView(
child: Column(
children: [
ExpansionTile(
title: Text('Widgets'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _components
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExpansionTile(
title: Text('Theme'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _theme
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExpansionTile(
title: Text('Assets'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _assets
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExampleListTile(name: 'Components', children: _components),
ExampleListTile(name: 'Theme', children: _theme),
ExampleListTile(name: 'Assets', children: _assets),
],
),
),
);
}
}

class ExampleListTile extends StatelessWidget {
const ExampleListTile({
super.key,
required this.children,
required this.name,
});

final List<Component> children;
final String name;

@override
Widget build(BuildContext context) {
return ExpansionTile(
title: Text(name),
children: children
.map(
(item) => ListTile(
title: Text(item.name),
onTap: () => context.go('/${item.name}'),
hoverColor: Zeta.of(context).colors.surface.hover,
tileColor: Zeta.of(context).colors.surface.defaultColor,
),
)
.toList(),
);
}
}
31 changes: 2 additions & 29 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,46 +1,19 @@
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,
builder: (context, lightTheme, darkTheme, themeMode) {
return MaterialApp.router(
routerConfig: router,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/assets/icons_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _IconsExampleState extends State<IconsExample> {
height: 120,
child: InkWell(
borderRadius: Zeta.of(context).radius.rounded,
hoverColor: Zeta.of(context).colors.surfaceHover,
hoverColor: Zeta.of(context).colors.surface.hover,
onTap: () async {
await Clipboard.setData(ClipboardData(text: 'ZetaIcons.' + e.key));
ScaffoldMessenger.of(context).showMaterialBanner(
Expand Down
133 changes: 8 additions & 125 deletions example/lib/pages/components/avatar_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,6 @@ class AvatarExample extends StatelessWidget {
);
}).toList(),
),
const SizedBox(width: 15),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(size: size),
const SizedBox(height: 20),
],
))
.toList(),
),
const SizedBox(width: 15),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(
size: size,
borderColor: Zeta.of(context).colors.green,
),
const SizedBox(height: 20),
],
))
.toList(),
),
const SizedBox(width: 15),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
Expand All @@ -91,15 +65,14 @@ class AvatarExample extends StatelessWidget {
))
.toList(),
),
const SizedBox(width: 15),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(
size: size,
borderColor: Zeta.of(context).colors.green,
image: image,
borderColor: Zeta.of(context).colors.border.defaultColor,
),
const SizedBox(height: 20),
],
Expand Down Expand Up @@ -143,6 +116,7 @@ class AvatarExample extends StatelessWidget {
.map((size) => Column(
children: [
ZetaAvatar.initials(
backgroundColor: Zeta.of(context).colors.surface.avatar.pink,
size: size,
initials: 'AB',
),
Expand All @@ -159,7 +133,8 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
size: size,
initials: 'AB',
borderColor: Zeta.of(context).colors.green,
borderColor: Zeta.of(context).colors.border.defaultColor,
backgroundColor: Zeta.of(context).colors.surface.avatar.teal,
),
const SizedBox(height: 20),
],
Expand Down Expand Up @@ -198,35 +173,6 @@ class AvatarExample extends StatelessWidget {
}).toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(
size: size,
upperBadge: ZetaAvatarBadge.notification(value: 3),
),
const SizedBox(height: 20),
],
))
.toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(
size: size,
borderColor: Zeta.of(context).colors.green,
upperBadge: ZetaAvatarBadge.notification(value: 3),
),
const SizedBox(height: 20),
],
))
.toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
Expand All @@ -248,7 +194,6 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
borderColor: Zeta.of(context).colors.green,
upperBadge: ZetaAvatarBadge.notification(value: 3),
image: image,
),
Expand Down Expand Up @@ -311,7 +256,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
size: size,
initials: 'AB',
borderColor: Zeta.of(context).colors.green,
borderColor: Zeta.of(context).colors.main.positive,
upperBadge: ZetaAvatarBadge.notification(value: 3),
),
const SizedBox(height: 20),
Expand Down Expand Up @@ -351,35 +296,6 @@ class AvatarExample extends StatelessWidget {
}).toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(
size: size,
lowerBadge: ZetaAvatarBadge.icon(),
),
const SizedBox(height: 20),
],
))
.toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(
size: size,
borderColor: Zeta.of(context).colors.green,
lowerBadge: ZetaAvatarBadge.icon(),
),
const SizedBox(height: 20),
],
))
.toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
Expand All @@ -401,8 +317,6 @@ class AvatarExample extends StatelessWidget {
children: [
ZetaAvatar.image(
size: size,
borderColor: Zeta.of(context).colors.green,
lowerBadge: ZetaAvatarBadge.icon(),
image: image,
),
const SizedBox(height: 20),
Expand Down Expand Up @@ -464,7 +378,7 @@ class AvatarExample extends StatelessWidget {
ZetaAvatar.initials(
size: size,
initials: 'AB',
borderColor: Zeta.of(context).colors.green,
borderColor: Zeta.of(context).colors.main.positive,
lowerBadge: ZetaAvatarBadge.icon(),
),
const SizedBox(height: 20),
Expand Down Expand Up @@ -520,48 +434,17 @@ class AvatarExample extends StatelessWidget {
.toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.image(
size: size,
image: image,
borderColor: Zeta.of(context).colors.green,
upperBadge: ZetaAvatarBadge.notification(value: 3),
lowerBadge: ZetaAvatarBadge.icon(),
),
const SizedBox(height: 20),
],
))
.toList(),
),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.initials(
size: size,
initials: 'AB',
upperBadge: ZetaAvatarBadge.notification(value: 3),
lowerBadge: ZetaAvatarBadge.icon(),
),
const SizedBox(height: 20),
],
))
.toList(),
),
const SizedBox(width: 12),
Column(
children: ZetaAvatarSize.values
.map((size) => Column(
children: [
ZetaAvatar.initials(
size: size,
initials: 'AB',
borderColor: Zeta.of(context).colors.green,
upperBadge: ZetaAvatarBadge.notification(value: 3),
lowerBadge: ZetaAvatarBadge.icon(),
borderColor: Zeta.of(context).colors.border.defaultColor,
backgroundColor: Zeta.of(context).colors.surface.avatar.purple,
),
const SizedBox(height: 20),
],
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/components/chip_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _ChipExampleState extends State<ChipExample> {
builder: (context, _, __) {
return Container(
padding: EdgeInsets.all(Zeta.of(context).spacing.medium),
color: colors.surfaceSelectedHover,
color: colors.surface.selectedHover,
height: 100,
width: 200,
child: Center(child: Text('Last chip dragged here: $chipType')),
Expand Down
8 changes: 4 additions & 4 deletions example/lib/pages/components/dialog_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DialogExample extends StatelessWidget {
title: 'Dialog Title',
icon: ZetaIcon(
ZetaIcons.warning,
color: zeta.colors.surfaceWarning,
color: zeta.colors.surface.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
Expand All @@ -37,7 +37,7 @@ class DialogExample extends StatelessWidget {
title: 'Dialog Title',
icon: ZetaIcon(
ZetaIcons.warning,
color: zeta.colors.surfaceWarning,
color: zeta.colors.surface.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
Expand All @@ -53,7 +53,7 @@ class DialogExample extends StatelessWidget {
title: 'Dialog Title',
icon: ZetaIcon(
ZetaIcons.warning,
color: zeta.colors.surfaceWarning,
color: zeta.colors.surface.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
Expand All @@ -71,7 +71,7 @@ class DialogExample extends StatelessWidget {
title: 'Dialog Title',
icon: ZetaIcon(
ZetaIcons.warning,
color: zeta.colors.surfaceWarning,
color: zeta.colors.surface.warning,
),
message:
'Lorem ipsum dolor sit amet, conse ctetur adipiscing elit, sed do eiusm od tempor incididunt ut labore et do lore magna aliqua.',
Expand Down
Loading

0 comments on commit a3d7482

Please sign in to comment.