passo_mobile_app/lib/main.dart

73 lines
2.4 KiB
Dart
Raw Normal View History

2022-11-28 08:03:13 +00:00
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
2022-11-28 08:03:13 +00:00
import 'package:device_preview/device_preview.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/user/user_bloc.dart';
2023-01-23 05:46:09 +00:00
import 'package:unit2/utils/app_router.dart';
2023-01-23 03:02:59 +00:00
import 'package:unit2/utils/global_context.dart';
import 'package:unit2/utils/global_context.dart';
2022-11-28 08:03:13 +00:00
import './utils/router.dart';
import './utils/global.dart';
void main() {
2023-01-23 05:46:09 +00:00
runApp(MyApp());
}
2022-11-28 08:03:13 +00:00
// void main() => runApp(
// DevicePreview(
// enabled: !kReleaseMode,
// builder: (context) => const MyApp(), // Wrap your app
// ),
// );
class MyApp extends StatelessWidget {
2023-01-23 05:46:09 +00:00
AppRouter? _appRouter;
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
2023-01-23 05:46:09 +00:00
_appRouter = AppRouter();
2022-11-28 08:03:13 +00:00
final mediaQueryData =
MediaQueryData.fromWindow(WidgetsBinding.instance.window);
screenWidth = mediaQueryData.size.width;
screenHeight = mediaQueryData.size.height;
blockSizeHorizontal = screenWidth / 100;
blockSizeVertical = screenHeight / 100;
safeAreaHorizontal =
mediaQueryData.padding.left + mediaQueryData.padding.right;
safeAreaVertical =
mediaQueryData.padding.top + mediaQueryData.padding.bottom;
safeBlockHorizontal = (screenWidth - safeAreaHorizontal) / 100;
safeBlockVertical = (screenHeight - safeAreaVertical) / 100;
2023-01-23 05:46:09 +00:00
2023-01-23 03:02:59 +00:00
return MultiBlocProvider(
providers: [
BlocProvider(
2023-01-23 05:46:09 +00:00
create: (_) => UserBloc(),
2023-01-23 03:02:59 +00:00
),
],
2023-01-23 05:46:09 +00:00
child: MaterialApp(
navigatorKey: NavigationService.navigatorKey,
// useInheritedMediaQuery: true,
// locale: DevicePreview.locale(context),
// builder: DevicePreview.appBuilder,
2023-01-23 05:46:09 +00:00
// routeInformationParser: goRouter.routeInformationParser,
// routerDelegate: goRouter.routerDelegate,
// routeInformationProvider: goRouter.routeInformationProvider,
title: 'uniT2 - Universal Tracker and Tracer',
theme: ThemeData(
appBarTheme: const AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarBrightness: Brightness.dark,
statusBarColor: Colors.black),
),
fontFamily: 'LexendDeca',
),
debugShowCheckedModeBanner: false,
2023-01-23 05:46:09 +00:00
onGenerateRoute: _appRouter!.onGenerateRoute,
),
);
}
}