Compare commits

..

No commits in common. "main" and "v0.2.0" have entirely different histories.
main ... v0.2.0

2 changed files with 71 additions and 85 deletions

View File

@ -263,7 +263,6 @@ void main() async {
'name', name,
'description', description,
'website', website,
'contactName', "contactName",
'contactEmail', "contactEmail",
'contactPhone', "contactPhone",
'locationName', "locationName",

View File

@ -21,7 +21,6 @@ void main() async {
));
}
/// Main app page loader and theme manager
class MainApp extends StatefulWidget {
final int? initialPage;
@ -32,24 +31,6 @@ class MainApp extends StatefulWidget {
}
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 {
final prefs = await SharedPreferences.getInstance();
if (MediaQuery.of(context).platformBrightness == Brightness.dark &&
@ -77,9 +58,17 @@ class _MainAppState extends State<MainApp> {
}
}
/// Static theme for dark mode
ThemeData _darkThemeData() {
return ThemeData(
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
return MaterialApp(
title: 'Job Link',
themeMode: themeMode,
darkTheme: ThemeData(
scaffoldBackgroundColor: const Color(0xFF121212),
colorScheme: ColorScheme.dark(
brightness: Brightness.dark,
@ -110,12 +99,8 @@ class _MainAppState extends State<MainApp> {
filled: true,
),
),
);
}
/// Static theme for light mode
ThemeData _lightThemeData() {
return ThemeData(
),
theme: ThemeData(
scaffoldBackgroundColor: Colors.grey.shade300,
colorScheme: ColorScheme.light(
brightness: Brightness.light,
@ -147,6 +132,8 @@ class _MainAppState extends State<MainApp> {
),
),
useMaterial3: true,
),
home: Home(themeCallback: _switchTheme, initialPage: widget.initialPage),
);
}
}