Solian/lib/main.dart

68 lines
2.3 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-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-04-12 16:38:20 +00:00
import 'package:solian/router.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-04-24 15:19:26 +00:00
import 'package:solian/widgets/notification_notifier.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});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'Solian',
theme: ThemeData(
2024-05-01 14:35:58 +00:00
brightness: Brightness.light,
colorScheme: ColorScheme.fromSeed(brightness: Brightness.light, seedColor: Colors.indigo),
2024-04-12 16:38:20 +00:00
useMaterial3: true,
),
2024-05-01 14:35:58 +00:00
darkTheme: ThemeData(
brightness: Brightness.dark,
colorScheme: ColorScheme.fromSeed(brightness: Brightness.dark, seedColor: Colors.indigo),
useMaterial3: true,
),
themeMode: ThemeMode.system,
2024-04-12 16:38:20 +00:00
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
routerConfig: router,
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-04-12 16:38:20 +00:00
],
2024-04-30 12:31:54 +00:00
child: Overlay(
initialEntries: [
OverlayEntry(builder: (context) {
return NotificationNotifier(child: child ?? Container());
}),
OverlayEntry(builder: (context) => const CallOverlay()),
],
),
2024-04-12 16:38:20 +00:00
);
},
);
}
}