2022-05-13 13:57:56 +00:00
|
|
|
import 'package:cubit_form/cubit_form.dart';
|
2022-05-10 20:42:33 +00:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2022-05-13 13:57:56 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/app_config/app_config_cubit.dart';
|
|
|
|
import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart';
|
|
|
|
import 'package:selfprivacy/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart';
|
2022-05-10 20:42:33 +00:00
|
|
|
import 'package:selfprivacy/ui/components/brand_button/brand_button.dart';
|
2022-05-11 18:37:08 +00:00
|
|
|
import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart';
|
2022-05-10 20:42:33 +00:00
|
|
|
|
2022-05-13 13:57:56 +00:00
|
|
|
class RecoveryDomain extends StatelessWidget {
|
2022-05-10 20:42:33 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-05-13 13:57:56 +00:00
|
|
|
var appConfig = context.watch<AppConfigCubit>();
|
2022-05-11 18:37:08 +00:00
|
|
|
|
2022-05-13 13:57:56 +00:00
|
|
|
return BlocProvider(
|
|
|
|
create: (context) =>
|
|
|
|
RecoveryDomainFormCubit(appConfig, FieldCubitFactory(context)),
|
|
|
|
child: Builder(builder: (context) {
|
|
|
|
var formCubitState = context.watch<RecoveryDomainFormCubit>().state;
|
|
|
|
|
|
|
|
return BrandHeroScreen(
|
2022-05-11 18:37:08 +00:00
|
|
|
children: [
|
2022-05-13 13:57:56 +00:00
|
|
|
CubitFormTextField(
|
|
|
|
formFieldCubit:
|
|
|
|
context.read<RecoveryDomainFormCubit>().serverDomainField,
|
2022-05-11 18:37:08 +00:00
|
|
|
decoration: InputDecoration(
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
labelText: "recovering.domain_recover_placeholder".tr(),
|
|
|
|
),
|
|
|
|
),
|
2022-05-13 13:57:56 +00:00
|
|
|
SizedBox(height: 16),
|
2022-05-11 18:37:08 +00:00
|
|
|
BrandButton.rised(
|
2022-05-13 13:57:56 +00:00
|
|
|
onPressed: formCubitState.isSubmitting
|
|
|
|
? null
|
|
|
|
: () => context.read<RecoveryDomainFormCubit>().trySubmit(),
|
2022-05-11 18:37:08 +00:00
|
|
|
text: "more.continue".tr(),
|
|
|
|
),
|
|
|
|
],
|
2022-05-13 13:57:56 +00:00
|
|
|
heroTitle: "recovering.recovery_main_header".tr(),
|
|
|
|
heroSubtitle: "recovering.domain_recovery_description".tr(),
|
|
|
|
hasBackButton: true,
|
|
|
|
hasFlashButton: false,
|
|
|
|
heroIcon: Icons.link,
|
|
|
|
);
|
|
|
|
}),
|
2022-05-11 18:37:08 +00:00
|
|
|
);
|
|
|
|
}
|
2022-05-13 13:57:56 +00:00
|
|
|
}
|