diff --git a/lib/config/localization.dart b/lib/config/localization.dart index 3f55fae2..64d734ee 100644 --- a/lib/config/localization.dart +++ b/lib/config/localization.dart @@ -3,11 +3,12 @@ import 'package:flutter/material.dart'; class Localization extends StatelessWidget { const Localization({ + required this.child, super.key, - this.child, }); - final Widget? child; + final Widget child; + @override Widget build(final BuildContext context) => EasyLocalization( supportedLocales: const [ @@ -37,6 +38,6 @@ class Localization extends StatelessWidget { useFallbackTranslations: true, saveLocale: false, useOnlyLangCode: false, - child: child!, + child: child, ); } diff --git a/lib/logic/api_maps/graphql_maps/graphql_api_map.dart b/lib/logic/api_maps/graphql_maps/graphql_api_map.dart index 698f59e8..8723e188 100644 --- a/lib/logic/api_maps/graphql_maps/graphql_api_map.dart +++ b/lib/logic/api_maps/graphql_maps/graphql_api_map.dart @@ -119,8 +119,9 @@ abstract class GraphQLApiMap { String token = ''; final serverDetails = getIt().serverDetails; if (serverDetails != null) { - token = getIt().serverDetails!.apiToken; + token = serverDetails.apiToken; } + return token; } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 90035fea..75daa0ab 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -475,7 +475,7 @@ class ServerInstallationRepository { Future deleteServerDetails() async { await box.delete(BNames.serverDetails); - getIt().init(); + await getIt().init(); } Future saveServerProviderType(final ServerProviderType type) async { diff --git a/lib/logic/cubit/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index e89e0c6b..8636ffee 100644 --- a/lib/logic/cubit/server_installation/server_installation_state.dart +++ b/lib/logic/cubit/server_installation/server_installation_state.dart @@ -50,7 +50,7 @@ abstract class ServerInstallationState extends Equatable { bool get isServerCreated => serverDetails != null; bool get isFullyInitialized => - _fulfillmentList.every((final el) => el == true); + _fulfillmentList.every((final el) => el ?? false); ServerSetupProgress get progress => ServerSetupProgress .values[_fulfillmentList.where((final el) => el!).length]; diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index b32cd995..21f1bb17 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -88,7 +88,6 @@ class ApiConfigModel { } void clear() { - _localeCode = null; _serverProviderKey = null; _dnsProvider = null; _serverLocation = null; @@ -101,7 +100,7 @@ class ApiConfigModel { _serverProvider = null; } - void init() { + Future init() async { _localeCode = 'en'; _serverProviderKey = _box.get(BNames.hetznerKey); _serverLocation = _box.get(BNames.serverLocation); diff --git a/lib/theming/factory/app_theme_factory.dart b/lib/theming/factory/app_theme_factory.dart index 4bb3f31b..e3ca53d9 100644 --- a/lib/theming/factory/app_theme_factory.dart +++ b/lib/theming/factory/app_theme_factory.dart @@ -50,7 +50,8 @@ abstract class AppThemeFactory { static Future _getDynamicColors(final Brightness brightness) { try { return DynamicColorPlugin.getCorePalette().then( - (final corePallet) => corePallet?.toColorScheme(brightness: brightness), + (final corePallete) => + corePallete?.toColorScheme(brightness: brightness), ); } on PlatformException { return Future.value(null); diff --git a/lib/ui/pages/users/new_user.dart b/lib/ui/pages/users/new_user.dart index a55fb681..3327da33 100644 --- a/lib/ui/pages/users/new_user.dart +++ b/lib/ui/pages/users/new_user.dart @@ -14,17 +14,16 @@ class NewUserPage extends StatelessWidget { return BlocProvider( create: (final BuildContext context) { final jobCubit = context.read(); - final jobState = jobCubit.state; - final users = []; - users.addAll(context.read().state.users); - if (jobState is JobsStateWithJobs) { - final jobs = jobState.clientJobList; - for (final job in jobs) { - if (job is CreateUserJob) { - users.add(job.user); - } - } - } + + // final jobsState = jobCubit.state; + // final users = [ + // ...context.read().state.users, + // if (jobsState is JobsStateWithJobs) + // ...jobsState.clientJobList + // .whereType() + // .map((final job) => job.user), + // ]; + return UserFormCubit( jobsCubit: jobCubit, fieldFactory: FieldCubitFactory(context),