mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
OnBoarding InputURL: Allow the user to submit it from the keyboard
This commit is contained in:
@ -69,6 +69,18 @@ class OnBoardingGitUrlState extends State<OnBoardingGitUrl> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
final inputFormFocus = FocusNode();
|
||||||
|
|
||||||
|
final formSubmitted = () {
|
||||||
|
if (_formKey.currentState.validate()) {
|
||||||
|
_formKey.currentState.save();
|
||||||
|
|
||||||
|
var url = sshUrlKey.currentState.value;
|
||||||
|
this.doneFunction(url);
|
||||||
|
inputFormFocus.unfocus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var inputForm = Form(
|
var inputForm = Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
@ -92,6 +104,9 @@ class OnBoardingGitUrlState extends State<OnBoardingGitUrl> {
|
|||||||
return "Invalid Input";
|
return "Invalid Input";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
focusNode: inputFormFocus,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (String _) => formSubmitted(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -107,12 +122,7 @@ class OnBoardingGitUrlState extends State<OnBoardingGitUrl> {
|
|||||||
inputForm,
|
inputForm,
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
child: Text("Next"),
|
child: Text("Next"),
|
||||||
onPressed: () {
|
onPressed: formSubmitted,
|
||||||
if (_formKey.currentState.validate()) {
|
|
||||||
var url = sshUrlKey.currentState.value;
|
|
||||||
this.doneFunction(url);
|
|
||||||
} else {}
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -149,8 +159,6 @@ class OnBoardingSshKeyState extends State<OnBoardingSshKey> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
FocusScope.of(context).requestFocus(new FocusNode());
|
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
Reference in New Issue
Block a user