mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
63 lines
2.2 KiB
Dart
63 lines
2.2 KiB
Dart
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
|
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
|
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
|
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
|
import 'package:syncrow_web/services/locator.dart';
|
|
import 'package:syncrow_web/utils/color_manager.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
initialSetup(); // Perform initial setup, e.g., dependency injection
|
|
String checkToken = await AuthBloc.getTokenAndValidate();
|
|
runApp(MyApp(
|
|
isLoggedIn: checkToken,
|
|
));
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
final dynamic isLoggedIn;
|
|
const MyApp({
|
|
super.key,
|
|
required this.isLoggedIn,
|
|
});
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider(create: (context) => HomeBloc()),
|
|
],
|
|
child: MaterialApp(
|
|
debugShowCheckedModeBanner: false, // Hide debug banner
|
|
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
|
dragDevices: {
|
|
PointerDeviceKind.mouse,
|
|
PointerDeviceKind.touch,
|
|
PointerDeviceKind.stylus,
|
|
PointerDeviceKind.unknown,
|
|
},
|
|
),
|
|
theme: ThemeData(
|
|
textTheme: const TextTheme(
|
|
bodySmall: TextStyle(
|
|
fontSize: 13, color: ColorsManager.whiteColors, fontWeight: FontWeight.bold),
|
|
bodyMedium: TextStyle(color: Colors.black87, fontSize: 14),
|
|
bodyLarge: TextStyle(fontSize: 16, color: Colors.white),
|
|
headlineSmall: TextStyle(color: Colors.black87, fontSize: 18),
|
|
headlineMedium: TextStyle(color: Colors.black87, fontSize: 20),
|
|
headlineLarge: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), // Set up color scheme
|
|
useMaterial3: true, // Enable Material 3
|
|
),
|
|
home: isLoggedIn == 'Success' ? const HomePage() : const LoginPage(),
|
|
));
|
|
}
|
|
}
|