Skip to content

Commit af826ec

Browse files
author
Lukas Gundermann
committed
refactor: Enhance dark mode theme and component styling
This commit improves the visual consistency and aesthetics of the application, with a particular focus on enhancing the dark mode experience. ### Key Changes: * **Dark Mode Theme:** * The `card` color in the dark theme (`dark` ColorScheme) is now explicitly set to `Colors.gray[800]` for better contrast and a more defined look. * **`HeroSection` (`home_screen`):** * The border color for the feature cards in dark mode is updated to `Colors.gray[600]`, improving their visibility and alignment with the enhanced dark theme. * **`NotFoundCard` and `NotFoundScreen`:** * The `NotFoundCard` is refactored from a custom `OutlinedContainer` to use the standard `Card` widget. * It now accepts `color` and `darkColor` properties to customize its border, making it more flexible. * The shadow effect is now theme-aware, displaying a white-based shadow in dark mode for better visibility. * The `NotFoundScreen` is updated to pass the new color properties to the `NotFoundCard`.
1 parent 3625b8e commit af826ec

4 files changed

Lines changed: 48 additions & 26 deletions

File tree

lib/screens/error_pages/not_found_screen.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ class NotFoundScreen extends StatelessWidget {
2121
: [Colors.blue[50], Colors.gray[100]],
2222
),
2323
),
24-
children: [NotFoundCard(withShadow: true)],
24+
children: [
25+
NotFoundCard(
26+
withShadow: true,
27+
color: Colors.gray[300],
28+
darkColor: Colors.gray[600],
29+
),
30+
],
2531
);
2632
}
2733
}

lib/screens/home/widgets/hero_section.dart

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class _HeroSectionState extends State<HeroSection> {
3232
icon: LucideIcons.palette,
3333
title: "Polizei-Blau Design System",
3434
text:
35-
"Professionelles Farbschema mit Berlin Polizei Blau als Primärfarbe",
35+
"Professionelles Farbschema mit Berlin Polizei Blau als Primärfarbe",
3636
),
3737
_HeroCards(
3838
icon: LucideIcons.moon,
@@ -84,22 +84,23 @@ class _HeroSectionState extends State<HeroSection> {
8484
return Container(
8585
decoration: isDarkMode
8686
? BoxDecoration(
87-
gradient: LinearGradient(
88-
begin: Alignment.topLeft,
89-
end: Alignment.bottomRight,
90-
colors: [Colors.gray[950], Colors.blue[950], Colors.gray[900]],
91-
),
92-
)
87+
gradient: LinearGradient(
88+
begin: Alignment.topLeft,
89+
end: Alignment.bottomRight,
90+
colors: [Colors.gray[950], Colors.blue[950], Colors.gray[900]],
91+
),
92+
)
9393
: BoxDecoration(color: Colors.gray[50]),
9494
width: double.infinity,
9595
child: Column(
9696
children: [
9797
Gap(64),
9898
PrimaryBadge(child: Text('Flutter Template v.$_version')),
9999
Gap(5),
100-
Text(
101-
'Polizei Berlin',
102-
).x5Large.h1.setColors(lightColor: Colors.gray[800], darkColor: Colors.white),
100+
Text('Polizei Berlin').x5Large.h1.setColors(
101+
lightColor: Colors.gray[800],
102+
darkColor: Colors.white,
103+
),
103104
Text('Design Template').x5Large.h1.setColors(
104105
lightColor: Colors.blue[800],
105106
darkColor: Colors.blue[400],
@@ -145,9 +146,9 @@ class _HeroSectionState extends State<HeroSection> {
145146
final availableWidth = constraints.maxWidth;
146147

147148
final columns =
148-
((availableWidth + spacing) / (minCardWidth + spacing))
149-
.floor()
150-
.clamp(1, maxColumns);
149+
((availableWidth + spacing) / (minCardWidth + spacing))
150+
.floor()
151+
.clamp(1, maxColumns);
151152

152153
return GridView.builder(
153154
shrinkWrap: true,
@@ -196,7 +197,9 @@ class _HeroSectionState extends State<HeroSection> {
196197
),
197198
),
198199
).withHoverEffect(
199-
borderColor: Colors.gray[300],
200+
borderColor: isDarkMode
201+
? Colors.gray[600]
202+
: Colors.gray[300],
200203
hoverBorderColor: isDarkMode
201204
? Colors.blue[700]
202205
: Colors.blue[900],
@@ -230,4 +233,4 @@ class _HeroCards {
230233

231234
/// Short feature description.
232235
final String text;
233-
}
236+
}

lib/screens/widgets/error_pages/not_found_card.dart

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,43 @@ class NotFoundCard extends StatelessWidget {
1111
const NotFoundCard({
1212
super.key,
1313
this.possibleReasons,
14+
this.color,
15+
this.darkColor,
1416
this.withShadow = false,
1517
});
1618

1719
final List<String>? possibleReasons;
1820

1921
final bool withShadow;
2022

23+
final Color? color;
24+
25+
final Color? darkColor;
26+
2127
@override
2228
Widget build(BuildContext context) {
2329
final isDarkMode = context.watch<ThemeCubit>().state.isDarkMode;
2430
return ConstrainedBox(
2531
constraints: BoxConstraints(maxWidth: 720),
26-
child: OutlinedContainer(
32+
child: Card(
2733
boxShadow: withShadow
28-
? const [
29-
BoxShadow(
30-
color: Color.fromRGBO(0, 0, 0, 0.25),
31-
offset: Offset(0, 0),
32-
blurRadius: 50,
33-
spreadRadius: -12,
34-
),
34+
? [
35+
isDarkMode
36+
? BoxShadow(
37+
color: Color.fromRGBO(255, 255, 255, 0.25),
38+
offset: Offset(0, 0),
39+
blurRadius: 50,
40+
spreadRadius: -12,
41+
)
42+
: BoxShadow(
43+
color: Color.fromRGBO(0, 0, 0, 0.25),
44+
offset: Offset(0, 0),
45+
blurRadius: 50,
46+
spreadRadius: -12,
47+
),
3548
]
3649
: null,
37-
width: double.infinity,
38-
borderColor: isDarkMode ? null : Colors.gray[200],
50+
borderColor: isDarkMode ? darkColor : color,
3951
borderWidth: 2,
4052
child: Column(
4153
children: [

lib/theme/cubit/theme_state.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ final ThemeData lightTheme = ThemeData(
4242
final ColorScheme dark = ColorSchemes.darkBlue.copyWith(
4343
primary: () => Colors.blue[700],
4444
primaryForeground: () => Colors.white,
45+
card: () => Colors.gray[800],
4546
// card: () => const HSLColor.fromAHSL(1, 222.2, 0.84, 0.1).toColor(),
4647
// background: const Color(0xFF1F2327),
4748
// card: const Color(0xFF282E32),

0 commit comments

Comments
 (0)