fix: onboarding overflow on small devices

This commit is contained in:
cogwheel0
2025-09-09 13:10:26 +05:30
parent 96200e0481
commit 74807babfe

View File

@@ -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(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
), ),
child: content, child: Center(child: content),
) );
: content; return SingleChildScrollView(
physics: const ClampingScrollPhysics(),
child: centered,
);
},
);
}, },
), ),
), ),