Skip to content

Commit d6bbe1e

Browse files
committed
feat(error_view): use column layout
1 parent 145e571 commit d6bbe1e

File tree

1 file changed

+29
-41
lines changed

1 file changed

+29
-41
lines changed

packages/app_center/lib/error/error_view.dart

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,51 +23,39 @@ class ErrorView extends StatelessWidget {
2323
return Padding(
2424
padding: const EdgeInsets.all(kPagePadding),
2525
child: Column(
26+
mainAxisAlignment: MainAxisAlignment.center,
27+
mainAxisSize: MainAxisSize.min,
2628
children: [
2729
const Spacer(),
28-
Flexible(
29-
flex: 2,
30-
child: Row(
31-
mainAxisAlignment: MainAxisAlignment.center,
32-
children: [
33-
SvgPicture.asset('assets/error.svg'),
34-
Column(
35-
mainAxisAlignment: MainAxisAlignment.center,
36-
crossAxisAlignment: CrossAxisAlignment.start,
37-
mainAxisSize: MainAxisSize.min,
38-
children: [
39-
Text(
40-
message.title(l10n),
41-
style: Theme.of(context).textTheme.titleMedium,
42-
),
43-
Flexible(child: Text(message.body(l10n))),
44-
const SizedBox(height: kPagePadding),
45-
if (message.actions.isNotEmpty) ...[
46-
Flexible(child: Text(message.actionLabel(l10n))),
47-
const SizedBox(height: kPagePadding),
48-
],
49-
Row(
50-
children: [
51-
if (message.actions.contains(ErrorAction.retry))
52-
OutlinedButton(
53-
onPressed: onRetry,
54-
child: Text(
55-
UbuntuLocalizations.of(context).retryLabel,
56-
),
57-
),
58-
if (message.actions.contains(ErrorAction.checkStatus))
59-
OutlinedButton(
60-
onPressed: () => launchUrlString(statusUrl),
61-
child: Text(l10n.errorViewCheckStatusLabel),
62-
),
63-
].separatedBy(const SizedBox(width: 10)),
64-
),
65-
],
30+
SvgPicture.asset('assets/error.svg'),
31+
Text(
32+
message.title(l10n),
33+
style: Theme.of(context).textTheme.titleLarge,
34+
),
35+
const SizedBox(height: kPagePadding),
36+
Flexible(child: Text(message.body(l10n))),
37+
if (message.actions.isNotEmpty) ...[
38+
Flexible(child: Text(message.actionLabel(l10n))),
39+
const SizedBox(height: kPagePadding),
40+
],
41+
Row(
42+
mainAxisSize: MainAxisSize.min,
43+
children: [
44+
if (message.actions.contains(ErrorAction.retry))
45+
OutlinedButton(
46+
onPressed: onRetry,
47+
child: Text(
48+
UbuntuLocalizations.of(context).retryLabel,
49+
),
50+
),
51+
if (message.actions.contains(ErrorAction.checkStatus))
52+
OutlinedButton(
53+
onPressed: () => launchUrlString(statusUrl),
54+
child: Text(l10n.errorViewCheckStatusLabel),
6655
),
67-
],
68-
),
56+
].separatedBy(const SizedBox(width: 10)),
6957
),
70-
const Spacer(flex: 5),
58+
const Spacer(flex: 3),
7159
],
7260
),
7361
);

0 commit comments

Comments
 (0)