Files
AIOA/mobile/lib/app/app.dart
T
2026-07-18 19:20:07 +08:00

32 lines
1.0 KiB
Dart

import 'package:aioa_mobile/app/router.dart';
import 'package:aioa_mobile/app/theme.dart';
import 'package:aioa_mobile/core/auth/auth_session_controller.dart';
import 'package:aioa_mobile/core/auth/login_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:aioa_mobile/core/notifications/push_registration_controller.dart';
class AioaApp extends ConsumerWidget {
const AioaApp({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final auth = ref.watch(authSessionProvider);
if (auth.isLoading) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: buildAioaTheme(),
home: const Scaffold(body: Center(child: CircularProgressIndicator())),
);
}
if (auth.value == null) return const LoginPage();
ref.watch(pushRegistrationProvider);
return MaterialApp.router(
title: 'AIOA',
debugShowCheckedModeBanner: false,
theme: buildAioaTheme(),
routerConfig: appRouter,
);
}
}