Skip to content

Commit 41c3ede

Browse files
author
Lukas Gundermann
committed
refactor: Introduce ButtonThemes for component styling
This commit introduces a new `ButtonThemes` widget to centralize component theme overrides, following the pattern of `CardThemes` and `ContainerThemes`. ### Key Changes: * **`lib/screens/widgets/overrides/button_themes.dart`**: * A new `ButtonThemes` widget is created. It wraps its child in a `ComponentTheme` to provide custom styling for buttons, specifically targeting `SecondaryButtonTheme`. * **`lib/screens/widgets/layouts/override_theme_layout.dart`**: * The `OverrideThemeLayout` is updated to wrap its content with the new `ButtonThemes` widget, ensuring that custom button styles are applied consistently across the application.
1 parent 6c932de commit 41c3ede

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

lib/screens/widgets/layouts/override_theme_layout.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:shadcn_flutter/shadcn_flutter.dart';
22

3+
import '../overrides/button_themes.dart';
34
import '../overrides/card_themes.dart';
45
import '../overrides/container_themes.dart';
56

@@ -10,6 +11,8 @@ class OverrideThemeLayout extends StatelessWidget {
1011

1112
@override
1213
Widget build(BuildContext context) {
13-
return ContainerThemes(child: CardThemes(child: child));
14+
return ButtonThemes(
15+
child: ContainerThemes(child: CardThemes(child: child)),
16+
);
1417
}
1518
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import 'package:shadcn_flutter/shadcn_flutter.dart';
2+
3+
class ButtonThemes extends StatelessWidget {
4+
const ButtonThemes({super.key, required this.child});
5+
6+
final Widget child;
7+
8+
@override
9+
Widget build(BuildContext context) {
10+
return ComponentTheme(
11+
data: SecondaryButtonTheme(
12+
decoration: (context, states, defaultDecoration) {
13+
return defaultDecoration;
14+
// return defaultDecoration.copyWithIfBoxDecoration(
15+
// color: Colors.red,
16+
// border: Border.all(color: Colors.green, width: 10),
17+
// );
18+
},
19+
),
20+
child: child,
21+
);
22+
}
23+
}

0 commit comments

Comments
 (0)