GitSetup: Autofill the clone url with the last value

Makes it easier to fix typos
This commit is contained in:
Vishesh Handa
2019-02-14 00:53:29 +01:00
parent 74d167e503
commit b7c687eee5
2 changed files with 21 additions and 9 deletions

@ -6,8 +6,12 @@ import 'githostsetup_button.dart';
class GitCloneUrlPage extends StatefulWidget {
final Function doneFunction;
final String initialValue;
GitCloneUrlPage({@required this.doneFunction});
GitCloneUrlPage({
@required this.doneFunction,
@required this.initialValue,
});
@override
GitCloneUrlPageState createState() {
@ -61,6 +65,7 @@ class GitCloneUrlPageState extends State<GitCloneUrlPage> {
focusNode: inputFormFocus,
textInputAction: TextInputAction.done,
onFieldSubmitted: (String _) => formSubmitted(),
initialValue: widget.initialValue,
),
);
@ -94,11 +99,13 @@ class GitCloneUrlKnownProviderPage extends StatefulWidget {
final Function doneFunction;
final Function launchCreateUrlPage;
final GitHostType gitHostType;
final String initialValue;
GitCloneUrlKnownProviderPage({
@required this.doneFunction,
@required this.launchCreateUrlPage,
@required this.gitHostType,
@required this.initialValue,
});
@override
@ -154,6 +161,7 @@ class GitCloneUrlKnownProviderPageState
focusNode: inputFormFocus,
textInputAction: TextInputAction.done,
onFieldSubmitted: (String _) => formSubmitted(),
initialValue: widget.initialValue,
),
);

@ -79,15 +79,18 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
assert(_pageChoice[0] != PageChoice0.Unknown);
if (_pageChoice[0] == PageChoice0.CustomProvider) {
return GitCloneUrlPage(doneFunction: (String sshUrl) {
setState(() {
_gitCloneUrl = sshUrl;
return GitCloneUrlPage(
doneFunction: (String sshUrl) {
setState(() {
_gitCloneUrl = sshUrl;
_pageCount = pos + 2;
_nextPage();
_generateSshKey();
});
});
_pageCount = pos + 2;
_nextPage();
_generateSshKey();
});
},
initialValue: _gitCloneUrl,
);
}
return GitHostAutoConfigureChoicePage(
@ -141,6 +144,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
},
launchCreateUrlPage: _launchCreateRepoPage,
gitHostType: _gitHostType,
initialValue: _gitCloneUrl,
);
} else if (_pageChoice[1] == PageChoice1.Auto) {
return GitHostSetupAutoConfigure(