selfprivacy.org.app/lib/ui/pages/setup/initializing.dart

561 lines
20 KiB
Dart
Raw Normal View History

2020-12-30 14:13:25 +00:00
import 'package:cubit_form/cubit_form.dart';
2022-02-08 06:59:19 +00:00
import 'package:easy_localization/easy_localization.dart';
2020-12-10 20:33:19 +00:00
import 'package:flutter/material.dart';
import 'package:selfprivacy/config/brand_theme.dart';
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart';
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart';
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/cloudflare_form_cubit.dart';
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/domain_cloudflare.dart';
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/hetzner_form_cubit.dart';
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart';
2021-06-20 21:08:52 +00:00
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
2020-12-10 20:33:19 +00:00
import 'package:selfprivacy/ui/components/brand_button/brand_button.dart';
2021-05-25 21:53:54 +00:00
import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart';
2021-03-18 07:26:54 +00:00
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
2020-12-10 20:33:19 +00:00
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
2021-02-16 18:48:15 +00:00
import 'package:selfprivacy/ui/components/brand_timer/brand_timer.dart';
2020-12-30 14:13:25 +00:00
import 'package:selfprivacy/ui/components/progress_bar/progress_bar.dart';
2022-05-24 18:55:39 +00:00
import 'package:selfprivacy/ui/pages/root_route.dart';
import 'package:selfprivacy/ui/pages/setup/recovering/recovery_routing.dart';
2020-12-30 14:13:25 +00:00
import 'package:selfprivacy/utils/route_transitions/basic.dart';
2020-12-10 20:33:19 +00:00
2021-01-06 17:35:57 +00:00
class InitializingPage extends StatelessWidget {
const InitializingPage({Key? key}) : super(key: key);
2020-12-10 20:33:19 +00:00
@override
Widget build(BuildContext context) {
var cubit = context.watch<ServerInstallationCubit>();
if (cubit.state is ServerInstallationRecovery) {
2022-05-24 18:55:39 +00:00
return const RecoveryRouting();
} else {
var actualInitializingPage = [
() => _stepHetzner(cubit),
() => _stepCloudflare(cubit),
() => _stepBackblaze(cubit),
() => _stepDomain(cubit),
() => _stepUser(cubit),
() => _stepServer(cubit),
() => _stepCheck(cubit),
() => _stepCheck(cubit),
() => _stepCheck(cubit),
2022-05-24 18:55:39 +00:00
() => Center(child: Text('initializing.finish'.tr()))
][cubit.state.progress.index]();
return BlocListener<ServerInstallationCubit, ServerInstallationState>(
listener: (context, state) {
if (cubit.state is ServerInstallationFinished) {
2022-05-24 18:55:39 +00:00
Navigator.of(context)
.pushReplacement(materialRoute(const RootPage()));
}
},
child: SafeArea(
child: Scaffold(
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: paddingH15V0.copyWith(top: 10, bottom: 10),
child: cubit.state.isFullyInitilized
2022-05-24 18:55:39 +00:00
? const SizedBox(
height: 80,
)
: ProgressBar(
2022-05-24 18:55:39 +00:00
steps: const [
'Hetzner',
'CloudFlare',
'Backblaze',
'Domain',
'User',
'Server',
'✅ Check',
],
activeIndex: cubit.state.porgressBar,
),
2021-04-22 18:04:24 +00:00
),
_addCard(
AnimatedSwitcher(
2022-05-24 18:55:39 +00:00
duration: const Duration(milliseconds: 300),
child: actualInitializingPage,
2021-04-22 18:04:24 +00:00
),
),
ConstrainedBox(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height -
MediaQuery.of(context).padding.top -
MediaQuery.of(context).padding.bottom -
566,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
alignment: Alignment.center,
child: BrandButton.text(
title: cubit.state is ServerInstallationFinished
? 'basis.close'.tr()
: 'basis.later'.tr(),
onPressed: () {
Navigator.of(context).pushAndRemoveUntil(
2022-05-24 18:55:39 +00:00
materialRoute(const RootPage()),
(predicate) => false,
);
},
),
),
(cubit.state is ServerInstallationFinished)
? Container()
: Container(
alignment: Alignment.center,
child: BrandButton.text(
title: 'basis.connect_to_existing'.tr(),
onPressed: () {
2022-05-24 18:55:39 +00:00
Navigator.of(context).push(materialRoute(
const RecoveryRouting()));
},
),
)
],
)),
],
),
2021-04-22 18:04:24 +00:00
),
2021-01-06 17:35:57 +00:00
),
2020-12-30 14:13:25 +00:00
),
);
}
2020-12-10 20:33:19 +00:00
}
Widget _stepHetzner(ServerInstallationCubit serverInstallationCubit) {
2020-12-30 14:13:25 +00:00
return BlocProvider(
create: (context) => HetznerFormCubit(serverInstallationCubit),
2020-12-30 14:13:25 +00:00
child: Builder(builder: (context) {
2021-03-15 15:39:44 +00:00
var formCubitState = context.watch<HetznerFormCubit>().state;
2020-12-30 14:13:25 +00:00
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2021-02-15 18:58:29 +00:00
Image.asset(
'assets/images/logos/hetzner.png',
width: 150,
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-03-18 00:55:38 +00:00
BrandText.h2('initializing.1'.tr()),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-03-18 00:55:38 +00:00
BrandText.body2('initializing.2'.tr()),
2022-05-24 18:55:39 +00:00
const Spacer(),
2020-12-30 14:13:25 +00:00
CubitFormTextField(
2021-03-15 15:39:44 +00:00
formFieldCubit: context.read<HetznerFormCubit>().apiKey,
2020-12-30 14:13:25 +00:00
textAlign: TextAlign.center,
2022-05-24 18:55:39 +00:00
scrollPadding: const EdgeInsets.only(bottom: 70),
decoration: const InputDecoration(
2020-12-30 14:13:25 +00:00
hintText: 'Hetzner API Token',
),
),
2022-05-24 18:55:39 +00:00
const Spacer(),
2020-12-30 14:13:25 +00:00
BrandButton.rised(
2021-03-15 15:39:44 +00:00
onPressed: formCubitState.isSubmitting
? null
: () => context.read<HetznerFormCubit>().trySubmit(),
2021-05-25 21:53:54 +00:00
text: 'basis.connect'.tr(),
2020-12-30 14:13:25 +00:00
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2020-12-30 14:13:25 +00:00
BrandButton.text(
2021-12-23 13:52:12 +00:00
onPressed: () =>
2022-05-24 18:55:39 +00:00
_showModal(context, const _HowTo(fileName: 'how_hetzner')),
2021-03-18 00:55:38 +00:00
title: 'initializing.how'.tr(),
2020-12-30 14:13:25 +00:00
),
],
);
}),
);
}
2020-12-10 20:33:19 +00:00
void _showModal(BuildContext context, Widget widget) {
showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return widget;
},
);
}
Widget _stepCloudflare(ServerInstallationCubit initializingCubit) {
2021-01-06 17:35:57 +00:00
return BlocProvider(
create: (context) => CloudFlareFormCubit(initializingCubit),
child: Builder(builder: (context) {
2021-03-15 15:39:44 +00:00
var formCubitState = context.watch<CloudFlareFormCubit>().state;
2021-01-06 17:35:57 +00:00
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2021-02-15 18:58:29 +00:00
Image.asset(
'assets/images/logos/cloudflare.png',
width: 150,
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-03-18 00:55:38 +00:00
BrandText.h2('initializing.3'.tr()),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-03-18 00:55:38 +00:00
BrandText.body2('initializing.4'.tr()),
2022-05-24 18:55:39 +00:00
const Spacer(),
2021-01-06 17:35:57 +00:00
CubitFormTextField(
2021-03-15 15:39:44 +00:00
formFieldCubit: context.read<CloudFlareFormCubit>().apiKey,
2021-01-06 17:35:57 +00:00
textAlign: TextAlign.center,
2022-05-24 18:55:39 +00:00
scrollPadding: const EdgeInsets.only(bottom: 70),
2021-01-06 17:35:57 +00:00
decoration: InputDecoration(
2021-03-18 00:55:38 +00:00
hintText: 'initializing.5'.tr(),
2021-01-06 17:35:57 +00:00
),
),
2022-05-24 18:55:39 +00:00
const Spacer(),
2021-01-06 17:35:57 +00:00
BrandButton.rised(
2021-03-15 15:39:44 +00:00
onPressed: formCubitState.isSubmitting
? null
: () => context.read<CloudFlareFormCubit>().trySubmit(),
2021-05-25 21:53:54 +00:00
text: 'basis.connect'.tr(),
2021-01-06 17:35:57 +00:00
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-01-06 17:35:57 +00:00
BrandButton.text(
2021-12-23 13:52:12 +00:00
onPressed: () => _showModal(
context,
2022-05-24 18:55:39 +00:00
const _HowTo(
2021-12-23 13:52:12 +00:00
fileName: 'how_cloudflare',
)),
2021-03-18 00:55:38 +00:00
title: 'initializing.how'.tr(),
2021-01-06 17:35:57 +00:00
),
],
);
}),
2020-12-30 14:13:25 +00:00
);
}
Widget _stepBackblaze(ServerInstallationCubit initializingCubit) {
2021-02-03 19:51:07 +00:00
return BlocProvider(
create: (context) => BackblazeFormCubit(initializingCubit),
child: Builder(builder: (context) {
2021-03-15 15:39:44 +00:00
var formCubitState = context.watch<BackblazeFormCubit>().state;
2021-02-03 19:51:07 +00:00
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2021-02-15 18:58:29 +00:00
Image.asset(
'assets/images/logos/backblaze.png',
height: 50,
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-03-18 00:55:38 +00:00
BrandText.h2('initializing.6'.tr()),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
const Spacer(),
2021-02-03 19:51:07 +00:00
CubitFormTextField(
2021-03-15 15:39:44 +00:00
formFieldCubit: context.read<BackblazeFormCubit>().keyId,
2021-02-03 19:51:07 +00:00
textAlign: TextAlign.center,
2022-05-24 18:55:39 +00:00
scrollPadding: const EdgeInsets.only(bottom: 70),
decoration: const InputDecoration(
2021-02-03 19:51:07 +00:00
hintText: 'KeyID',
),
),
2022-05-24 18:55:39 +00:00
const Spacer(),
2021-02-03 19:51:07 +00:00
CubitFormTextField(
2021-03-15 15:39:44 +00:00
formFieldCubit: context.read<BackblazeFormCubit>().applicationKey,
2021-02-03 19:51:07 +00:00
textAlign: TextAlign.center,
2022-05-24 18:55:39 +00:00
scrollPadding: const EdgeInsets.only(bottom: 70),
decoration: const InputDecoration(
2021-02-03 19:51:07 +00:00
hintText: 'Master Application Key',
),
),
2022-05-24 18:55:39 +00:00
const Spacer(),
2021-02-03 19:51:07 +00:00
BrandButton.rised(
2021-03-15 15:39:44 +00:00
onPressed: formCubitState.isSubmitting
? null
: () => context.read<BackblazeFormCubit>().trySubmit(),
2021-05-25 21:53:54 +00:00
text: 'basis.connect'.tr(),
2021-02-03 19:51:07 +00:00
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-02-03 19:51:07 +00:00
BrandButton.text(
2021-12-23 13:52:12 +00:00
onPressed: () => _showModal(
context,
2022-05-24 18:55:39 +00:00
const _HowTo(
2021-12-23 13:52:12 +00:00
fileName: 'how_backblaze',
)),
2021-03-18 00:55:38 +00:00
title: 'initializing.how'.tr(),
2021-02-03 19:51:07 +00:00
),
],
);
}),
);
}
Widget _stepDomain(ServerInstallationCubit initializingCubit) {
2021-01-06 17:35:57 +00:00
return BlocProvider(
2021-02-15 18:58:29 +00:00
create: (context) => DomainSetupCubit(initializingCubit)..load(),
2021-01-06 17:35:57 +00:00
child: Builder(builder: (context) {
2021-03-15 15:39:44 +00:00
DomainSetupState state = context.watch<DomainSetupCubit>().state;
2021-01-06 17:35:57 +00:00
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2021-02-15 18:58:29 +00:00
Image.asset(
'assets/images/logos/cloudflare.png',
width: 150,
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 30),
2021-03-18 00:55:38 +00:00
BrandText.h2('basis.domain'.tr()),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-03-18 00:55:38 +00:00
if (state is Empty) BrandText.body2('initializing.7'.tr()),
2021-02-15 18:58:29 +00:00
if (state is Loading)
BrandText.body2(
state.type == LoadingTypes.loadingDomain
2021-03-18 00:55:38 +00:00
? 'initializing.8'.tr()
: 'basis.saving'.tr(),
2021-01-06 17:35:57 +00:00
),
2021-02-15 18:58:29 +00:00
if (state is MoreThenOne)
BrandText.body2(
2021-03-18 00:55:38 +00:00
'initializing.9'.tr(),
2021-02-15 18:58:29 +00:00
),
if (state is Loaded) ...[
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-02-15 18:58:29 +00:00
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: BrandText.h3(
2022-05-24 18:55:39 +00:00
state.domain,
2021-02-15 18:58:29 +00:00
textAlign: TextAlign.center,
),
),
2022-05-24 18:55:39 +00:00
SizedBox(
2021-02-15 18:58:29 +00:00
width: 50,
child: BrandButton.rised(
2021-03-15 15:39:44 +00:00
onPressed: () => context.read<DomainSetupCubit>().load(),
2021-02-15 18:58:29 +00:00
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
2022-05-24 18:55:39 +00:00
children: const [
2021-02-15 18:58:29 +00:00
Icon(
Icons.refresh,
color: Colors.white,
),
],
),
),
),
],
)
],
if (state is Empty) ...[
2022-05-24 18:55:39 +00:00
const SizedBox(height: 30),
2021-02-15 18:58:29 +00:00
BrandButton.rised(
2021-03-15 15:39:44 +00:00
onPressed: () => context.read<DomainSetupCubit>().load(),
2021-02-15 18:58:29 +00:00
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
2022-05-24 18:55:39 +00:00
const Icon(
2021-02-15 18:58:29 +00:00
Icons.refresh,
color: Colors.white,
),
2022-05-24 18:55:39 +00:00
const SizedBox(width: 10),
2021-02-15 18:58:29 +00:00
BrandText.buttonTitleText('Обновить cписок'),
],
),
),
],
if (state is Loaded) ...[
2022-05-24 18:55:39 +00:00
const SizedBox(height: 30),
2021-02-15 18:58:29 +00:00
BrandButton.rised(
2021-03-15 15:39:44 +00:00
onPressed: () => context.read<DomainSetupCubit>().saveDomain(),
2021-05-25 21:53:54 +00:00
text: 'initializing.10'.tr(),
2021-02-15 18:58:29 +00:00
),
],
2022-05-24 18:55:39 +00:00
const SizedBox(
height: 10,
width: double.infinity,
),
2021-01-06 17:35:57 +00:00
],
);
}),
2020-12-30 14:13:25 +00:00
);
}
Widget _stepUser(ServerInstallationCubit initializingCubit) {
2021-01-06 17:35:57 +00:00
return BlocProvider(
create: (context) =>
RootUserFormCubit(initializingCubit, FieldCubitFactory(context)),
2021-01-06 17:35:57 +00:00
child: Builder(builder: (context) {
2021-03-15 15:39:44 +00:00
var formCubitState = context.watch<RootUserFormCubit>().state;
2021-01-06 17:35:57 +00:00
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2021-04-22 18:04:24 +00:00
BrandText.h2('initializing.22'.tr()),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-04-22 18:04:24 +00:00
BrandText.body2('initializing.23'.tr()),
2022-05-24 18:55:39 +00:00
const Spacer(),
2021-01-06 17:35:57 +00:00
CubitFormTextField(
2021-03-15 15:39:44 +00:00
formFieldCubit: context.read<RootUserFormCubit>().userName,
2021-01-06 17:35:57 +00:00
textAlign: TextAlign.center,
2022-05-24 18:55:39 +00:00
scrollPadding: const EdgeInsets.only(bottom: 70),
2021-01-06 17:35:57 +00:00
decoration: InputDecoration(
2021-03-18 00:55:38 +00:00
hintText: 'basis.nickname'.tr(),
2020-12-10 20:33:19 +00:00
),
2021-01-06 17:35:57 +00:00
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-02-15 18:58:29 +00:00
BlocBuilder<FieldCubit<bool>, FieldCubitState<bool>>(
2021-03-15 15:39:44 +00:00
bloc: context.read<RootUserFormCubit>().isVisible,
2021-02-15 18:58:29 +00:00
builder: (context, state) {
var isVisible = state.value;
return CubitFormTextField(
obscureText: !isVisible,
2021-03-15 15:39:44 +00:00
formFieldCubit: context.read<RootUserFormCubit>().password,
2021-02-15 18:58:29 +00:00
textAlign: TextAlign.center,
2022-05-24 18:55:39 +00:00
scrollPadding: const EdgeInsets.only(bottom: 70),
2021-02-15 18:58:29 +00:00
decoration: InputDecoration(
2021-03-18 00:55:38 +00:00
hintText: 'basis.password'.tr(),
2021-02-15 18:58:29 +00:00
suffixIcon: IconButton(
icon: Icon(
isVisible ? Icons.visibility : Icons.visibility_off,
),
2021-03-15 15:39:44 +00:00
onPressed: () => context
.read<RootUserFormCubit>()
.isVisible
.setValue(!isVisible),
2021-02-15 18:58:29 +00:00
),
2022-05-24 18:55:39 +00:00
suffixIconConstraints: const BoxConstraints(minWidth: 60),
prefixIconConstraints: const BoxConstraints(maxWidth: 85),
2021-02-15 18:58:29 +00:00
prefixIcon: Container(),
),
);
},
2021-01-06 17:35:57 +00:00
),
2022-05-24 18:55:39 +00:00
const Spacer(),
2021-01-06 17:35:57 +00:00
BrandButton.rised(
2021-03-15 15:39:44 +00:00
onPressed: formCubitState.isSubmitting
? null
: () => context.read<RootUserFormCubit>().trySubmit(),
2021-05-25 21:53:54 +00:00
text: 'basis.connect'.tr(),
2021-01-06 17:35:57 +00:00
),
],
);
}),
2020-12-30 14:13:25 +00:00
);
}
2020-12-10 20:33:19 +00:00
Widget _stepServer(ServerInstallationCubit appConfigCubit) {
var isLoading =
(appConfigCubit.state as ServerInstallationNotFinished).isLoading;
2021-01-06 17:35:57 +00:00
return Builder(builder: (context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2022-05-24 18:55:39 +00:00
const Spacer(flex: 2),
2021-03-24 13:12:09 +00:00
BrandText.h2('initializing.final'.tr()),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-03-18 00:55:38 +00:00
BrandText.body2('initializing.11'.tr()),
2022-05-24 18:55:39 +00:00
const Spacer(),
2021-01-06 17:35:57 +00:00
BrandButton.rised(
2021-04-22 18:04:24 +00:00
onPressed: isLoading
2021-03-30 17:38:40 +00:00
? null
: () => appConfigCubit.createServerAndSetDnsRecords(),
2021-05-25 21:53:54 +00:00
text: isLoading ? 'basis.loading'.tr() : 'initializing.11'.tr(),
2021-01-06 17:35:57 +00:00
),
],
);
});
}
Widget _stepCheck(ServerInstallationCubit appConfigCubit) {
assert(
appConfigCubit.state is ServerInstallationNotFinished, 'wrong state');
2021-02-16 18:48:15 +00:00
var state = appConfigCubit.state as TimerState;
2021-06-20 21:08:52 +00:00
late int doneCount;
2021-03-23 19:50:11 +00:00
late String? text;
2021-03-31 11:37:39 +00:00
if (state.isServerResetedSecondTime) {
2021-03-18 00:55:38 +00:00
text = 'initializing.13'.tr();
2021-06-20 21:08:52 +00:00
doneCount = 3;
2021-03-31 11:37:39 +00:00
} else if (state.isServerResetedFirstTime) {
text = 'initializing.21'.tr();
2021-06-20 21:08:52 +00:00
doneCount = 2;
2021-03-23 19:50:11 +00:00
} else if (state.isServerStarted) {
2021-03-18 00:55:38 +00:00
text = 'initializing.14'.tr();
2021-06-20 21:08:52 +00:00
doneCount = 1;
2021-02-16 18:48:15 +00:00
} else if (state.isServerCreated) {
2021-03-18 00:55:38 +00:00
text = 'initializing.15'.tr();
2021-06-20 21:08:52 +00:00
doneCount = 0;
2021-02-16 18:48:15 +00:00
}
return Builder(builder: (context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2022-05-24 18:55:39 +00:00
const SizedBox(height: 15),
2021-06-20 21:08:52 +00:00
BrandText.h4(
2022-05-24 18:55:39 +00:00
'initializing.checks'.tr(args: [doneCount.toString(), '4']),
2021-06-20 21:08:52 +00:00
),
2022-05-24 18:55:39 +00:00
const Spacer(flex: 2),
const SizedBox(height: 10),
2021-02-16 18:48:15 +00:00
BrandText.body2(text),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2022-02-08 06:59:19 +00:00
if (doneCount == 0 && state.dnsMatches != null)
Column(
children: state.dnsMatches!.entries.map((entry) {
var domain = entry.key;
var isCorrect = entry.value;
return Row(
children: [
2022-05-24 18:55:39 +00:00
if (isCorrect) const Icon(Icons.check, color: Colors.green),
if (!isCorrect)
const Icon(Icons.schedule, color: Colors.amber),
const SizedBox(width: 10),
2022-02-08 06:59:19 +00:00
Text(domain),
],
);
}).toList(),
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 10),
2021-04-22 18:04:24 +00:00
if (!state.isLoading)
2021-02-16 18:48:15 +00:00
Row(
children: [
2021-03-18 00:55:38 +00:00
BrandText.body2('initializing.16'.tr()),
2021-02-16 18:48:15 +00:00
BrandTimer(
2021-03-23 19:50:11 +00:00
startDateTime: state.timerStart!,
duration: state.duration!,
2021-02-16 18:48:15 +00:00
)
],
),
2021-04-22 18:04:24 +00:00
if (state.isLoading) BrandText.body2('initializing.17'.tr()),
2021-02-16 18:48:15 +00:00
],
);
});
2021-01-06 19:25:53 +00:00
}
2020-12-30 14:13:25 +00:00
Widget _addCard(Widget child) {
2021-01-06 17:35:57 +00:00
return Container(
2021-03-25 08:46:07 +00:00
height: 450,
2021-05-25 21:53:54 +00:00
padding: paddingH15V0,
child: BrandCards.big(child: child),
2020-12-30 14:13:25 +00:00
);
2020-12-10 20:33:19 +00:00
}
}
2021-12-23 13:52:12 +00:00
class _HowTo extends StatelessWidget {
const _HowTo({
2021-03-15 15:39:44 +00:00
Key? key,
2021-12-23 13:52:12 +00:00
required this.fileName,
2020-12-10 20:33:19 +00:00
}) : super(key: key);
2021-12-23 13:52:12 +00:00
final String fileName;
2020-12-10 20:33:19 +00:00
@override
Widget build(BuildContext context) {
2021-06-20 21:08:52 +00:00
return BrandBottomSheet(
isExpended: true,
2020-12-10 20:33:19 +00:00
child: Padding(
2021-06-20 21:08:52 +00:00
padding: paddingH15V0,
child: BrandMarkdown(
2021-12-23 13:52:12 +00:00
fileName: fileName,
2021-06-20 21:08:52 +00:00
),
),
2020-12-10 20:33:19 +00:00
);
}
}