fix: the keyboard blocked the content of bottom sheet (#4706)

* fix: the keyboard blocked the content of bottom sheet

* chore: apply suggestion

Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com>

---------

Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com>
This commit is contained in:
Lucas.Xu 2024-02-22 21:54:56 +07:00 committed by GitHub
parent c06a0346d8
commit ef83688907
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,9 +120,12 @@ Future<T?> showMobileBottomSheet<T>(
} }
// ----- content area ----- // ----- content area -----
// make sure the keyboard won't cover the content
children.add( children.add(
Padding( Padding(
padding: padding, padding: padding.copyWith(
bottom: padding.bottom + MediaQuery.of(context).viewInsets.bottom,
),
child: child, child: child,
), ),
); );
@ -133,6 +136,8 @@ Future<T?> showMobileBottomSheet<T>(
} }
// add default padding // add default padding
// for full screen bottom sheet, the padding should be 16.0
// for non full screen bottom sheet, the padding should be 28.0
children.add( children.add(
VSpace(MediaQuery.of(context).padding.bottom == 0 ? 28.0 : 16.0), VSpace(MediaQuery.of(context).padding.bottom == 0 ? 28.0 : 16.0),
); );