66 lines
1.8 KiB
Dart
66 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
import 'package:tunas/clients/storage/storage_client.dart';
|
|
import 'package:tunas/pages/home/home_page.dart';
|
|
import 'package:tunas/repositories/account/account_repository.dart';
|
|
import 'package:tunas/theme.dart';
|
|
|
|
class App extends StatefulWidget {
|
|
const App({super.key});
|
|
|
|
@override
|
|
State<App> createState() => _AppState();
|
|
}
|
|
|
|
class _AppState extends State<App> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const AppView();
|
|
}
|
|
}
|
|
|
|
class AppView extends StatefulWidget {
|
|
const AppView({super.key});
|
|
|
|
@override
|
|
State<AppView> createState() => _AppViewState();
|
|
}
|
|
|
|
class _AppViewState extends State<AppView> {
|
|
late final StorageClient _storageClient;
|
|
late final AccountRepository _accountRepository;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
_storageClient = StorageClient();
|
|
_accountRepository = AccountRepository(storageClient: _storageClient);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiRepositoryProvider(
|
|
providers: [RepositoryProvider.value(value: _accountRepository)],
|
|
child: MaterialApp(
|
|
title: 'Tunas',
|
|
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
|
|
darkTheme: ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
|
|
themeMode: ThemeMode.dark,
|
|
initialRoute: '/home',
|
|
routes: {
|
|
'/home':(context) => const HomePage(),
|
|
},
|
|
localizationsDelegates: const [
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate
|
|
],
|
|
supportedLocales: const [
|
|
Locale('fr')
|
|
],
|
|
)
|
|
);
|
|
}
|
|
} |