Skip to content

Commit 5a97516

Browse files
committed
fix: prevent modal overflow on small screens
1 parent ac1468c commit 5a97516

1 file changed

Lines changed: 30 additions & 21 deletions

File tree

lib/features/onboarding/widgets/modal.dart

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,37 @@ void showInfoModal(BuildContext context, String title, String content) {
1313
backgroundColor: AppColors.modalBackgroundColor,
1414
child: Padding(
1515
padding: const EdgeInsets.all(24.0),
16-
child: Column(
17-
mainAxisSize: MainAxisSize.min,
18-
children: [
19-
Text(
20-
title,
21-
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
22-
),
23-
SizedBox(height: 12),
24-
Text(
25-
content,
26-
style: TextStyle(fontSize: 14),
27-
textAlign: TextAlign.justify,
28-
),
29-
SizedBox(height: 16),
30-
Align(
31-
alignment: Alignment.centerRight,
32-
child: TextButton(
33-
onPressed: () => Navigator.pop(context),
34-
child: Text('Close'),
16+
child: ConstrainedBox(
17+
constraints: BoxConstraints(
18+
maxHeight: MediaQuery.of(context).size.height * 0.75,
19+
),
20+
child: Column(
21+
mainAxisSize: MainAxisSize.min,
22+
children: [
23+
Text(
24+
title,
25+
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
3526
),
36-
),
37-
],
27+
const SizedBox(height: 12),
28+
Flexible(
29+
child: SingleChildScrollView(
30+
child: Text(
31+
content,
32+
style: TextStyle(fontSize: 14),
33+
textAlign: TextAlign.justify,
34+
),
35+
),
36+
),
37+
const SizedBox(height: 16),
38+
Align(
39+
alignment: Alignment.centerRight,
40+
child: TextButton(
41+
onPressed: () => Navigator.pop(context),
42+
child: const Text('Close'),
43+
),
44+
),
45+
],
46+
),
3847
),
3948
),
4049
);

0 commit comments

Comments
 (0)