mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
Add some more landing pages
This totally breaks everything, but the commit is already too large, and I want to save it.
This commit is contained in:
BIN
assets/icon/github-icon.png
Normal file
BIN
assets/icon/github-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
assets/icon/gitlab-icon.png
Normal file
BIN
assets/icon/gitlab-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -22,6 +22,10 @@ class OnBoardingScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class OnBoardingScreenState extends State<OnBoardingScreen> {
|
class OnBoardingScreenState extends State<OnBoardingScreen> {
|
||||||
|
var _createNewRepo = false;
|
||||||
|
|
||||||
|
var _pageInitalScreenDone = false;
|
||||||
|
var _pageCreateNewRepoDone = false;
|
||||||
var _pageInputUrlDone = false;
|
var _pageInputUrlDone = false;
|
||||||
var _pageSshKeyDone = false;
|
var _pageSshKeyDone = false;
|
||||||
|
|
||||||
@ -33,6 +37,12 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var pageCount = 1;
|
var pageCount = 1;
|
||||||
|
if (_pageInitalScreenDone) {
|
||||||
|
pageCount++;
|
||||||
|
}
|
||||||
|
if (_pageCreateNewRepoDone) {
|
||||||
|
pageCount++;
|
||||||
|
}
|
||||||
if (_pageInputUrlDone) {
|
if (_pageInputUrlDone) {
|
||||||
pageCount++;
|
pageCount++;
|
||||||
}
|
}
|
||||||
@ -43,6 +53,37 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
var pageView = PageView.builder(
|
var pageView = PageView.builder(
|
||||||
controller: pageController,
|
controller: pageController,
|
||||||
itemBuilder: (BuildContext context, int pos) {
|
itemBuilder: (BuildContext context, int pos) {
|
||||||
|
if (pos == 0) {
|
||||||
|
return OnBoardingInitialChoice(
|
||||||
|
onCreateNewRepo: () {
|
||||||
|
setState(() {
|
||||||
|
_createNewRepo = true;
|
||||||
|
_pageInitalScreenDone = true;
|
||||||
|
|
||||||
|
pageController.nextPage(
|
||||||
|
duration: Duration(milliseconds: 200),
|
||||||
|
curve: Curves.easeIn,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onExistingRepo: () {
|
||||||
|
setState(() {
|
||||||
|
_createNewRepo = false;
|
||||||
|
_pageInitalScreenDone = true;
|
||||||
|
|
||||||
|
pageController.nextPage(
|
||||||
|
duration: Duration(milliseconds: 200),
|
||||||
|
curve: Curves.easeIn,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos == 1 && _createNewRepo) {
|
||||||
|
return OnBoardingCreateRepo();
|
||||||
|
}
|
||||||
|
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
return OnBoardingGitUrl(doneFunction: (String sshUrl) {
|
return OnBoardingGitUrl(doneFunction: (String sshUrl) {
|
||||||
setPageInputUrlDone();
|
setPageInputUrlDone();
|
||||||
@ -124,8 +165,9 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
body: new Container(
|
body: new Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
color: Theme.of(context).primaryColor,
|
//color: Theme.of(context).primaryColor,
|
||||||
child: pageView,
|
child: pageView,
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -159,6 +201,128 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class OnBoardingInitialChoice extends StatelessWidget {
|
||||||
|
final Function onCreateNewRepo;
|
||||||
|
final Function onExistingRepo;
|
||||||
|
|
||||||
|
OnBoardingInitialChoice({
|
||||||
|
@required this.onCreateNewRepo,
|
||||||
|
@required this.onExistingRepo,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var header = Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Image.asset(
|
||||||
|
'assets/icon/icon.png',
|
||||||
|
height: 200,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"GitJournal",
|
||||||
|
style: Theme.of(context).textTheme.display3,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
header,
|
||||||
|
SizedBox(height: 64.0),
|
||||||
|
Text(
|
||||||
|
"We need a Git Repo to store the data -",
|
||||||
|
style: Theme.of(context).textTheme.headline,
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.0),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: RaisedButton(
|
||||||
|
child: Text(
|
||||||
|
"Create a Rew Repo",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.button,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onPressed: onCreateNewRepo,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.0),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: RaisedButton(
|
||||||
|
child: Text(
|
||||||
|
"I already have one",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.button,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onPressed: onExistingRepo,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OnBoardingCreateRepo extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
"Select a provider -",
|
||||||
|
style: Theme.of(context).textTheme.headline,
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.0),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: RaisedButton.icon(
|
||||||
|
label: Text(
|
||||||
|
"GitHub",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.button,
|
||||||
|
),
|
||||||
|
icon: Image.asset(
|
||||||
|
'assets/icon/github-icon.png',
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.0),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: RaisedButton.icon(
|
||||||
|
label: Text(
|
||||||
|
"GitLab",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.button,
|
||||||
|
),
|
||||||
|
icon: Image.asset(
|
||||||
|
'assets/icon/gitlab-icon.png',
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class OnBoardingGitUrl extends StatefulWidget {
|
class OnBoardingGitUrl extends StatefulWidget {
|
||||||
final Function doneFunction;
|
final Function doneFunction;
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ flutter:
|
|||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
assets:
|
assets:
|
||||||
- "assets/icon/icon.png"
|
- "assets/icon/icon.png"
|
||||||
|
- "assets/icon/github-icon.png"
|
||||||
|
- "assets/icon/gitlab-icon.png"
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "launcher_icon"
|
android: "launcher_icon"
|
||||||
|
Reference in New Issue
Block a user