Skip to content

Commit

Permalink
fix: make delete 2fa pages scrollable to fit the whole content in cas…
Browse files Browse the repository at this point in the history
…e of many 2fa options set up
  • Loading branch information
ice-ajax authored and ice-kreios committed Dec 27, 2024
1 parent 1346fc4 commit 9129c4e
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class DeleteTwoFaInitialScaffold extends StatelessWidget {
children: [
NavigationAppBar.modal(),
AuthHeader(
topOffset: 34.0.s,
title: headerTitle,
titleStyle: context.theme.appTextThemes.headline2,
descriptionStyle: context.theme.appTextThemes.body2.copyWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,54 +49,67 @@ class DeleteTwoFAInputStep extends HookConsumerWidget {
return ScreenSideOffset.large(
child: Form(
key: formKey.value,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
for (final twoFaType in twoFaTypes)
Padding(
padding: EdgeInsets.only(bottom: 22.0.s),
child: TwoFaCodeInput(
controller: controllers[twoFaType]!,
twoFaType: twoFaType,
onRequestCode: () async {
await guardPasskeyDialog(
ref.context,
(child) => RiverpodVerifyIdentityRequestBuilder(
provider: requestTwoFaCodeNotifierProvider,
requestWithVerifyIdentity:
(OnVerifyIdentity<GenerateSignatureResponse> onVerifyIdentity) {
ref.read(requestTwoFaCodeNotifierProvider.notifier).requestTwoFaCode(
twoFaType,
onVerifyIdentity,
);
},
child: child,
),
);
},
isSending: isRequesting,
),
child: CustomScrollView(
slivers: [
SliverList.builder(
itemCount: twoFaTypes.length,
itemBuilder: (context, index) {
final twoFaType = twoFaTypes[index];
return Padding(
padding: EdgeInsets.only(bottom: 22.0.s),
child: TwoFaCodeInput(
controller: controllers[twoFaType]!,
twoFaType: twoFaType,
onRequestCode: () async {
await guardPasskeyDialog(
ref.context,
(child) => RiverpodVerifyIdentityRequestBuilder(
provider: requestTwoFaCodeNotifierProvider,
requestWithVerifyIdentity:
(OnVerifyIdentity<GenerateSignatureResponse> onVerifyIdentity) {
ref.read(requestTwoFaCodeNotifierProvider.notifier).requestTwoFaCode(
twoFaType,
onVerifyIdentity,
);
},
child: child,
),
);
},
isSending: isRequesting,
),
],
),
const Spacer(),
WarningCard(
text: context.i18n.two_fa_warning,
),
SizedBox(
height: 24.0.s,
),
Button(
mainAxisSize: MainAxisSize.max,
label: Text(context.i18n.button_confirm),
onPressed: () {
if (formKey.value.currentState!.validate()) {
_onConfirm(ref, controllers);
}
);
},
),
SliverFillRemaining(
hasScrollBody: false,
child: Align(
alignment: Alignment.bottomCenter,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
WarningCard(
text: context.i18n.two_fa_warning,
),
SizedBox(
height: 24.0.s,
),
Button(
mainAxisSize: MainAxisSize.max,
label: Text(context.i18n.button_confirm),
onPressed: () {
if (formKey.value.currentState!.validate()) {
_onConfirm(ref, controllers);
}
},
),
SizedBox(
height: 48.0.s,
),
],
),
),
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ class DeleteTwoFASelectOptionStep extends ConsumerWidget {
return ScreenSideOffset.large(
child: Form(
key: formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
...List.generate(
optionsState.optionsAmount,
(option) {
child: CustomScrollView(
slivers: [
SliverList.builder(
itemCount: optionsState.optionsAmount,
itemBuilder: (context, option) {
return Padding(
padding: EdgeInsets.only(bottom: 22.0.s),
child: TwoFaOptionSelector(
Expand All @@ -49,22 +48,35 @@ class DeleteTwoFASelectOptionStep extends ConsumerWidget {
);
},
),
const Spacer(),
WarningCard(
text: context.i18n.two_fa_warning,
),
SizedBox(
height: 24.0.s,
),
Button(
mainAxisSize: MainAxisSize.max,
label: Text(context.i18n.button_confirm),
onPressed: () {
formKey.currentState!.save();
if (formKey.currentState!.validate()) {
onConfirm();
}
},
SliverFillRemaining(
hasScrollBody: false,
child: Align(
alignment: Alignment.bottomCenter,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
WarningCard(
text: context.i18n.two_fa_warning,
),
SizedBox(
height: 24.0.s,
),
Button(
mainAxisSize: MainAxisSize.max,
label: Text(context.i18n.button_confirm),
onPressed: () {
formKey.currentState!.save();
if (formKey.currentState!.validate()) {
onConfirm();
}
},
),
SizedBox(
height: 48.0.s,
),
],
),
),
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ class DeleteTwoFAStepScaffold extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return SheetContent(
body: CustomScrollView(
slivers: [
SliverAppBar(
bottomPadding: 0,
body: Column(
children: [
AppBar(
primary: false,
flexibleSpace: NavigationAppBar.modal(
actions: [
Expand All @@ -39,26 +40,14 @@ class DeleteTwoFAStepScaffold extends ConsumerWidget {
),
toolbarHeight: NavigationAppBar.modalHeaderHeight,
automaticallyImplyLeading: false,
pinned: true,
),
SliverToBoxAdapter(
child: AuthHeader(
topOffset: 34.0.s,
title: headerTitle,
description: headerDescription,
icon: AuthHeaderIcon(icon: headerIcon),
),
),
SliverFillRemaining(
hasScrollBody: false,
child: Column(
children: [
SizedBox(height: 64.0.s),
Expanded(child: child),
SizedBox(height: 16.0.s),
],
),
AuthHeader(
title: headerTitle,
description: headerDescription,
icon: AuthHeaderIcon(icon: headerIcon),
),
SizedBox(height: 64.0.s),
Expanded(child: child),
],
),
);
Expand Down

0 comments on commit 9129c4e

Please sign in to comment.