69 lines
2.2 KiB
Dart
69 lines
2.2 KiB
Dart
import 'package:core_localization/core_localization.dart' as core_localization;
|
|
import 'package:design_system/design_system.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
import 'package:flutter_modular/flutter_modular.dart';
|
|
import 'package:staff_authentication/staff_authentication.dart'
|
|
as staff_authentication;
|
|
import 'package:firebase_core/firebase_core.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await Firebase.initializeApp();
|
|
runApp(ModularApp(module: AppModule(), child: const AppWidget()));
|
|
}
|
|
|
|
/// The main application module.
|
|
class AppModule extends Module {
|
|
@override
|
|
List<Module> get imports => [core_localization.LocalizationModule()];
|
|
|
|
@override
|
|
void routes(r) {
|
|
// Set the initial route to the authentication module
|
|
r.module("/", module: staff_authentication.StaffAuthenticationModule());
|
|
|
|
// Placeholder for home route (referenced in auth feature)
|
|
r.child(
|
|
"/worker-home",
|
|
child: (_) => const Scaffold(
|
|
body: Center(child: Text("Worker Home - To Be Implemented")),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class AppWidget extends StatelessWidget {
|
|
const AppWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider<core_localization.LocaleBloc>(
|
|
create: (context) =>
|
|
Modular.get<core_localization.LocaleBloc>()
|
|
..add(const core_localization.LoadLocale()),
|
|
child:
|
|
BlocBuilder<
|
|
core_localization.LocaleBloc,
|
|
core_localization.LocaleState
|
|
>(
|
|
builder: (context, state) {
|
|
return MaterialApp.router(
|
|
title: "KROW Staff",
|
|
theme: UiTheme.light,
|
|
routerConfig: Modular.routerConfig,
|
|
locale: state.locale,
|
|
supportedLocales: state.supportedLocales,
|
|
localizationsDelegates: const [
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate,
|
|
],
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|