Skip to content

Commit

Permalink
fix align on loading/error page
Browse files Browse the repository at this point in the history
  • Loading branch information
Weslley41 committed Jun 30, 2023
1 parent b77d64c commit 39ddbbb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 41 deletions.
54 changes: 28 additions & 26 deletions lib/pages/error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,35 @@ class ErrorPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final randomNumber = Random().nextInt(10) + 1;
return SingleChildScrollView(
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'assets/images/$randomNumber.png',
height: 250,
),
const SizedBox(height: 20),
Text(
'Something went wrong. Please try again.',
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 20),
ElevatedButton(
style: ElevatedButton.styleFrom(
fixedSize: const Size.fromWidth(double.maxFinite),
textStyle: Theme.of(context).textTheme.bodyLarge,
return Center(
child: SingleChildScrollView(
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'assets/images/$randomNumber.png',
height: 250,
),
onPressed: onTryAgain,
child: const Text('Try again')
)
],
const SizedBox(height: 20),
Text(
'Something went wrong. Please try again.',
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 20),
ElevatedButton(
style: ElevatedButton.styleFrom(
fixedSize: const Size.fromWidth(double.maxFinite),
textStyle: Theme.of(context).textTheme.bodyLarge,
),
onPressed: onTryAgain,
child: const Text('Try again')
)
],
),
),
),
);
Expand Down
32 changes: 17 additions & 15 deletions lib/pages/loading.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ class LoadingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final randomNumber = Random().nextInt(10) + 1;
return SingleChildScrollView(
child: SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'assets/images/$randomNumber.png',
height: 250,
),
const SizedBox(height: 30),
const CircularProgressIndicator(),
const SizedBox(height: 20),
],
return Center(
child: SingleChildScrollView(
child: SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'assets/images/$randomNumber.png',
height: 250,
),
const SizedBox(height: 30),
const CircularProgressIndicator(),
const SizedBox(height: 20),
],
),
),
),
);
Expand Down

0 comments on commit 39ddbbb

Please sign in to comment.