@@ -13,14 +13,7 @@ import 'package:form_builder_validators/localization/l10n.dart';
1313import 'package:grpc/grpc.dart' ;
1414import 'package:hive_ce_flutter/hive_flutter.dart' ;
1515import 'package:kyber_collection/kyber_collection.dart' ;
16- import 'package:kyber_launcher/core/config/colors.dart' ;
17- import 'package:kyber_launcher/core/i18n/app_locale.dart' ;
18- import 'package:kyber_launcher/core/routing/app_router.dart' ;
19- import 'package:kyber_launcher/core/services/module_version_service.dart' ;
20- import 'package:kyber_launcher/core/services/native_dialog.dart' ;
21- import 'package:kyber_launcher/core/services/storage_helper.dart' ;
22- import 'package:kyber_launcher/core/services/window_helper.dart' ;
23- import 'package:kyber_launcher/core/utils/custom_logger.dart' ;
16+ import 'package:kyber_launcher/core/core.dart' ;
2417import 'package:kyber_launcher/features/download_manager/providers/download_manager_cubit.dart' ;
2518import 'package:kyber_launcher/features/events/providers/event_cubic.dart' ;
2619import 'package:kyber_launcher/features/kyber/providers/kyber_api_status_cubit.dart' ;
@@ -66,6 +59,9 @@ JavascriptRuntime? flutterJs;
6659WebViewEnvironment ? webViewEnvironment;
6760String ? bbCodeJs;
6861
62+ const kProdEnv = 'prod' ;
63+ const kDevPlaytestEnv = 'devplaytest' ;
64+
6965Box <dynamic > box = Hive .box ('data' );
7066Box <List > mapRotationBox = Hive .box ('mapRotation' );
7167Box <ModCollectionMetaData > collectionBox = Hive .box <ModCollectionMetaData >(
@@ -100,7 +96,8 @@ Future<void> initSentry(String currentVersion) async => SentryFlutter.init(
10096 return null ;
10197 }
10298
103- if (exception is FlutterError && exception.message.contains ('RenderFlex' )) {
99+ if (exception is FlutterError &&
100+ exception.message.contains ('RenderFlex' )) {
104101 return null ;
105102 }
106103
@@ -132,7 +129,7 @@ Future<void> loadCerts() async {
132129String ? launcherVersion;
133130
134131void main () async {
135- if (Platform .isWindows && ! kDebugMode) {
132+ if (Platform .isWindows && ! kDebugMode) {
136133 final exeDir = dirname (Platform .resolvedExecutable);
137134 final rustLib = File (join (exeDir, 'rust_lib.dll' ));
138135 if (! rustLib.existsSync ()) {
@@ -166,7 +163,7 @@ void main() async {
166163 Logger ('bootstrap' ).info ('Loading Certificates' );
167164 await loadCerts ();
168165 await initSentry (info.version);
169- if (defaultTargetPlatform == TargetPlatform .windows) {
166+ if (defaultTargetPlatform == .windows) {
170167 final availableVersion = await WebViewEnvironment .getAvailableVersion ();
171168 if (availableVersion == null ) {
172169 showWebViewDialog ();
@@ -245,7 +242,8 @@ class _AppState extends State<App> {
245242 return ToastificationWrapper (
246243 config: ToastificationConfig (
247244 animationDuration: const Duration (seconds: 1 ),
248- marginBuilder: (context, child) => const .only (bottom: 20 , left: 20 , right: 20 ),
245+ marginBuilder: (context, child) =>
246+ const .only (bottom: 20 , left: 20 , right: 20 ),
249247 ),
250248 child: HiveListener (
251249 box: box,
@@ -263,13 +261,14 @@ class _AppState extends State<App> {
263261 lightFactor: 0 ,
264262 ),
265263 activeColor: kActiveColor,
266- brightness: Brightness .dark,
264+ brightness: .dark,
267265 fontFamily: FontFamily .battlefrontUI,
268266 radioButtonTheme: RadioButtonThemeData (
269267 foregroundColor: WidgetStateProperty .resolveWith ((states) {
270268 if (states.contains (WidgetState .hovered)) {
271269 return kInactiveColor;
272270 }
271+
273272 return kActiveColor;
274273 }),
275274 ),
@@ -281,8 +280,8 @@ class _AppState extends State<App> {
281280 hoveringTrackBorderColor: kWhiteBackgroundColor,
282281 hoveringMainAxisMargin: 0 ,
283282 crossAxisMargin: 0 ,
284- padding: EdgeInsets .zero,
285- hoveringPadding: EdgeInsets .zero,
283+ padding: .zero,
284+ hoveringPadding: .zero,
286285 hoveringCrossAxisMargin: 0 ,
287286 mainAxisMargin: 0 ,
288287 backgroundColor: Colors .transparent,
@@ -292,21 +291,36 @@ class _AppState extends State<App> {
292291 ),
293292 ),
294293 backButtonDispatcher: RootBackButtonDispatcher (),
295- themeMode: ThemeMode .dark,
294+ themeMode: .dark,
296295 locale: AppLocale .getLocale (),
297296 localizationsDelegates: const [
298297 ...GlobalMaterialLocalizations .delegates,
299298 FormBuilderLocalizations .delegate,
300299 ],
301300 supportedLocales: const [Locale ('en' )],
302301 debugShowCheckedModeBanner: false ,
303- builder: (context, child) {
304- child = WindowController (
302+ builder: (context, c) {
303+ final currentRoute = router.routeInformationProvider.value.location;
304+
305+ Widget child = WindowController (
305306 child: GraphqlProvider (
306- child: child ! ,
307+ child: c ?? Text ( 'No route found for $ currentRoute ' ) ,
307308 ),
308309 );
309310
311+ if (Preferences .admin.apiEnv == kDevPlaytestEnv) {
312+ child = Banner (
313+ message: 'NOT FINAL' ,
314+ location: .topEnd,
315+ color: Colors .red,
316+ textStyle: const TextStyle (
317+ fontSize: 10 ,
318+ fontWeight: .bold,
319+ ),
320+ child: child,
321+ );
322+ }
323+
310324 return Builder (
311325 builder: (context) {
312326 return DisableAcrylic (
@@ -336,7 +350,7 @@ class _AppState extends State<App> {
336350 ),
337351 ],
338352 child: KyberBackground (
339- child: child ?? const SizedBox . shrink () ,
353+ child: child,
340354 ),
341355 ),
342356 );
0 commit comments