2024-05-18 10:17:16 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-05-18 14:23:36 +00:00
|
|
|
import 'package:get/get.dart';
|
2024-05-25 05:00:40 +00:00
|
|
|
import 'package:solian/providers/account.dart';
|
2024-05-18 14:23:36 +00:00
|
|
|
import 'package:solian/providers/auth.dart';
|
2024-05-22 15:18:01 +00:00
|
|
|
import 'package:solian/providers/content/attachment.dart';
|
2024-05-25 09:21:27 +00:00
|
|
|
import 'package:solian/providers/content/post_explore.dart';
|
2024-05-23 13:12:47 +00:00
|
|
|
import 'package:solian/providers/friend.dart';
|
2024-05-18 10:17:16 +00:00
|
|
|
import 'package:solian/router.dart';
|
|
|
|
import 'package:solian/theme.dart';
|
|
|
|
import 'package:solian/translations.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const SolianApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class SolianApp extends StatelessWidget {
|
|
|
|
const SolianApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return GetMaterialApp.router(
|
|
|
|
title: 'Solian',
|
|
|
|
theme: SolianTheme.build(Brightness.light),
|
|
|
|
darkTheme: SolianTheme.build(Brightness.dark),
|
|
|
|
themeMode: ThemeMode.system,
|
|
|
|
routerDelegate: AppRouter.instance.routerDelegate,
|
|
|
|
routeInformationParser: AppRouter.instance.routeInformationParser,
|
|
|
|
routeInformationProvider: AppRouter.instance.routeInformationProvider,
|
|
|
|
translations: SolianMessages(),
|
|
|
|
locale: Get.deviceLocale,
|
|
|
|
fallbackLocale: const Locale('en', 'US'),
|
2024-05-18 14:23:36 +00:00
|
|
|
onInit: () {
|
|
|
|
Get.lazyPut(() => AuthProvider());
|
2024-05-23 13:12:47 +00:00
|
|
|
Get.lazyPut(() => FriendProvider());
|
2024-05-25 09:21:27 +00:00
|
|
|
Get.lazyPut(() => PostProvider());
|
2024-05-22 15:18:01 +00:00
|
|
|
Get.lazyPut(() => AttachmentProvider());
|
2024-05-25 05:00:40 +00:00
|
|
|
Get.lazyPut(() => AccountProvider());
|
|
|
|
|
|
|
|
final AuthProvider auth = Get.find();
|
|
|
|
auth.isAuthorized.then((value) async {
|
|
|
|
if (value) {
|
|
|
|
Get.find<AccountProvider>().connect();
|
|
|
|
}
|
|
|
|
});
|
2024-05-18 14:23:36 +00:00
|
|
|
},
|
2024-05-18 10:17:16 +00:00
|
|
|
builder: (context, child) {
|
2024-05-19 12:30:50 +00:00
|
|
|
return ScaffoldMessenger(
|
|
|
|
child: child ?? Container(),
|
2024-05-18 10:17:16 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|