add adaptive_scaffold
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:immich_mobile/i18n/strings.g.dart';
|
||||
import 'package:immich_mobile/presentation/modules/theme/models/app_theme.model.dart';
|
||||
import 'package:immich_mobile/presentation/modules/theme/states/app_theme.state.dart';
|
||||
import 'package:immich_mobile/presentation/modules/theme/widgets/app_theme_builder.widget.dart';
|
||||
import 'package:immich_mobile/presentation/router/router.dart';
|
||||
import 'package:watch_it/watch_it.dart';
|
||||
import 'package:immich_mobile/service_locator.dart';
|
||||
import 'package:immich_mobile/utils/constants/globals.dart';
|
||||
|
||||
class ImmichApp extends StatefulWidget {
|
||||
final ThemeData lightTheme;
|
||||
final ThemeData darkTheme;
|
||||
|
||||
const ImmichApp({
|
||||
required this.lightTheme,
|
||||
required this.darkTheme,
|
||||
super.key,
|
||||
});
|
||||
const ImmichApp({super.key});
|
||||
|
||||
@override
|
||||
State createState() => _ImmichAppState();
|
||||
@@ -21,15 +19,23 @@ class ImmichApp extends StatefulWidget {
|
||||
class _ImmichAppState extends State<ImmichApp> with WidgetsBindingObserver {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final router = di<AppRouter>();
|
||||
|
||||
return MaterialApp.router(
|
||||
locale: TranslationProvider.of(context).flutterLocale,
|
||||
supportedLocales: AppLocaleUtils.supportedLocales,
|
||||
localizationsDelegates: GlobalMaterialLocalizations.delegates,
|
||||
theme: widget.lightTheme,
|
||||
darkTheme: widget.darkTheme,
|
||||
routerConfig: router.config(),
|
||||
return TranslationProvider(
|
||||
child: BlocBuilder<AppThemeCubit, AppTheme>(
|
||||
bloc: di(),
|
||||
builder: (_, appTheme) => AppThemeBuilder(
|
||||
theme: appTheme,
|
||||
builder: (ctx, lightTheme, darkTheme) => MaterialApp.router(
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: TranslationProvider.of(ctx).flutterLocale,
|
||||
supportedLocales: AppLocaleUtils.supportedLocales,
|
||||
localizationsDelegates: GlobalMaterialLocalizations.delegates,
|
||||
theme: lightTheme,
|
||||
darkTheme: darkTheme,
|
||||
routerConfig: di<AppRouter>().config(),
|
||||
scaffoldMessengerKey: kScafMessengerKey,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user