mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-07 00:24:18 +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 {
|
class Localization extends StatelessWidget {
|
||||||
const Localization({
|
const Localization({
|
||||||
|
required this.child,
|
||||||
super.key,
|
super.key,
|
||||||
this.child,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final Widget? child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => EasyLocalization(
|
Widget build(final BuildContext context) => EasyLocalization(
|
||||||
supportedLocales: const [
|
supportedLocales: const [
|
||||||
|
@ -37,6 +38,6 @@ class Localization extends StatelessWidget {
|
||||||
useFallbackTranslations: true,
|
useFallbackTranslations: true,
|
||||||
saveLocale: false,
|
saveLocale: false,
|
||||||
useOnlyLangCode: false,
|
useOnlyLangCode: false,
|
||||||
child: child!,
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,8 +119,9 @@ abstract class GraphQLApiMap {
|
||||||
String token = '';
|
String token = '';
|
||||||
final serverDetails = getIt<ApiConfigModel>().serverDetails;
|
final serverDetails = getIt<ApiConfigModel>().serverDetails;
|
||||||
if (serverDetails != null) {
|
if (serverDetails != null) {
|
||||||
token = getIt<ApiConfigModel>().serverDetails!.apiToken;
|
token = serverDetails.apiToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -475,7 +475,7 @@ class ServerInstallationRepository {
|
||||||
|
|
||||||
Future<void> deleteServerDetails() async {
|
Future<void> deleteServerDetails() async {
|
||||||
await box.delete(BNames.serverDetails);
|
await box.delete(BNames.serverDetails);
|
||||||
getIt<ApiConfigModel>().init();
|
await getIt<ApiConfigModel>().init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> saveServerProviderType(final ServerProviderType type) async {
|
Future<void> saveServerProviderType(final ServerProviderType type) async {
|
||||||
|
|
|
@ -50,7 +50,7 @@ abstract class ServerInstallationState extends Equatable {
|
||||||
bool get isServerCreated => serverDetails != null;
|
bool get isServerCreated => serverDetails != null;
|
||||||
|
|
||||||
bool get isFullyInitialized =>
|
bool get isFullyInitialized =>
|
||||||
_fulfillmentList.every((final el) => el == true);
|
_fulfillmentList.every((final el) => el ?? false);
|
||||||
ServerSetupProgress get progress => ServerSetupProgress
|
ServerSetupProgress get progress => ServerSetupProgress
|
||||||
.values[_fulfillmentList.where((final el) => el!).length];
|
.values[_fulfillmentList.where((final el) => el!).length];
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ class ApiConfigModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
_localeCode = null;
|
|
||||||
_serverProviderKey = null;
|
_serverProviderKey = null;
|
||||||
_dnsProvider = null;
|
_dnsProvider = null;
|
||||||
_serverLocation = null;
|
_serverLocation = null;
|
||||||
|
@ -101,7 +100,7 @@ class ApiConfigModel {
|
||||||
_serverProvider = null;
|
_serverProvider = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
Future<void> init() async {
|
||||||
_localeCode = 'en';
|
_localeCode = 'en';
|
||||||
_serverProviderKey = _box.get(BNames.hetznerKey);
|
_serverProviderKey = _box.get(BNames.hetznerKey);
|
||||||
_serverLocation = _box.get(BNames.serverLocation);
|
_serverLocation = _box.get(BNames.serverLocation);
|
||||||
|
|
|
@ -50,7 +50,8 @@ abstract class AppThemeFactory {
|
||||||
static Future<ColorScheme?> _getDynamicColors(final Brightness brightness) {
|
static Future<ColorScheme?> _getDynamicColors(final Brightness brightness) {
|
||||||
try {
|
try {
|
||||||
return DynamicColorPlugin.getCorePalette().then(
|
return DynamicColorPlugin.getCorePalette().then(
|
||||||
(final corePallet) => corePallet?.toColorScheme(brightness: brightness),
|
(final corePallete) =>
|
||||||
|
corePallete?.toColorScheme(brightness: brightness),
|
||||||
);
|
);
|
||||||
} on PlatformException {
|
} on PlatformException {
|
||||||
return Future.value(null);
|
return Future.value(null);
|
||||||
|
|
|
@ -14,17 +14,16 @@ class NewUserPage extends StatelessWidget {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (final BuildContext context) {
|
create: (final BuildContext context) {
|
||||||
final jobCubit = context.read<JobsCubit>();
|
final jobCubit = context.read<JobsCubit>();
|
||||||
final jobState = jobCubit.state;
|
|
||||||
final users = <User>[];
|
// final jobsState = jobCubit.state;
|
||||||
users.addAll(context.read<UsersBloc>().state.users);
|
// final users = <User>[
|
||||||
if (jobState is JobsStateWithJobs) {
|
// ...context.read<UsersBloc>().state.users,
|
||||||
final jobs = jobState.clientJobList;
|
// if (jobsState is JobsStateWithJobs)
|
||||||
for (final job in jobs) {
|
// ...jobsState.clientJobList
|
||||||
if (job is CreateUserJob) {
|
// .whereType<CreateUserJob>()
|
||||||
users.add(job.user);
|
// .map((final job) => job.user),
|
||||||
}
|
// ];
|
||||||
}
|
|
||||||
}
|
|
||||||
return UserFormCubit(
|
return UserFormCubit(
|
||||||
jobsCubit: jobCubit,
|
jobsCubit: jobCubit,
|
||||||
fieldFactory: FieldCubitFactory(context),
|
fieldFactory: FieldCubitFactory(context),
|
||||||
|
|
Loading…
Reference in a new issue