mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-04 23:24:20 +00:00
fix: minor code tweaks (no functional changes)
This commit is contained in:
parent
161c5b7fc5
commit
53ea69a000
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -119,8 +119,9 @@ abstract class GraphQLApiMap {
|
|||
String token = '';
|
||||
final serverDetails = getIt<ApiConfigModel>().serverDetails;
|
||||
if (serverDetails != null) {
|
||||
token = getIt<ApiConfigModel>().serverDetails!.apiToken;
|
||||
token = serverDetails.apiToken;
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ class ServerInstallationRepository {
|
|||
|
||||
Future<void> deleteServerDetails() async {
|
||||
await box.delete(BNames.serverDetails);
|
||||
getIt<ApiConfigModel>().init();
|
||||
await getIt<ApiConfigModel>().init();
|
||||
}
|
||||
|
||||
Future<void> saveServerProviderType(final ServerProviderType type) async {
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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<void> init() async {
|
||||
_localeCode = 'en';
|
||||
_serverProviderKey = _box.get(BNames.hetznerKey);
|
||||
_serverLocation = _box.get(BNames.serverLocation);
|
||||
|
|
|
@ -50,7 +50,8 @@ abstract class AppThemeFactory {
|
|||
static Future<ColorScheme?> _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);
|
||||
|
|
|
@ -14,17 +14,16 @@ class NewUserPage extends StatelessWidget {
|
|||
return BlocProvider(
|
||||
create: (final BuildContext context) {
|
||||
final jobCubit = context.read<JobsCubit>();
|
||||
final jobState = jobCubit.state;
|
||||
final users = <User>[];
|
||||
users.addAll(context.read<UsersBloc>().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 = <User>[
|
||||
// ...context.read<UsersBloc>().state.users,
|
||||
// if (jobsState is JobsStateWithJobs)
|
||||
// ...jobsState.clientJobList
|
||||
// .whereType<CreateUserJob>()
|
||||
// .map((final job) => job.user),
|
||||
// ];
|
||||
|
||||
return UserFormCubit(
|
||||
jobsCubit: jobCubit,
|
||||
fieldFactory: FieldCubitFactory(context),
|
||||
|
|
Loading…
Reference in a new issue