Skip to content

Commit bc51720

Browse files
committed
fix: resolve example errors and Column overflow
- Fix ListTile leading: replace rate-limited network image with a local colored box + icon (no more HTTP 429 errors) - Fix Column RenderFlex overflow: replace AspectRatio(1.0) with ConstrainedBox(minHeight = width) so the alert box is at least square but grows to fit content when title + subtitle + icon would otherwise overflow https://claude.ai/code/session_017nS5t2oQz1X4o359oZiRVS
1 parent c521323 commit bc51720

2 files changed

Lines changed: 38 additions & 38 deletions

File tree

example/lib/screens/status_alert_screen.dart

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,41 @@ import 'package:flutter/material.dart';
22
import 'package:status_alert/status_alert.dart';
33

44
class StatusAlertScreen extends StatelessWidget {
5+
const StatusAlertScreen({super.key});
6+
57
@override
68
Widget build(BuildContext context) {
79
return Scaffold(
8-
appBar: AppBar(title: Text('Status Alert')),
10+
appBar: AppBar(title: const Text('Status Alert')),
911
body: ListView.separated(
1012
itemCount: 20,
11-
separatorBuilder: (_, __) => Divider(),
13+
separatorBuilder: (_, __) => const Divider(),
1214
itemBuilder: (BuildContext context, int index) {
1315
return ListTile(
1416
leading: ClipRRect(
1517
borderRadius: BorderRadius.circular(8),
16-
child: Image.network(
17-
'https://upload.wikimedia.org/wikipedia/en/thumb/4/4c/Ones_and_Zeros_Young_Guns.jpg/220px-Ones_and_Zeros_Young_Guns.jpg',
18+
child: const SizedBox(
19+
width: 50,
20+
height: 50,
21+
child: ColoredBox(
22+
color: Color(0xFF1DB954),
23+
child: Icon(Icons.music_note, color: Colors.white),
24+
),
1825
),
1926
),
20-
title: Text('Ones and Zeros'),
21-
subtitle: Text('Young Guns'),
27+
title: const Text('Ones and Zeros'),
28+
subtitle: const Text('Young Guns'),
2229
trailing: IconButton(
23-
icon: Icon(Icons.favorite_border),
30+
icon: const Icon(Icons.favorite_border),
2431
onPressed: () {
25-
// StatusAlert.show(
26-
// context,
27-
// duration: Duration(seconds: 2),
28-
// title: 'Subscribed',
29-
// padding: EdgeInsets.zero,
30-
// configuration: FlareConfiguration('assets/check_option.flr',
31-
// animation: 'Untitled', margin: EdgeInsets.all(10)),
32-
// );
33-
3432
StatusAlert.show(
3533
context,
36-
duration: Duration(seconds: 2),
34+
duration: const Duration(seconds: 2),
3735
maxWidth: 260,
3836
title: 'Loved',
39-
subtitle: 'We\'ll recommend more like this For You.',
40-
configuration: IconConfiguration(icon: Icons.favorite_border),
37+
subtitle: "We'll recommend more like this For You.",
38+
configuration:
39+
const IconConfiguration(icon: Icons.favorite_border),
4140
);
4241
},
4342
),

lib/src/widgets/status_alert_base_widget.dart

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,26 @@ class _StatusAlertBaseWidgetState extends State<StatusAlertBaseWidget>
202202
sigmaX: blurSigma,
203203
sigmaY: blurSigma,
204204
),
205-
child: SizedBox(
206-
width: screenWidth * 0.72,
207-
child: AspectRatio(
208-
aspectRatio: 1.0,
209-
child: Container(
210-
decoration: BoxDecoration(
211-
color: widget.backgroundColor ??
212-
(Theme.of(context).brightness == Brightness.dark
213-
? darkBackground
214-
: lightBackground),
215-
borderRadius: widget.borderRadius,
216-
),
217-
child: Padding(
218-
padding: widget.padding,
219-
child: Column(
220-
mainAxisSize: MainAxisSize.max,
221-
mainAxisAlignment: MainAxisAlignment.center,
222-
children: content,
223-
),
205+
child: ConstrainedBox(
206+
constraints: BoxConstraints(
207+
minWidth: screenWidth * 0.72,
208+
maxWidth: screenWidth * 0.72,
209+
minHeight: screenWidth * 0.72,
210+
),
211+
child: Container(
212+
decoration: BoxDecoration(
213+
color: widget.backgroundColor ??
214+
(Theme.of(context).brightness == Brightness.dark
215+
? darkBackground
216+
: lightBackground),
217+
borderRadius: widget.borderRadius,
218+
),
219+
child: Padding(
220+
padding: widget.padding,
221+
child: Column(
222+
mainAxisSize: MainAxisSize.min,
223+
mainAxisAlignment: MainAxisAlignment.center,
224+
children: content,
224225
),
225226
),
226227
),

0 commit comments

Comments
 (0)