fix: onboarding overflow on small devices
This commit is contained in:
@@ -63,7 +63,6 @@ class _OnboardingSheetState extends State<OnboardingSheet> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final height = MediaQuery.of(context).size.height;
|
final height = MediaQuery.of(context).size.height;
|
||||||
final isSmall = height < 720;
|
|
||||||
return Container(
|
return Container(
|
||||||
height: height * 0.7,
|
height: height * 0.7,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -89,14 +88,22 @@ class _OnboardingSheetState extends State<OnboardingSheet> {
|
|||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
final page = _pages[i];
|
final page = _pages[i];
|
||||||
final content = _IllustratedPage(page: page);
|
final content = _IllustratedPage(page: page);
|
||||||
return isSmall
|
// Ensure content can scroll vertically when space is tight,
|
||||||
? SingleChildScrollView(
|
// while keeping it centered when there is enough space.
|
||||||
padding: const EdgeInsets.symmetric(
|
return LayoutBuilder(
|
||||||
horizontal: Spacing.lg,
|
builder: (context, constraints) {
|
||||||
),
|
final centered = ConstrainedBox(
|
||||||
child: content,
|
constraints: BoxConstraints(
|
||||||
)
|
minHeight: constraints.maxHeight,
|
||||||
: content;
|
),
|
||||||
|
child: Center(child: content),
|
||||||
|
);
|
||||||
|
return SingleChildScrollView(
|
||||||
|
physics: const ClampingScrollPhysics(),
|
||||||
|
child: centered,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user