mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 17:29:50 +08:00
OnBoardingScreens: Do not let us skip screens
This requires us to dynamically generate the screens based on if we have completed the screen or not.
This commit is contained in:
@ -16,37 +16,58 @@ class OnBoardingScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class OnBoardingScreenState extends State<OnBoardingScreen> {
|
class OnBoardingScreenState extends State<OnBoardingScreen> {
|
||||||
|
var _pageInputUrlDone = false;
|
||||||
|
var _pageSshKeyDone = false;
|
||||||
|
|
||||||
var pageController = PageController();
|
var pageController = PageController();
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var pageView = PageView(
|
var pageCount = 1;
|
||||||
controller: pageController,
|
if (_pageInputUrlDone) {
|
||||||
children: <Widget>[
|
pageCount++;
|
||||||
OnBoardingGitUrl(doneFunction: (String sshUrl) {
|
}
|
||||||
pageController.nextPage(
|
if (_pageSshKeyDone) {
|
||||||
duration: Duration(milliseconds: 200),
|
pageCount++;
|
||||||
curve: Curves.easeIn,
|
}
|
||||||
);
|
|
||||||
|
|
||||||
SharedPreferences.getInstance().then((SharedPreferences pref) {
|
var pageView = PageView.builder(
|
||||||
pref.setString("sshCloneUrl", sshUrl);
|
controller: pageController,
|
||||||
});
|
itemBuilder: (BuildContext context, int pos) {
|
||||||
}),
|
if (pos == 0) {
|
||||||
OnBoardingSshKey(
|
return OnBoardingGitUrl(doneFunction: (String sshUrl) {
|
||||||
doneFunction: () {
|
setPageInputUrlDone();
|
||||||
pageController.nextPage(
|
pageController.nextPage(
|
||||||
duration: Duration(milliseconds: 200),
|
duration: Duration(milliseconds: 200),
|
||||||
curve: Curves.easeIn,
|
curve: Curves.easeIn,
|
||||||
);
|
);
|
||||||
},
|
|
||||||
scaffoldKey: _scaffoldKey,
|
SharedPreferences.getInstance().then((SharedPreferences pref) {
|
||||||
),
|
pref.setString("sshCloneUrl", sshUrl);
|
||||||
OnBoardingGitClone(
|
});
|
||||||
doneFunction: this.widget.onBoardingCompletedFunction,
|
});
|
||||||
),
|
}
|
||||||
],
|
if (pos == 1) {
|
||||||
|
return OnBoardingSshKey(
|
||||||
|
doneFunction: () {
|
||||||
|
setPageSshKeyDone();
|
||||||
|
pageController.nextPage(
|
||||||
|
duration: Duration(milliseconds: 200),
|
||||||
|
curve: Curves.easeIn,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
scaffoldKey: _scaffoldKey,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos == 2) {
|
||||||
|
return OnBoardingGitClone(
|
||||||
|
doneFunction: this.widget.onBoardingCompletedFunction,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemCount: pageCount,
|
||||||
);
|
);
|
||||||
|
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
@ -59,6 +80,18 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPageInputUrlDone() {
|
||||||
|
setState(() {
|
||||||
|
this._pageInputUrlDone = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPageSshKeyDone() {
|
||||||
|
setState(() {
|
||||||
|
this._pageSshKeyDone = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OnBoardingGitUrl extends StatefulWidget {
|
class OnBoardingGitUrl extends StatefulWidget {
|
||||||
|
Reference in New Issue
Block a user