Compare commits

...

2 Commits
v0.2.0 ... main

Author SHA1 Message Date
b203a1aa6c main.dart formatting / commenting 2024-06-28 20:59:05 -05:00
72e27525e7 API change for contact name on home screen 2024-06-28 18:00:08 -05:00
2 changed files with 85 additions and 71 deletions

View File

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

View File

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