47 lines
1.3 KiB
Dart
47 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'core/services/auth_service.dart';
|
|
import 'core/services/chit_group_service.dart';
|
|
import 'core/services/payment_service.dart';
|
|
import 'core/services/screen_recording_service.dart';
|
|
import 'features/auth/views/login_screen.dart';
|
|
import 'interfaces/manager/manager_dashboard.dart';
|
|
import 'interfaces/member/member_dashboard.dart';
|
|
|
|
class App extends StatelessWidget {
|
|
const App({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<AuthService>(
|
|
init: AuthService(),
|
|
builder: (authService) {
|
|
// Initialize other services
|
|
Get.put(ChitGroupService());
|
|
Get.put(PaymentService());
|
|
Get.put(ScreenRecordingService());
|
|
return Obx(() {
|
|
if (authService.isLoading.value) {
|
|
return const Scaffold(
|
|
body: Center(
|
|
child: CircularProgressIndicator(),
|
|
),
|
|
);
|
|
}
|
|
|
|
if (!authService.isAuthenticated.value) {
|
|
return const LoginScreen();
|
|
}
|
|
|
|
// Route based on user role
|
|
if (authService.currentUser.value?.role == 'manager') {
|
|
return const ManagerDashboard();
|
|
} else {
|
|
return const MemberDashboard();
|
|
}
|
|
});
|
|
},
|
|
);
|
|
}
|
|
}
|