Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make delete 2fa pages scrollable to fit the whole content in case of many 2fa options set up #473

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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