2020-12-01 19:08:19 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2024-01-29 13:54:09 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/backups/backups_bloc.dart';
|
2024-04-29 14:02:23 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/connection_status_bloc.dart';
|
2024-02-09 11:07:03 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/devices/devices_bloc.dart';
|
2024-02-08 15:08:29 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/recovery_key/recovery_key_bloc.dart';
|
2024-01-31 10:57:12 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/server_jobs/server_jobs_bloc.dart';
|
2024-01-29 15:57:22 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/services/services_bloc.dart';
|
2024-02-09 15:01:05 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/users/users_bloc.dart';
|
2024-02-01 14:30:06 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart';
|
2024-01-31 10:57:12 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
|
|
|
import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart';
|
2022-09-16 08:11:03 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart';
|
2022-05-17 13:31:34 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
2023-02-23 14:36:26 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart';
|
2020-12-01 19:08:19 +00:00
|
|
|
|
2024-01-31 14:06:49 +00:00
|
|
|
class BlocAndProviderConfig extends StatefulWidget {
|
2022-10-26 16:26:09 +00:00
|
|
|
const BlocAndProviderConfig({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
|
|
|
|
2024-01-31 14:06:49 +00:00
|
|
|
@override
|
|
|
|
BlocAndProviderConfigState createState() => BlocAndProviderConfigState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class BlocAndProviderConfigState extends State<BlocAndProviderConfig> {
|
|
|
|
late final ServerInstallationCubit serverInstallationCubit;
|
|
|
|
late final SupportSystemCubit supportSystemCubit;
|
2024-02-09 15:01:05 +00:00
|
|
|
late final UsersBloc usersBloc;
|
2024-01-31 14:06:49 +00:00
|
|
|
late final ServicesBloc servicesBloc;
|
|
|
|
late final BackupsBloc backupsBloc;
|
|
|
|
late final DnsRecordsCubit dnsRecordsCubit;
|
2024-02-08 15:08:29 +00:00
|
|
|
late final RecoveryKeyBloc recoveryKeyBloc;
|
2024-02-09 11:07:03 +00:00
|
|
|
late final DevicesBloc devicesBloc;
|
2024-01-31 14:06:49 +00:00
|
|
|
late final ServerJobsBloc serverJobsBloc;
|
|
|
|
late final ConnectionStatusBloc connectionStatusBloc;
|
|
|
|
late final ServerDetailsCubit serverDetailsCubit;
|
2024-02-01 14:30:06 +00:00
|
|
|
late final VolumesBloc volumesBloc;
|
2024-01-31 14:06:49 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
serverInstallationCubit = ServerInstallationCubit()..load();
|
|
|
|
supportSystemCubit = SupportSystemCubit();
|
2024-02-09 15:01:05 +00:00
|
|
|
usersBloc = UsersBloc();
|
2024-01-31 14:06:49 +00:00
|
|
|
servicesBloc = ServicesBloc();
|
|
|
|
backupsBloc = BackupsBloc();
|
|
|
|
dnsRecordsCubit = DnsRecordsCubit();
|
2024-02-08 15:08:29 +00:00
|
|
|
recoveryKeyBloc = RecoveryKeyBloc();
|
2024-02-09 11:07:03 +00:00
|
|
|
devicesBloc = DevicesBloc();
|
2024-01-31 14:06:49 +00:00
|
|
|
serverJobsBloc = ServerJobsBloc();
|
|
|
|
connectionStatusBloc = ConnectionStatusBloc();
|
|
|
|
serverDetailsCubit = ServerDetailsCubit();
|
2024-02-01 14:30:06 +00:00
|
|
|
volumesBloc = VolumesBloc();
|
2024-01-31 14:06:49 +00:00
|
|
|
}
|
|
|
|
|
2020-12-01 19:08:19 +00:00
|
|
|
@override
|
2024-05-15 15:36:00 +00:00
|
|
|
Widget build(final BuildContext context) => MultiProvider(
|
|
|
|
providers: [
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => supportSystemCubit,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => serverInstallationCubit,
|
|
|
|
lazy: false,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => usersBloc,
|
|
|
|
lazy: false,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => servicesBloc,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => backupsBloc,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => dnsRecordsCubit,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => recoveryKeyBloc,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => devicesBloc,
|
|
|
|
),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => serverJobsBloc,
|
|
|
|
),
|
|
|
|
BlocProvider(create: (final _) => connectionStatusBloc),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => serverDetailsCubit,
|
|
|
|
),
|
|
|
|
BlocProvider(create: (final _) => volumesBloc),
|
|
|
|
BlocProvider(
|
|
|
|
create: (final _) => JobsCubit(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
child: widget.child,
|
|
|
|
);
|
2020-12-01 19:08:19 +00:00
|
|
|
}
|