-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.dart
More file actions
183 lines (170 loc) · 6.61 KB
/
main.dart
File metadata and controls
183 lines (170 loc) · 6.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'package:simplimap/state/kmap_provider.dart';
import 'package:simplimap/screens/solver_screen.dart';
void main() {
runApp(
ChangeNotifierProvider(
create: (context) => KMapProvider(),
child: const SimpliMapApp(),
),
);
}
class SimpliMapApp extends StatefulWidget {
const SimpliMapApp({super.key});
@override
State<SimpliMapApp> createState() => _SimpliMapAppState();
}
class _SimpliMapAppState extends State<SimpliMapApp> {
ThemeMode _themeMode = ThemeMode.system;
void _setThemeMode(ThemeMode mode) {
setState(() {
_themeMode = mode;
});
}
@override
Widget build(BuildContext context) {
final baseLightTheme = ThemeData(
useMaterial3: true,
brightness: Brightness.light,
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF0F8B8D),
brightness: Brightness.light,
),
);
final baseDarkTheme = ThemeData(
useMaterial3: true,
brightness: Brightness.dark,
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF53CFB0),
brightness: Brightness.dark,
),
);
final lightTextTheme = GoogleFonts.spaceGroteskTextTheme(baseLightTheme.textTheme).copyWith(
titleLarge: GoogleFonts.spaceGrotesk(fontSize: 24, fontWeight: FontWeight.w700),
titleMedium: GoogleFonts.spaceGrotesk(fontSize: 18, fontWeight: FontWeight.w700),
bodyMedium: GoogleFonts.spaceGrotesk(fontSize: 15, fontWeight: FontWeight.w500),
bodySmall: GoogleFonts.ibmPlexMono(fontSize: 12, fontWeight: FontWeight.w500),
);
final darkTextTheme = GoogleFonts.spaceGroteskTextTheme(baseDarkTheme.textTheme).copyWith(
titleLarge: GoogleFonts.spaceGrotesk(fontSize: 24, fontWeight: FontWeight.w700),
titleMedium: GoogleFonts.spaceGrotesk(fontSize: 18, fontWeight: FontWeight.w700),
bodyMedium: GoogleFonts.spaceGrotesk(fontSize: 15, fontWeight: FontWeight.w500),
bodySmall: GoogleFonts.ibmPlexMono(fontSize: 12, fontWeight: FontWeight.w500),
);
final lightTheme = baseLightTheme.copyWith(
textTheme: lightTextTheme,
scaffoldBackgroundColor: const Color(0xFFF5FAF8),
appBarTheme: AppBarTheme(
backgroundColor: Colors.transparent,
foregroundColor: const Color(0xFF113230),
elevation: 0,
centerTitle: false,
titleTextStyle: lightTextTheme.titleLarge?.copyWith(color: const Color(0xFF113230)),
),
cardTheme: CardThemeData(
color: Colors.white.withValues(alpha: 0.86),
elevation: 0,
shadowColor: Colors.black.withValues(alpha: 0.08),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
margin: EdgeInsets.zero,
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: Colors.white.withValues(alpha: 0.9),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Colors.teal.shade100),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: BorderSide(color: Colors.teal.shade100),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: const BorderSide(color: Color(0xFF0F8B8D), width: 1.4),
),
),
filledButtonTheme: FilledButtonThemeData(
style: FilledButton.styleFrom(
backgroundColor: const Color(0xFF0F8B8D),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFF113230),
side: BorderSide(color: Colors.teal.shade200),
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
),
),
);
final darkTheme = baseDarkTheme.copyWith(
textTheme: darkTextTheme,
scaffoldBackgroundColor: const Color(0xFF071A1A),
appBarTheme: AppBarTheme(
backgroundColor: Colors.transparent,
foregroundColor: const Color(0xFFE9FCF5),
elevation: 0,
centerTitle: false,
titleTextStyle: darkTextTheme.titleLarge?.copyWith(color: const Color(0xFFE9FCF5)),
),
cardTheme: CardThemeData(
color: const Color(0xFF0F2A2A).withValues(alpha: 0.88),
elevation: 0,
shadowColor: Colors.black.withValues(alpha: 0.24),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
margin: EdgeInsets.zero,
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: const Color(0xFF133535),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: const BorderSide(color: Color(0xFF2D6565)),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: const BorderSide(color: Color(0xFF2D6565)),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(16),
borderSide: const BorderSide(color: Color(0xFF53CFB0), width: 1.4),
),
),
filledButtonTheme: FilledButtonThemeData(
style: FilledButton.styleFrom(
backgroundColor: const Color(0xFF3BB89A),
foregroundColor: const Color(0xFF03201E),
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFFD8FFF4),
side: const BorderSide(color: Color(0xFF2F6F67)),
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
),
),
);
return MaterialApp(
title: 'SimpliMap',
debugShowCheckedModeBanner: false,
themeAnimationDuration: Duration.zero,
themeAnimationCurve: Curves.linear,
theme: lightTheme,
darkTheme: darkTheme,
themeMode: _themeMode,
home: SolverScreen(
themeMode: _themeMode,
onThemeModeChanged: _setThemeMode,
),
);
}
}