Update Saqel Platform: 2026-09-08 13:43:36
This commit is contained in:
@@ -5,6 +5,7 @@ import 'data/repositories/super_admin_repository.dart';
|
||||
import 'logic/cubits/super_admin_cubit.dart';
|
||||
import 'logic/cubits/treasury_cubit.dart';
|
||||
import 'presentation/screens/super_admin_shell.dart';
|
||||
import 'presentation/screens/super_admin_auth_screen.dart';
|
||||
|
||||
/**
|
||||
* ==============================================================================
|
||||
@@ -41,8 +42,40 @@ class SaqelSuperAdminApp extends StatelessWidget {
|
||||
title: 'صاقل | القيادة السيادية العليا',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: SuperAdminTheme.darkTheme,
|
||||
home: const SuperAdminShell(),
|
||||
home: SuperAdminAuthGate(repository: repository),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SuperAdminAuthGate extends StatefulWidget {
|
||||
final SuperAdminRepository repository;
|
||||
const SuperAdminAuthGate({super.key, required this.repository});
|
||||
|
||||
@override
|
||||
State<SuperAdminAuthGate> createState() => _SuperAdminAuthGateState();
|
||||
}
|
||||
|
||||
class _SuperAdminAuthGateState extends State<SuperAdminAuthGate> {
|
||||
late Future<bool> _session;
|
||||
|
||||
@override
|
||||
void initState() { super.initState(); _session = widget.repository.hasValidSession(); }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => FutureBuilder<bool>(
|
||||
future: _session,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState != ConnectionState.done) {
|
||||
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
||||
}
|
||||
if (snapshot.data != true) {
|
||||
return SuperAdminAuthScreen(
|
||||
repository: widget.repository,
|
||||
onAuthenticated: () => setState(() => _session = Future.value(true)),
|
||||
);
|
||||
}
|
||||
return const SuperAdminShell();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user