mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +00:00
47 lines
1.3 KiB
Dart
47 lines
1.3 KiB
Dart
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/material.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/view/home_page.dart';
|
|
import 'package:syncrow_web/services/locator.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
initialSetup(); // Perform initial setup, e.g., dependency injection
|
|
String res = await AuthBloc.getTokenAndValidate();
|
|
runApp(MyApp(
|
|
isLoggedIn: res,
|
|
));
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
final dynamic isLoggedIn;
|
|
const MyApp({
|
|
super.key,
|
|
required this.isLoggedIn,
|
|
});
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
debugShowCheckedModeBanner: false, // Hide debug banner
|
|
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
|
dragDevices: {
|
|
PointerDeviceKind.mouse,
|
|
PointerDeviceKind.touch,
|
|
PointerDeviceKind.stylus,
|
|
PointerDeviceKind.unknown,
|
|
},
|
|
),
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: Colors.deepPurple), // Set up color scheme
|
|
useMaterial3: true, // Enable Material 3
|
|
),
|
|
home: isLoggedIn == 'Success'?
|
|
const HomePage()
|
|
:
|
|
const LoginPage(),
|
|
);
|
|
}
|
|
}
|