2020-12-01 19:08:19 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2022-05-31 14:30:44 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart';
|
2022-05-24 17:45:13 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart';
|
2022-05-17 13:31:34 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
2022-02-16 07:09:53 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart';
|
2021-12-06 18:31:19 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart';
|
2022-02-16 07:09:53 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart';
|
2021-05-25 21:53:54 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart';
|
2020-12-10 20:33:19 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart';
|
2022-08-26 16:46:30 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart';
|
2021-08-29 13:54:28 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/services/services_cubit.dart';
|
2020-12-03 16:52:53 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/users/users_cubit.dart';
|
2022-08-24 23:45:02 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart';
|
2020-12-01 19:08:19 +00:00
|
|
|
|
|
|
|
class BlocAndProviderConfig extends StatelessWidget {
|
2022-06-05 19:36:32 +00:00
|
|
|
const BlocAndProviderConfig({final super.key, this.child});
|
2020-12-01 19:08:19 +00:00
|
|
|
|
2021-03-15 15:39:44 +00:00
|
|
|
final Widget? child;
|
2020-12-01 19:08:19 +00:00
|
|
|
|
|
|
|
@override
|
2022-06-05 19:36:32 +00:00
|
|
|
Widget build(final BuildContext context) {
|
2022-06-05 22:40:34 +00:00
|
|
|
const isDark = false;
|
|
|
|
final serverInstallationCubit = ServerInstallationCubit()..load();
|
|
|
|
final usersCubit = UsersCubit(serverInstallationCubit);
|
|
|
|
final servicesCubit = ServicesCubit(serverInstallationCubit);
|
|
|
|
final backupsCubit = BackupsCubit(serverInstallationCubit);
|
|
|
|
final dnsRecordsCubit = DnsRecordsCubit(serverInstallationCubit);
|
|
|
|
final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit);
|
|
|
|
final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit);
|
2022-08-24 23:45:02 +00:00
|
|
|
final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit);
|
2022-08-26 16:46:30 +00:00
|
|
|
final apiServerVolumesCubit = ApiServerVolumeCubit(serverInstallationCubit);
|
|
|
|
|
2020-12-01 19:08:19 +00:00
|
|
|
return MultiProvider(
|
|
|
|
providers: [
|
2021-01-06 17:35:57 +00:00
|
|
|
BlocProvider(
|
2022-06-05 19:36:32 +00:00
|
|
|
create: (final _) => AppSettingsCubit(
|
2021-01-06 17:35:57 +00:00
|
|
|
isDarkModeOn: isDark,
|
2022-05-17 20:08:28 +00:00
|
|
|
isOnboardingShowing: true,
|
2021-01-06 17:35:57 +00:00
|
|
|
)..load(),
|
|
|
|
),
|
2022-06-05 22:40:34 +00:00
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => serverInstallationCubit,
|
|
|
|
lazy: false,
|
|
|
|
),
|
2022-08-26 16:46:30 +00:00
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => ProvidersCubit(),
|
|
|
|
),
|
2022-06-05 22:40:34 +00:00
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => usersCubit..load(),
|
|
|
|
lazy: false,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => servicesCubit..load(),
|
|
|
|
lazy: false,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => backupsCubit..load(),
|
|
|
|
lazy: false,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => dnsRecordsCubit..load(),
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => recoveryKeyCubit..load(),
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => apiDevicesCubit..load(),
|
|
|
|
),
|
2022-08-24 05:35:49 +00:00
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => apiVolumesCubit..load(),
|
|
|
|
),
|
2021-08-29 13:54:28 +00:00
|
|
|
BlocProvider(
|
2022-08-26 16:46:30 +00:00
|
|
|
create: (final _) => apiServerVolumesCubit..load(),
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => JobsCubit(
|
|
|
|
usersCubit: usersCubit,
|
|
|
|
servicesCubit: servicesCubit,
|
|
|
|
),
|
2021-08-29 13:54:28 +00:00
|
|
|
),
|
2020-12-01 19:08:19 +00:00
|
|
|
],
|
|
|
|
child: child,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|