Solian/lib/main.dart

70 lines
2.4 KiB
Dart
Raw Normal View History

2024-04-12 16:38:20 +00:00
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:solian/providers/auth.dart';
import 'package:solian/providers/chat.dart';
2024-04-26 12:49:21 +00:00
import 'package:solian/providers/friend.dart';
2024-05-12 12:15:12 +00:00
import 'package:solian/providers/keypair.dart';
2024-04-13 16:10:22 +00:00
import 'package:solian/providers/navigation.dart';
2024-04-24 15:19:26 +00:00
import 'package:solian/providers/notify.dart';
2024-05-05 15:01:08 +00:00
import 'package:solian/providers/realm.dart';
2024-04-12 16:38:20 +00:00
import 'package:solian/router.dart';
2024-05-03 04:15:54 +00:00
import 'package:solian/utils/theme.dart';
2024-04-13 11:47:31 +00:00
import 'package:solian/utils/timeago.dart';
2024-04-12 16:38:20 +00:00
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
2024-04-17 12:57:25 +00:00
import 'package:solian/utils/video_player.dart';
2024-04-30 12:31:54 +00:00
import 'package:solian/widgets/chat/call/call_overlay.dart';
2024-05-12 12:59:33 +00:00
import 'package:solian/widgets/provider_init.dart';
2024-04-12 16:38:20 +00:00
void main() {
2024-04-27 12:10:15 +00:00
WidgetsFlutterBinding.ensureInitialized();
2024-04-17 12:57:25 +00:00
initVideo();
2024-04-13 11:47:31 +00:00
initTimeAgo();
2024-04-12 16:38:20 +00:00
runApp(const SolianApp());
}
class SolianApp extends StatelessWidget {
const SolianApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'Solian',
2024-05-03 04:15:54 +00:00
theme: SolianTheme.build(Brightness.light),
darkTheme: SolianTheme.build(Brightness.dark),
2024-05-01 14:35:58 +00:00
themeMode: ThemeMode.system,
2024-04-12 16:38:20 +00:00
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
routerConfig: SolianRouter.router,
2024-04-12 16:38:20 +00:00
builder: (context, child) {
2024-04-30 12:31:54 +00:00
return MultiProvider(
providers: [
Provider(create: (_) => NavigationProvider()),
ChangeNotifierProvider(create: (_) => AuthProvider()),
ChangeNotifierProvider(create: (_) => ChatProvider()),
ChangeNotifierProvider(create: (_) => NotifyProvider()),
ChangeNotifierProvider(create: (_) => FriendProvider()),
2024-05-05 15:01:08 +00:00
ChangeNotifierProvider(create: (_) => RealmProvider()),
2024-05-12 12:15:12 +00:00
ChangeNotifierProvider(create: (_) => KeypairProvider()),
2024-04-12 16:38:20 +00:00
],
2024-04-30 12:31:54 +00:00
child: Overlay(
initialEntries: [
OverlayEntry(builder: (context) {
2024-05-03 06:04:34 +00:00
return ScaffoldMessenger(
child: Scaffold(
2024-05-12 12:59:33 +00:00
body: ProviderInitializer(
child: child ?? Container(),
),
2024-05-03 06:04:34 +00:00
),
);
2024-04-30 12:31:54 +00:00
}),
OverlayEntry(builder: (context) => const CallOverlay()),
],
),
2024-04-12 16:38:20 +00:00
);
},
);
}
}