mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-28 19:56:50 +00:00
refactor(ui): Remove brand alert dialogs and bottom sheet
This commit is contained in:
parent
f5313a8148
commit
d242f5141e
|
@ -1,13 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class BrandAlert extends AlertDialog {
|
|
||||||
BrandAlert({
|
|
||||||
super.key,
|
|
||||||
final String? title,
|
|
||||||
final String? contentText,
|
|
||||||
super.actions,
|
|
||||||
}) : super(
|
|
||||||
title: title != null ? Text(title) : null,
|
|
||||||
content: title != null ? Text(contentText!) : null,
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class BrandBottomSheet extends StatelessWidget {
|
|
||||||
const BrandBottomSheet({
|
|
||||||
required this.child,
|
|
||||||
super.key,
|
|
||||||
this.isExpended = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
final Widget child;
|
|
||||||
final bool isExpended;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(final BuildContext context) {
|
|
||||||
final double mainHeight = MediaQuery.of(context).size.height -
|
|
||||||
MediaQuery.of(context).padding.top -
|
|
||||||
300;
|
|
||||||
late Widget innerWidget;
|
|
||||||
if (isExpended) {
|
|
||||||
innerWidget = Scaffold(
|
|
||||||
body: child,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
final ThemeData themeData = Theme.of(context);
|
|
||||||
|
|
||||||
innerWidget = Material(
|
|
||||||
color: themeData.scaffoldBackgroundColor,
|
|
||||||
child: IntrinsicHeight(child: child),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Center(
|
|
||||||
child: Container(
|
|
||||||
height: 4,
|
|
||||||
width: 30,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(2),
|
|
||||||
color: const Color(0xFFDDDDDD),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(maxHeight: mainHeight),
|
|
||||||
child: innerWidget,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,9 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:ionicons/ionicons.dart';
|
import 'package:ionicons/ionicons.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
||||||
import 'package:selfprivacy/ui/helpers/modals.dart';
|
|
||||||
|
|
||||||
class BrandFab extends StatefulWidget {
|
class BrandFab extends StatefulWidget {
|
||||||
const BrandFab({
|
const BrandFab({
|
||||||
|
@ -62,12 +60,9 @@ class _BrandFabState extends State<BrandFab>
|
||||||
child: FloatingActionButton(
|
child: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// TODO: Make a hero animation to the screen
|
// TODO: Make a hero animation to the screen
|
||||||
showBrandBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (final BuildContext context) => const BrandBottomSheet(
|
builder: (final BuildContext context) => const JobsContent(),
|
||||||
isExpended: true,
|
|
||||||
child: JobsContent(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
isExtended: widget.extended,
|
isExtended: widget.extended,
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/config/get_it_config.dart';
|
import 'package:selfprivacy/config/get_it_config.dart';
|
||||||
import 'package:selfprivacy/ui/components/buttons/dialog_action_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/dialog_action_button.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart';
|
|
||||||
|
|
||||||
Future<T?> showBrandBottomSheet<T>({
|
|
||||||
required final BuildContext context,
|
|
||||||
required final WidgetBuilder builder,
|
|
||||||
}) =>
|
|
||||||
showCupertinoModalBottomSheet<T>(
|
|
||||||
builder: builder,
|
|
||||||
barrierColor: Colors.black45,
|
|
||||||
context: context,
|
|
||||||
shadow: const BoxShadow(color: Colors.transparent),
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
);
|
|
||||||
|
|
||||||
void showPopUpAlert({
|
void showPopUpAlert({
|
||||||
required final String description,
|
required final String description,
|
||||||
|
@ -26,9 +12,9 @@ void showPopUpAlert({
|
||||||
final String? cancelButtonTitle,
|
final String? cancelButtonTitle,
|
||||||
}) {
|
}) {
|
||||||
getIt.get<NavigationService>().showPopUpDialog(
|
getIt.get<NavigationService>().showPopUpDialog(
|
||||||
BrandAlert(
|
AlertDialog(
|
||||||
title: alertTitle ?? 'basis.alert'.tr(),
|
title: Text(alertTitle ?? 'basis.alert'.tr()),
|
||||||
contentText: description,
|
content: Text(description),
|
||||||
actions: [
|
actions: [
|
||||||
DialogActionButton(
|
DialogActionButton(
|
||||||
text: actionButtonTitle,
|
text: actionButtonTitle,
|
||||||
|
|
|
@ -2,9 +2,7 @@ import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:ionicons/ionicons.dart';
|
import 'package:ionicons/ionicons.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
||||||
import 'package:selfprivacy/ui/helpers/modals.dart';
|
|
||||||
import 'package:selfprivacy/ui/helpers/widget_size.dart';
|
import 'package:selfprivacy/ui/helpers/widget_size.dart';
|
||||||
import 'package:selfprivacy/utils/breakpoints.dart';
|
import 'package:selfprivacy/utils/breakpoints.dart';
|
||||||
|
|
||||||
|
@ -127,13 +125,10 @@ class _HeroSliverAppBarState extends State<HeroSliverAppBar> {
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showBrandBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (final BuildContext context) =>
|
builder: (final BuildContext context) =>
|
||||||
const BrandBottomSheet(
|
const JobsContent(),
|
||||||
isExpended: true,
|
|
||||||
child: JobsContent(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
|
|
@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||||
import 'package:selfprivacy/ui/components/buttons/dialog_action_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/dialog_action_button.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart';
|
|
||||||
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
|
||||||
|
@ -82,9 +81,9 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
||||||
: () {
|
: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (final _) => BrandAlert(
|
builder: (final _) => AlertDialog(
|
||||||
title: 'modals.are_you_sure'.tr(),
|
title: Text('modals.are_you_sure'.tr()),
|
||||||
contentText: 'modals.delete_server_volume'.tr(),
|
content: Text('modals.delete_server_volume'.tr()),
|
||||||
actions: [
|
actions: [
|
||||||
DialogActionButton(
|
DialogActionButton(
|
||||||
text: 'modals.yes'.tr(),
|
text: 'modals.yes'.tr(),
|
||||||
|
@ -129,9 +128,9 @@ class _ResetAppTile extends StatelessWidget {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (final _) => BrandAlert(
|
builder: (final _) => AlertDialog(
|
||||||
title: 'modals.are_you_sure'.tr(),
|
title: Text('modals.are_you_sure'.tr()),
|
||||||
contentText: 'modals.purge_all_keys'.tr(),
|
content: Text('modals.purge_all_keys'.tr()),
|
||||||
actions: [
|
actions: [
|
||||||
DialogActionButton(
|
DialogActionButton(
|
||||||
text: 'modals.purge_all_keys_confirm'.tr(),
|
text: 'modals.purge_all_keys_confirm'.tr(),
|
||||||
|
|
|
@ -5,7 +5,6 @@ import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/services/services_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/services/services_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/models/disk_size.dart';
|
import 'package:selfprivacy/logic/models/disk_size.dart';
|
||||||
import 'package:selfprivacy/logic/models/service.dart';
|
import 'package:selfprivacy/logic/models/service.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_header/brand_header.dart';
|
import 'package:selfprivacy/ui/components/brand_header/brand_header.dart';
|
||||||
import 'package:selfprivacy/ui/components/info_box/info_box.dart';
|
import 'package:selfprivacy/ui/components/info_box/info_box.dart';
|
||||||
|
@ -13,7 +12,6 @@ import 'package:selfprivacy/logic/models/disk_status.dart';
|
||||||
import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
||||||
import 'package:selfprivacy/ui/components/storage_list_items/server_storage_list_item.dart';
|
import 'package:selfprivacy/ui/components/storage_list_items/server_storage_list_item.dart';
|
||||||
import 'package:selfprivacy/ui/components/storage_list_items/service_migration_list_item.dart';
|
import 'package:selfprivacy/ui/components/storage_list_items/service_migration_list_item.dart';
|
||||||
import 'package:selfprivacy/ui/helpers/modals.dart';
|
|
||||||
import 'package:selfprivacy/ui/pages/root_route.dart';
|
import 'package:selfprivacy/ui/pages/root_route.dart';
|
||||||
import 'package:selfprivacy/utils/route_transitions/basic.dart';
|
import 'package:selfprivacy/utils/route_transitions/basic.dart';
|
||||||
|
|
||||||
|
@ -182,13 +180,10 @@ class _ServicesMigrationPageState extends State<ServicesMigrationPage> {
|
||||||
materialRoute(const RootPage()),
|
materialRoute(const RootPage()),
|
||||||
(final predicate) => false,
|
(final predicate) => false,
|
||||||
);
|
);
|
||||||
showBrandBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (final BuildContext context) =>
|
builder: (final BuildContext context) =>
|
||||||
const BrandBottomSheet(
|
const JobsContent(),
|
||||||
isExpended: true,
|
|
||||||
child: JobsContent(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/config/brand_theme.dart';
|
import 'package:selfprivacy/config/brand_theme.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
||||||
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
|
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
|
||||||
|
@ -62,9 +61,7 @@ class RecoveryConfirmBackblaze extends StatelessWidget {
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
builder: (final BuildContext context) => BrandBottomSheet(
|
builder: (final BuildContext context) => Padding(
|
||||||
isExpended: true,
|
|
||||||
child: Padding(
|
|
||||||
padding: paddingH15V0,
|
padding: paddingH15V0,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
|
@ -73,7 +70,6 @@ class RecoveryConfirmBackblaze extends StatelessWidget {
|
||||||
fileName: 'how_backblaze',
|
fileName: 'how_backblaze',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/config/brand_theme.dart';
|
import 'package:selfprivacy/config/brand_theme.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
||||||
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
|
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
|
||||||
|
@ -54,18 +53,15 @@ class RecoveryConfirmCloudflare extends StatelessWidget {
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
builder: (final BuildContext context) => BrandBottomSheet(
|
builder: (final BuildContext context) => Padding(
|
||||||
isExpended: true,
|
padding: paddingH15V0,
|
||||||
child: Padding(
|
child: ListView(
|
||||||
padding: paddingH15V0,
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
child: ListView(
|
children: const [
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
BrandMarkdown(
|
||||||
children: const [
|
fileName: 'how_cloudflare',
|
||||||
BrandMarkdown(
|
),
|
||||||
fileName: 'how_cloudflare',
|
],
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/config/brand_theme.dart';
|
import 'package:selfprivacy/config/brand_theme.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
||||||
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
||||||
import 'package:cubit_form/cubit_form.dart';
|
import 'package:cubit_form/cubit_form.dart';
|
||||||
|
@ -57,18 +56,15 @@ class RecoveryServerProviderConnected extends StatelessWidget {
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
builder: (final BuildContext context) => BrandBottomSheet(
|
builder: (final BuildContext context) => Padding(
|
||||||
isExpended: true,
|
padding: paddingH15V0,
|
||||||
child: Padding(
|
child: ListView(
|
||||||
padding: paddingH15V0,
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
child: ListView(
|
children: const [
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
BrandMarkdown(
|
||||||
children: const [
|
fileName: 'how_hetzner',
|
||||||
BrandMarkdown(
|
),
|
||||||
fileName: 'how_hetzner',
|
],
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,76 +9,74 @@ class ResetPassword extends StatelessWidget {
|
||||||
final User user;
|
final User user;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => BrandBottomSheet(
|
Widget build(final BuildContext context) => BlocProvider(
|
||||||
child: BlocProvider(
|
create: (final BuildContext context) => UserFormCubit(
|
||||||
create: (final BuildContext context) => UserFormCubit(
|
jobsCubit: context.read<JobsCubit>(),
|
||||||
jobsCubit: context.read<JobsCubit>(),
|
fieldFactory: FieldCubitFactory(context),
|
||||||
fieldFactory: FieldCubitFactory(context),
|
initialUser: user,
|
||||||
initialUser: user,
|
),
|
||||||
),
|
child: Builder(
|
||||||
child: Builder(
|
builder: (final BuildContext context) {
|
||||||
builder: (final BuildContext context) {
|
final FormCubitState formCubitState =
|
||||||
final FormCubitState formCubitState =
|
context.watch<UserFormCubit>().state;
|
||||||
context.watch<UserFormCubit>().state;
|
|
||||||
|
|
||||||
return BlocListener<UserFormCubit, FormCubitState>(
|
return BlocListener<UserFormCubit, FormCubitState>(
|
||||||
listener:
|
listener:
|
||||||
(final BuildContext context, final FormCubitState state) {
|
(final BuildContext context, final FormCubitState state) {
|
||||||
if (state.isSubmitted) {
|
if (state.isSubmitted) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
BrandHeader(
|
||||||
|
title: 'users.reset_password'.tr(),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14),
|
||||||
|
Padding(
|
||||||
|
padding: paddingH15V0,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
BrandHeader(
|
CubitFormTextField(
|
||||||
title: 'users.reset_password'.tr(),
|
formFieldCubit:
|
||||||
),
|
context.read<UserFormCubit>().password,
|
||||||
const SizedBox(width: 14),
|
decoration: InputDecoration(
|
||||||
Padding(
|
alignLabelWithHint: false,
|
||||||
padding: paddingH15V0,
|
labelText: 'basis.password'.tr(),
|
||||||
child: Column(
|
suffixIcon: Padding(
|
||||||
mainAxisSize: MainAxisSize.min,
|
padding: const EdgeInsets.only(right: 8),
|
||||||
children: [
|
child: IconButton(
|
||||||
CubitFormTextField(
|
icon: Icon(
|
||||||
formFieldCubit:
|
BrandIcons.refresh,
|
||||||
context.read<UserFormCubit>().password,
|
color:
|
||||||
decoration: InputDecoration(
|
Theme.of(context).colorScheme.secondary,
|
||||||
alignLabelWithHint: false,
|
|
||||||
labelText: 'basis.password'.tr(),
|
|
||||||
suffixIcon: Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 8),
|
|
||||||
child: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
BrandIcons.refresh,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
onPressed: context
|
|
||||||
.read<UserFormCubit>()
|
|
||||||
.genNewPassword,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
onPressed: context
|
||||||
|
.read<UserFormCubit>()
|
||||||
|
.genNewPassword,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
),
|
||||||
BrandButton.rised(
|
|
||||||
onPressed: formCubitState.isSubmitting
|
|
||||||
? null
|
|
||||||
: () =>
|
|
||||||
context.read<UserFormCubit>().trySubmit(),
|
|
||||||
text: 'basis.apply'.tr(),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
BrandButton.rised(
|
||||||
|
onPressed: formCubitState.isSubmitting
|
||||||
|
? null
|
||||||
|
: () =>
|
||||||
|
context.read<UserFormCubit>().trySubmit(),
|
||||||
|
text: 'basis.apply'.tr(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,72 +254,70 @@ class NewSshKey extends StatelessWidget {
|
||||||
final User user;
|
final User user;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => BrandBottomSheet(
|
Widget build(final BuildContext context) => BlocProvider(
|
||||||
child: BlocProvider(
|
create: (final context) {
|
||||||
create: (final context) {
|
final jobCubit = context.read<JobsCubit>();
|
||||||
final jobCubit = context.read<JobsCubit>();
|
final jobState = jobCubit.state;
|
||||||
final jobState = jobCubit.state;
|
if (jobState is JobsStateWithJobs) {
|
||||||
if (jobState is JobsStateWithJobs) {
|
final jobs = jobState.clientJobList;
|
||||||
final jobs = jobState.clientJobList;
|
for (final job in jobs) {
|
||||||
for (final job in jobs) {
|
if (job is CreateSSHKeyJob && job.user.login == user.login) {
|
||||||
if (job is CreateSSHKeyJob && job.user.login == user.login) {
|
user.sshKeys.add(job.publicKey);
|
||||||
user.sshKeys.add(job.publicKey);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return SshFormCubit(
|
||||||
return SshFormCubit(
|
jobsCubit: jobCubit,
|
||||||
jobsCubit: jobCubit,
|
user: user,
|
||||||
user: user,
|
);
|
||||||
);
|
},
|
||||||
},
|
child: Builder(
|
||||||
child: Builder(
|
builder: (final context) {
|
||||||
builder: (final context) {
|
final formCubitState = context.watch<SshFormCubit>().state;
|
||||||
final formCubitState = context.watch<SshFormCubit>().state;
|
|
||||||
|
|
||||||
return BlocListener<SshFormCubit, FormCubitState>(
|
return BlocListener<SshFormCubit, FormCubitState>(
|
||||||
listener: (final context, final state) {
|
listener: (final context, final state) {
|
||||||
if (state.isSubmitted) {
|
if (state.isSubmitted) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
BrandHeader(
|
||||||
|
title: user.login,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14),
|
||||||
|
Padding(
|
||||||
|
padding: paddingH15V0,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
BrandHeader(
|
IntrinsicHeight(
|
||||||
title: user.login,
|
child: CubitFormTextField(
|
||||||
),
|
formFieldCubit: context.read<SshFormCubit>().key,
|
||||||
const SizedBox(width: 14),
|
decoration: InputDecoration(
|
||||||
Padding(
|
labelText: 'ssh.input_label'.tr(),
|
||||||
padding: paddingH15V0,
|
),
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
IntrinsicHeight(
|
|
||||||
child: CubitFormTextField(
|
|
||||||
formFieldCubit: context.read<SshFormCubit>().key,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'ssh.input_label'.tr(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
BrandButton.rised(
|
|
||||||
onPressed: formCubitState.isSubmitting
|
|
||||||
? null
|
|
||||||
: () =>
|
|
||||||
context.read<SshFormCubit>().trySubmit(),
|
|
||||||
text: 'ssh.create'.tr(),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
BrandButton.rised(
|
||||||
|
onPressed: formCubitState.isSubmitting
|
||||||
|
? null
|
||||||
|
: () =>
|
||||||
|
context.read<SshFormCubit>().trySubmit(),
|
||||||
|
text: 'ssh.create'.tr(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/users/users_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/users/users_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/models/job.dart';
|
import 'package:selfprivacy/logic/models/job.dart';
|
||||||
import 'package:selfprivacy/logic/models/hive/user.dart';
|
import 'package:selfprivacy/logic/models/hive/user.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
||||||
import 'package:selfprivacy/ui/components/buttons/outlined_button.dart';
|
import 'package:selfprivacy/ui/components/buttons/outlined_button.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart';
|
import 'package:selfprivacy/ui/components/brand_cards/filled_card.dart';
|
||||||
|
|
Loading…
Reference in a new issue