OnBoardingScreens: Get the background color from the theme

Also reduce a lot of code duplication
This commit is contained in:
Vishesh Handa
2019-01-10 17:07:31 +01:00
parent fe84aab6b7
commit 88a0c73fe3
2 changed files with 61 additions and 73 deletions

View File

@ -21,12 +21,12 @@ class JournalApp extends StatelessWidget {
: new OnBoardingScreen(stateContainer.completeOnBoarding);
return new MaterialApp(
title: 'Journal',
title: 'GitJournal',
home: home,
theme: new ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.lightBlue[800],
accentColor: Colors.cyan[600],
brightness: Brightness.light,
primaryColor: Color(0xFF66bb6a),
accentColor: Color(0xffe64a19),
),
navigatorObservers: <NavigatorObserver>[observer],
);

View File

@ -11,7 +11,7 @@ class OnBoardingScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
var pageController = PageController();
return PageView(
var pageView = PageView(
controller: pageController,
children: <Widget>[
OnBoardingGitUrl(doneFunction: (String sshUrl) {
@ -35,6 +35,15 @@ class OnBoardingScreen extends StatelessWidget {
),
],
);
return new Scaffold(
body: new Container(
width: double.infinity,
height: double.infinity,
color: Theme.of(context).primaryColor,
child: pageView,
),
);
}
}
@ -59,12 +68,7 @@ class OnBoardingGitUrlState extends State<OnBoardingGitUrl> {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Container(
width: double.infinity,
height: double.infinity,
color: Colors.green[400],
child: Column(
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
@ -89,8 +93,6 @@ class OnBoardingGitUrlState extends State<OnBoardingGitUrl> {
},
)
],
),
),
);
}
}
@ -127,12 +129,7 @@ class OnBoardingSshKeyState extends State<OnBoardingSshKey> {
Widget build(BuildContext context) {
FocusScope.of(context).requestFocus(new FocusNode());
return new Scaffold(
body: new Container(
width: double.infinity,
height: double.infinity,
color: Colors.green[400],
child: Column(
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
@ -152,8 +149,6 @@ class OnBoardingSshKeyState extends State<OnBoardingSshKey> {
onPressed: this.doneFunction,
)
],
),
),
);
}
}
@ -224,17 +219,10 @@ class OnBoardingGitCloneState extends State<OnBoardingGitClone> {
];
}
return new Scaffold(
body: new Container(
width: double.infinity,
height: double.infinity,
color: Colors.green[400],
child: Column(
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
),
),
);
}
}