Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Rewrite Fortaleza theme using the new code gen for tokens #528

Merged
merged 33 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9028b78
generate color token
tilucasoli Nov 12, 2024
54e8381
checkpoint1
tilucasoli Nov 13, 2024
774ddfe
annotation improvements
tilucasoli Nov 18, 2024
fc6555c
improve the SwatchColorToken
tilucasoli Nov 18, 2024
0dc47d4
Update mixable_tokens_generator.dart
tilucasoli Nov 18, 2024
3b02008
Update mixable_tokens_generator.dart
tilucasoli Nov 18, 2024
9548c51
improve tests
tilucasoli Nov 19, 2024
a2652f4
refactor the fortaleza theme
tilucasoli Nov 18, 2024
1d9a631
remove unused classes
tilucasoli Nov 18, 2024
2313745
create a test for theme
tilucasoli Nov 19, 2024
a97a2aa
fixing the theme
tilucasoli Nov 19, 2024
b9a5f9f
generate color token
tilucasoli Nov 12, 2024
2557bf8
checkpoint1
tilucasoli Nov 13, 2024
f61a08e
annotation improvements
tilucasoli Nov 18, 2024
44f157b
improve the SwatchColorToken
tilucasoli Nov 18, 2024
c448351
improve tests
tilucasoli Nov 19, 2024
63e5320
refactor the fortaleza theme
tilucasoli Nov 18, 2024
74ee14d
remove unused classes
tilucasoli Nov 18, 2024
b7be240
create a test for theme
tilucasoli Nov 19, 2024
8f42ed1
fixing the theme
tilucasoli Nov 19, 2024
e8dfd2e
Update field_info.dart
tilucasoli Nov 26, 2024
207f35f
Merge branch 'refactor/remix-theme' of https://github.com/conceptadev…
tilucasoli Nov 26, 2024
ce95ae6
remove token
tilucasoli Nov 26, 2024
58f9f7f
improve remixTheme
tilucasoli Nov 26, 2024
cfd6f99
Update card_use_case.dart
tilucasoli Nov 26, 2024
a488c35
Update toast_layer.dart
tilucasoli Nov 26, 2024
49fa5ec
textfield
tilucasoli Nov 26, 2024
8cd968f
Merge branch 'main' into refactor/remix-theme
tilucasoli Nov 26, 2024
16f9bf3
Update component.dart
tilucasoli Nov 26, 2024
a458122
Delete remix_theme.dart
tilucasoli Nov 26, 2024
98a5f27
some adjustments
tilucasoli Dec 5, 2024
a6a8b0f
Update main.dart
tilucasoli Dec 5, 2024
9898b6a
Merge branch 'main' into refactor/remix-theme
tilucasoli Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/mix/lib/src/theme/mix/mix_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../tokens/space_token.dart';
import '../tokens/text_style_token.dart';

class MixTheme extends InheritedWidget {
const MixTheme({required super.child, required this.data, super.key});
const MixTheme({required this.data, super.key, required super.child});

static MixThemeData of(BuildContext context) {
final themeData =
Expand Down
13 changes: 0 additions & 13 deletions packages/mix_generator/lib/src/helpers/builder_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,6 @@
}
}

class TokenAnnotationContext extends AnnotationContext {
final Object? type;

TokenAnnotationContext({
required super.element,
required this.type,
});

String get name => element.name;

String get generatedName => element.generatedName;
}

extension ClassElementX on ClassElement {
bool get isConst => unnamedConstructor?.isConst ?? false;

Expand Down Expand Up @@ -264,7 +251,7 @@
return thisElement.name;
}

return getDisplayString(withNullability: false);

Check notice on line 254 in packages/mix_generator/lib/src/helpers/builder_utils.dart

View workflow job for this annotation

GitHub Actions / Test

'withNullability' is deprecated and shouldn't be used. Only non-nullable by default mode is supported.

Try replacing the use of the deprecated member with the replacement. See https://dart.dev/diagnostics/deprecated_member_use to learn more about this problem.
}

ClassElement? get classElement {
Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/avatar_use_case.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
6 changes: 4 additions & 2 deletions packages/remix/demo/lib/components/badge_use_case.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand All @@ -15,8 +17,8 @@ Widget buildAvatarUseCase(BuildContext context) {
label: 'Label',
initialValue: 'New',
),
variants: const [
// context.knobs.variant(FortalezaBadgeStyle.variants),
variants: [
context.knobs.variant(FortalezaBadgeStyle.variants),
],
),
),
Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/button_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:demo/addons/icon_data_knob.dart';
import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
2 changes: 1 addition & 1 deletion packages/remix/demo/lib/components/callout_use_case.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/material.dart' as m;
import 'package:flutter/widgets.dart';

