Skip to content

Commit

Permalink
feat(error_view): use column layout
Browse files Browse the repository at this point in the history
  • Loading branch information
d-loose committed Jul 11, 2024
1 parent 145e571 commit d6bbe1e
Showing 1 changed file with 29 additions and 41 deletions.
70 changes: 29 additions & 41 deletions packages/app_center/lib/error/error_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,39 @@ class ErrorView extends StatelessWidget {
return Padding(
padding: const EdgeInsets.all(kPagePadding),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
const Spacer(),
Flexible(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset('assets/error.svg'),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
message.title(l10n),
style: Theme.of(context).textTheme.titleMedium,
),
Flexible(child: Text(message.body(l10n))),
const SizedBox(height: kPagePadding),
if (message.actions.isNotEmpty) ...[
Flexible(child: Text(message.actionLabel(l10n))),
const SizedBox(height: kPagePadding),
],
Row(
children: [
if (message.actions.contains(ErrorAction.retry))
OutlinedButton(
onPressed: onRetry,
child: Text(
UbuntuLocalizations.of(context).retryLabel,
),
),
if (message.actions.contains(ErrorAction.checkStatus))
OutlinedButton(
onPressed: () => launchUrlString(statusUrl),
child: Text(l10n.errorViewCheckStatusLabel),
),
].separatedBy(const SizedBox(width: 10)),
),
],
SvgPicture.asset('assets/error.svg'),
Text(
message.title(l10n),
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: kPagePadding),
Flexible(child: Text(message.body(l10n))),
if (message.actions.isNotEmpty) ...[
Flexible(child: Text(message.actionLabel(l10n))),
const SizedBox(height: kPagePadding),
],
Row(
mainAxisSize: MainAxisSize.min,
children: [
if (message.actions.contains(ErrorAction.retry))
OutlinedButton(
onPressed: onRetry,
child: Text(
UbuntuLocalizations.of(context).retryLabel,
),
),
if (message.actions.contains(ErrorAction.checkStatus))
OutlinedButton(
onPressed: () => launchUrlString(statusUrl),
child: Text(l10n.errorViewCheckStatusLabel),
),
],
),
].separatedBy(const SizedBox(width: 10)),
),
const Spacer(flex: 5),
const Spacer(flex: 3),
],
),
);
Expand Down

0 comments on commit d6bbe1e

Please sign in to comment.