Compare commits
No commits in common. "main" and "v0.2.0" have entirely different histories.
@ -263,7 +263,6 @@ void main() async {
|
|||||||
'name', name,
|
'name', name,
|
||||||
'description', description,
|
'description', description,
|
||||||
'website', website,
|
'website', website,
|
||||||
'contactName', "contactName",
|
|
||||||
'contactEmail', "contactEmail",
|
'contactEmail', "contactEmail",
|
||||||
'contactPhone', "contactPhone",
|
'contactPhone', "contactPhone",
|
||||||
'locationName', "locationName",
|
'locationName', "locationName",
|
||||||
|
|||||||
@ -21,7 +21,6 @@ void main() async {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Main app page loader and theme manager
|
|
||||||
class MainApp extends StatefulWidget {
|
class MainApp extends StatefulWidget {
|
||||||
final int? initialPage;
|
final int? initialPage;
|
||||||
|
|
||||||
@ -32,24 +31,6 @@ class MainApp extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MainAppState extends State<MainApp> {
|
class _MainAppState extends State<MainApp> {
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
// prevent landscape mode (it looks bad)
|
|
||||||
SystemChrome.setPreferredOrientations([
|
|
||||||
DeviceOrientation.portraitUp,
|
|
||||||
DeviceOrientation.portraitDown,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return MaterialApp(
|
|
||||||
title: 'Job Link',
|
|
||||||
themeMode: themeMode,
|
|
||||||
darkTheme: _darkThemeData(),
|
|
||||||
theme: _lightThemeData(),
|
|
||||||
home: Home(themeCallback: _switchTheme, initialPage: widget.initialPage),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Switch the theme mode based on the currently selected theme and the system prefs
|
|
||||||
void _switchTheme() async {
|
void _switchTheme() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
if (MediaQuery.of(context).platformBrightness == Brightness.dark &&
|
if (MediaQuery.of(context).platformBrightness == Brightness.dark &&
|
||||||
@ -77,9 +58,17 @@ class _MainAppState extends State<MainApp> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Static theme for dark mode
|
@override
|
||||||
ThemeData _darkThemeData() {
|
Widget build(BuildContext context) {
|
||||||
return ThemeData(
|
SystemChrome.setPreferredOrientations([
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
DeviceOrientation.portraitDown,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return MaterialApp(
|
||||||
|
title: 'Job Link',
|
||||||
|
themeMode: themeMode,
|
||||||
|
darkTheme: ThemeData(
|
||||||
scaffoldBackgroundColor: const Color(0xFF121212),
|
scaffoldBackgroundColor: const Color(0xFF121212),
|
||||||
colorScheme: ColorScheme.dark(
|
colorScheme: ColorScheme.dark(
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
@ -110,12 +99,8 @@ class _MainAppState extends State<MainApp> {
|
|||||||
filled: true,
|
filled: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}
|
theme: ThemeData(
|
||||||
|
|
||||||
/// Static theme for light mode
|
|
||||||
ThemeData _lightThemeData() {
|
|
||||||
return ThemeData(
|
|
||||||
scaffoldBackgroundColor: Colors.grey.shade300,
|
scaffoldBackgroundColor: Colors.grey.shade300,
|
||||||
colorScheme: ColorScheme.light(
|
colorScheme: ColorScheme.light(
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
@ -147,6 +132,8 @@ class _MainAppState extends State<MainApp> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
|
),
|
||||||
|
home: Home(themeCallback: _switchTheme, initialPage: widget.initialPage),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user