68 lines
1.8 KiB
Dart
68 lines
1.8 KiB
Dart
import 'package:dietary_guard/controllers/food_data.dart';
|
|
import 'package:dietary_guard/screens/query.dart';
|
|
import 'package:dietary_guard/screens/settings.dart';
|
|
import 'package:dietary_guard/shells/nav_shell.dart';
|
|
import 'package:dietary_guard/translations.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
final router = GoRouter(routes: [
|
|
ShellRoute(
|
|
builder: (context, state, child) => NavShell(child: child),
|
|
routes: [
|
|
GoRoute(
|
|
path: "/",
|
|
name: "query",
|
|
builder: (context, state) => const QueryScreen(),
|
|
),
|
|
GoRoute(
|
|
path: "/settings",
|
|
name: "settings",
|
|
builder: (context, state) => const SettingsScreen(),
|
|
),
|
|
],
|
|
),
|
|
]);
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetMaterialApp.router(
|
|
title: 'DietaryGuard',
|
|
routerDelegate: router.routerDelegate,
|
|
routeInformationParser: router.routeInformationParser,
|
|
routeInformationProvider: router.routeInformationProvider,
|
|
backButtonDispatcher: router.backButtonDispatcher,
|
|
locale: Get.deviceLocale,
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: Colors.green,
|
|
brightness: Brightness.light,
|
|
),
|
|
useMaterial3: true,
|
|
),
|
|
darkTheme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: Colors.green,
|
|
brightness: Brightness.dark,
|
|
),
|
|
useMaterial3: true,
|
|
),
|
|
themeMode: ThemeMode.system,
|
|
translations: AppTranslations(),
|
|
onInit: () => _initializeProviders(context),
|
|
);
|
|
}
|
|
|
|
void _initializeProviders(BuildContext context) async {
|
|
Get.put(FoodDataController());
|
|
}
|
|
}
|