mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-17 18:49:55 +08:00

There were a few cases when since we were calling an async function in initState, which would then call setState, we would get an exception. Also this way, the entire logic of the onboarding is in one place, and the individual screens are far far simpler.
59 lines
1.4 KiB
Dart
59 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class OnBoardingGitClone extends StatelessWidget {
|
|
final String errorMessage;
|
|
|
|
OnBoardingGitClone({
|
|
this.errorMessage,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var children = <Widget>[];
|
|
if (this.errorMessage == null || this.errorMessage.isEmpty) {
|
|
children = <Widget>[
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text(
|
|
'Cloning ...',
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context).textTheme.display1,
|
|
),
|
|
),
|
|
SizedBox(height: 8.0),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: CircularProgressIndicator(
|
|
value: null,
|
|
),
|
|
),
|
|
];
|
|
} else {
|
|
children = <Widget>[
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text(
|
|
'Failed',
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context).textTheme.display1,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text(
|
|
this.errorMessage,
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context).textTheme.display1,
|
|
),
|
|
),
|
|
];
|
|
}
|
|
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: children,
|
|
);
|
|
}
|
|
}
|