74 lines
1.9 KiB
Dart
74 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:goatagent/auth.dart';
|
|
import 'package:goatagent/firebase.dart';
|
|
import 'package:goatagent/screens/account.dart';
|
|
import 'package:goatagent/screens/dashboard.dart';
|
|
import 'package:goatagent/screens/notifications.dart';
|
|
|
|
import 'layouts/navigation.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
AuthGuard().pickClient();
|
|
|
|
runApp(GoatAgent());
|
|
}
|
|
|
|
class GoatAgent extends StatelessWidget {
|
|
final _router = GoRouter(
|
|
navigatorKey: GlobalKey<NavigatorState>(),
|
|
routes: [
|
|
GoRoute(
|
|
path: '/',
|
|
builder: (context, state) => const DashboardScreen(),
|
|
),
|
|
GoRoute(
|
|
path: '/notifications',
|
|
builder: (context, state) => const NotificationScreen(),
|
|
),
|
|
GoRoute(
|
|
path: '/account',
|
|
builder: (context, state) => const AccountScreen(),
|
|
),
|
|
],
|
|
);
|
|
|
|
GoatAgent({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FutureBuilder(
|
|
future: initializeFirebase(),
|
|
builder: (context, snapshot) {
|
|
if (!snapshot.hasData) {
|
|
return const Center(
|
|
child: CircularProgressIndicator(),
|
|
);
|
|
}
|
|
|
|
return MaterialApp.router(
|
|
routerConfig: _router,
|
|
title: 'GoatAgent',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
|
|
useMaterial3: true,
|
|
),
|
|
builder: (BuildContext context, Widget? child) {
|
|
return Overlay(initialEntries: [
|
|
OverlayEntry(
|
|
builder: (context) => Scaffold(
|
|
body: child,
|
|
// bottomNavigationBar: const AgentBottomNavigation()
|
|
bottomNavigationBar: AgentNavigation(router: _router),
|
|
),
|
|
)
|
|
]);
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|