This repository has been archived on 2024-06-08. You can view files and clone it, but cannot push or open issues or pull requests.
SolarAgent/lib/main.dart
2024-03-24 20:09:50 +08:00

60 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:solaragent/auth.dart';
import 'package:solaragent/router.dart';
import 'package:solaragent/widgets/navigation.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Future<void> main() async {
await SentryFlutter.init(
(options) {
options.dsn =
'https://a629d9164a60a28ac855c52f4f543722@o4506965897117696.ingest.us.sentry.io/4506965900001280';
options.tracesSampleRate = 1.0;
},
appRunner: () async {
WidgetsFlutterBinding.ensureInitialized();
await authClient.pickClient();
runApp(const SolarAgent());
},
);
}
class SolarAgent extends StatelessWidget {
const SolarAgent({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'SolarAgent',
theme: ThemeData(
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.indigo,
accentColor: Colors.indigoAccent,
backgroundColor: Colors.white,
brightness: Brightness.light,
),
useMaterial3: true,
),
routerConfig: router,
builder: (context, child) => Overlay(
initialEntries: [
OverlayEntry(
builder: (context) => Container(
color: Colors.white,
child: SafeArea(
bottom: false,
child: Scaffold(
body: child,
bottomNavigationBar: const AgentNavigation(),
),
),
),
)
],
),
);
}
}