71 lines
2.1 KiB
Dart
71 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:frontend_eccp_mobile/app/core/navigation/app_router.dart';
|
|
import 'package:frontend_eccp_mobile/l10n/gen/app_localizations.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.dart';
|
|
|
|
class App extends StatelessWidget {
|
|
const App({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ShadApp.custom(
|
|
themeMode: ThemeMode.light,
|
|
darkTheme: ShadThemeData(
|
|
brightness: Brightness.dark,
|
|
colorScheme: const ShadSlateColorScheme.dark(),
|
|
),
|
|
appBuilder: (contextShad) {
|
|
return ScreenUtilInit(
|
|
designSize: const Size(412, 915),
|
|
minTextAdapt: true,
|
|
splitScreenMode: true,
|
|
|
|
enableScaleWH: () {
|
|
final width = MediaQueryData.fromWindow(
|
|
WidgetsBinding.instance.window,
|
|
).size.width;
|
|
|
|
return width < 600;
|
|
},
|
|
|
|
enableScaleText: () {
|
|
final width = MediaQueryData.fromWindow(
|
|
WidgetsBinding.instance.window,
|
|
).size.width;
|
|
|
|
return width < 600;
|
|
},
|
|
|
|
builder: (context, child) {
|
|
return MaterialApp.router(
|
|
routerDelegate: AppRouter.router.routerDelegate,
|
|
routeInformationParser: AppRouter.router.routeInformationParser,
|
|
routeInformationProvider:
|
|
AppRouter.router.routeInformationProvider,
|
|
|
|
builder: (context, child) {
|
|
return ShadToaster(
|
|
child: child ?? const SizedBox(),
|
|
);
|
|
},
|
|
|
|
theme: ThemeData(
|
|
appBarTheme: AppBarTheme(
|
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
),
|
|
useMaterial3: true,
|
|
),
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|