import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
5 changes: 3 additions & 2 deletions packages/remix/demo/lib/components/card_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/widgets.dart';
import 'package:mix/mix.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down Expand Up @@ -32,12 +33,12 @@ Widget buildCard(BuildContext context) {
children: [
StyledText(
'Leo Farias',
style: Style($text.style.ref($rx.text.text3)),
style: Style($text.style.$text3()),
),
StyledText(
'Flutter Engineer',
style: Style(
$text.style.ref($rx.text.text2),
$text.style.$text2(),
$text.style.color.$neutral(10),
),
),
Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/checkbox_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:demo/helpers/knob_builder.dart';
import 'package:demo/helpers/use_case_state.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/chip_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:demo/helpers/knob_builder.dart';
import 'package:demo/helpers/use_case_state.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart' as m;
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/progress_use_case.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/radio_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:demo/helpers/knob_builder.dart';
import 'package:demo/helpers/string.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/select_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/material.dart' as m;
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/spinner_use_case.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:demo/helpers/knob_builder.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/switch_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:demo/helpers/knob_builder.dart';
import 'package:demo/helpers/use_case_state.dart';
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
1 change: 1 addition & 0 deletions packages/remix/demo/lib/components/textfield_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:demo/addons/icon_data_knob.dart';
import 'package:flutter/material.dart' as m;
import 'package:flutter/widgets.dart';
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down
15 changes: 3 additions & 12 deletions packages/remix/demo/lib/helpers/theme_addon.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'package:remix/remix.dart';
import 'package:widgetbook/widgetbook.dart';

typedef ThemeMultiBrightness = ({
RemixComponentTheme light,
RemixComponentTheme dark
});
typedef ThemeMultiBrightness = ({RemixThemeData light, RemixThemeData dark});

class RemixComponentThemeAddon extends ThemeAddon<ThemeMultiBrightness> {
@override
Expand All @@ -17,14 +14,8 @@ class RemixComponentThemeAddon extends ThemeAddon<ThemeMultiBrightness> {
themeBuilder: (context, themes, child) {
return RemixApp(
debugShowCheckedModeBanner: false,
darkTheme: RemixThemeData(
tokens: dark,
components: themes.dark,
),
theme: RemixThemeData(
components: themes.light,
tokens: light,
),
darkTheme: themes.dark,
theme: themes.light,
home: child,
);
},
Expand Down
9 changes: 5 additions & 4 deletions packages/remix/demo/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:demo/helpers/theme_addon.dart';
import 'package:flutter/material.dart' hide Scaffold, ThemeMode;
import 'package:remix/remix.dart';
import 'package:remix/themes/fortaleza.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;

Expand Down Expand Up @@ -47,15 +48,15 @@ class HotReload extends StatelessWidget {
WidgetbookTheme(
name: 'Fortaleza',
data: (
dark: RemixComponentTheme.fortalezaDark(),
light: RemixComponentTheme.fortalezaLight()
light: FortalezaThemeData.light(),
dark: FortalezaThemeData.dark(),
),
),
WidgetbookTheme(
name: 'Base',
data: (
dark: RemixComponentTheme.baseDark(),
light: RemixComponentTheme.baseLight(),
light: RemixThemeData.baseLight(),
dark: RemixThemeData.baseDark(),
),
),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/lucasoliveira/fvm/versions/stable
FLUTTER_APPLICATION_PATH=/Users/lucasoliveira/Developer/Mix/mix/packages/remix/demo
FLUTTER_APPLICATION_PATH=/Users/lucasoliveira/Developer/Projects/hairday/packages/mix/packages/remix/demo
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_TARGET=/Users/lucasoliveira/Developer/Mix/mix/packages/remix/demo/lib/main.dart
FLUTTER_TARGET=/Users/lucasoliveira/Developer/Projects/hairday/packages/mix/packages/remix/demo/lib/main.dart
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=/Users/lucasoliveira/Developer/Mix/mix/packages/remix/demo/.dart_tool/package_config.json
PACKAGE_CONFIG=/Users/lucasoliveira/Developer/Projects/hairday/packages/mix/packages/remix/demo/.dart_tool/package_config.json
Loading
Loading