mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 12:27:55 +00:00
Refactor device-related views to improve code structure and readability. Add error handling for authentication token in the splash view. Remove unnecessary NavCubit from the app initialization.
45 lines
1.5 KiB
Dart
45 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/theme_manager.dart';
|
|
import 'navigation/router.dart' as router;
|
|
import 'navigation/routing_constants.dart';
|
|
|
|
class MyApp extends StatelessWidget {
|
|
final Locale locale;
|
|
|
|
const MyApp(this.locale, {super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Constants.appBarHeight =
|
|
MediaQuery.sizeOf(context).height * Constants.appBarHeightPercentage;
|
|
Constants.bottomNavBarHeight = MediaQuery.sizeOf(context).height *
|
|
Constants.bottomNavBarHeightPercentage;
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider(
|
|
create: (context) => AuthCubit(),
|
|
),
|
|
],
|
|
child: MaterialApp(
|
|
debugShowCheckedModeBanner: false,
|
|
color: ColorsManager.primaryColor,
|
|
title: 'Syncrow App',
|
|
onGenerateRoute: router.Router.generateRoute,
|
|
initialRoute: Routes.splash,
|
|
themeMode: ThemeMode.system,
|
|
theme: ThemeManager.selectTheme(),
|
|
supportedLocales: const [
|
|
Locale('en', ''), // English, no country code
|
|
Locale('ar', ''), // Arabic, no country code
|
|
],
|
|
// locale: locale,
|
|
locale: const Locale('en', ''),
|
|
),
|
|
);
|
|
}
|
|
}
|