2024-04-12 16:38:20 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
2024-04-13 16:03:50 +00:00
|
|
|
import 'package:solian/providers/auth.dart';
|
2024-04-18 14:33:55 +00:00
|
|
|
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-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-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});
|
|
|
|
|
|
|
|
@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,
|
2024-05-03 05:39:52 +00:00
|
|
|
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-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(
|
|
|
|
body: NotificationNotifier(child: child ?? Container()),
|
|
|
|
),
|
|
|
|
);
|
2024-04-30 12:31:54 +00:00
|
|
|
}),
|
|
|
|
OverlayEntry(builder: (context) => const CallOverlay()),
|
|
|
|
],
|
|
|
|
),
|
2024-04-12 16:38:20 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|