mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
OnBoarding Bottom Bar: Show a 'Get Started' on the last page
This commit is contained in:
@ -16,6 +16,8 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
var pageController = PageController();
|
var pageController = PageController();
|
||||||
int _currentPageIndex = 0;
|
int _currentPageIndex = 0;
|
||||||
|
|
||||||
|
final _bottomBarHeight = 50.0;
|
||||||
|
|
||||||
Widget _buildPage(String text) {
|
Widget _buildPage(String text) {
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -43,24 +45,50 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
var bottomBar = Row(
|
Widget bottomBar;
|
||||||
children: <Widget>[
|
if (_currentPageIndex != pages.length - 1) {
|
||||||
OnBoardingBottomButton(text: "Skip", onPressed: _finish),
|
var row = Row(
|
||||||
Expanded(
|
children: <Widget>[
|
||||||
child: Row(
|
OnBoardingBottomButton(text: "Skip", onPressed: _finish),
|
||||||
children: [
|
Expanded(
|
||||||
DotsIndicator(
|
child: Row(
|
||||||
numberOfDot: pages.length,
|
children: [
|
||||||
position: _currentPageIndex,
|
DotsIndicator(
|
||||||
dotActiveColor: Theme.of(context).primaryColorDark,
|
numberOfDot: pages.length,
|
||||||
),
|
position: _currentPageIndex,
|
||||||
],
|
dotActiveColor: Theme.of(context).primaryColorDark,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
|
],
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
OnBoardingBottomButton(text: "Next", onPressed: _nextPage),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
bottomBar = Container(
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: _bottomBarHeight,
|
||||||
|
child: row,
|
||||||
),
|
),
|
||||||
OnBoardingBottomButton(text: "Next", onPressed: _nextPage),
|
color: Colors.grey[200],
|
||||||
],
|
);
|
||||||
);
|
} else {
|
||||||
|
bottomBar = SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: _bottomBarHeight,
|
||||||
|
child: RaisedButton(
|
||||||
|
child: Text(
|
||||||
|
"Get Started",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.button,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onPressed: _finish,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Container(
|
body: Container(
|
||||||
@ -69,7 +97,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
child: pageView,
|
child: pageView,
|
||||||
padding: EdgeInsets.all(16.0),
|
padding: EdgeInsets.all(16.0),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: Container(child: bottomBar, color: Colors.grey[200]),
|
bottomNavigationBar: bottomBar,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user