mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
GitHostSetup: Move SSH Key page to its own file
This commit is contained in:
@ -14,6 +14,7 @@ import 'githostsetup_autoconfigure.dart';
|
|||||||
import 'githostsetup_button.dart';
|
import 'githostsetup_button.dart';
|
||||||
import 'githostsetup_clone.dart';
|
import 'githostsetup_clone.dart';
|
||||||
import 'githostsetup_clone_url.dart';
|
import 'githostsetup_clone_url.dart';
|
||||||
|
import 'githostsetup_sshkey.dart';
|
||||||
|
|
||||||
class GitHostSetupScreen extends StatefulWidget {
|
class GitHostSetupScreen extends StatefulWidget {
|
||||||
final Function onCompletedFunction;
|
final Function onCompletedFunction;
|
||||||
@ -536,113 +537,3 @@ class GitHostAutoConfigureChoicePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GitHostSetupSshKey extends StatelessWidget {
|
|
||||||
final Function doneFunction;
|
|
||||||
final Function copyKeyFunction;
|
|
||||||
final String publicKey;
|
|
||||||
|
|
||||||
final Function openDeployKeyPage;
|
|
||||||
final bool canOpenDeployKeyPage;
|
|
||||||
|
|
||||||
GitHostSetupSshKey({
|
|
||||||
@required this.doneFunction,
|
|
||||||
@required this.copyKeyFunction,
|
|
||||||
@required this.openDeployKeyPage,
|
|
||||||
@required this.publicKey,
|
|
||||||
@required this.canOpenDeployKeyPage,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Widget copyAndDepoyWidget;
|
|
||||||
Widget cloneButton;
|
|
||||||
if (this.publicKey.isEmpty) {
|
|
||||||
copyAndDepoyWidget = Container();
|
|
||||||
cloneButton = Container();
|
|
||||||
} else {
|
|
||||||
cloneButton = GitHostSetupButton(
|
|
||||||
text: "Clone Repo",
|
|
||||||
onPressed: this.doneFunction,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (canOpenDeployKeyPage) {
|
|
||||||
copyAndDepoyWidget = Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: RaisedButton(
|
|
||||||
child: Text(
|
|
||||||
"Copy Key",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.button,
|
|
||||||
),
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
onPressed: copyKeyFunction,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 8.0),
|
|
||||||
Expanded(
|
|
||||||
child: RaisedButton(
|
|
||||||
child: Text(
|
|
||||||
"Open Deploy Key Webpage",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.button,
|
|
||||||
),
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
onPressed: openDeployKeyPage,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
copyAndDepoyWidget = GitHostSetupButton(
|
|
||||||
text: "Copy Key",
|
|
||||||
onPressed: this.copyKeyFunction,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String publicKeyStr = "";
|
|
||||||
if (this.publicKey == null || this.publicKey.isEmpty) {
|
|
||||||
publicKeyStr = "Generating ...";
|
|
||||||
} else {
|
|
||||||
publicKeyStr = this.publicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
var publicKeyWidget = SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 160.0,
|
|
||||||
child: Container(
|
|
||||||
color: Theme.of(context).buttonColor,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
publicKeyStr,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
maxLines: null,
|
|
||||||
style: Theme.of(context).textTheme.body1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
'Deploy Public Key',
|
|
||||||
style: Theme.of(context).textTheme.headline,
|
|
||||||
),
|
|
||||||
SizedBox(height: 16.0),
|
|
||||||
publicKeyWidget,
|
|
||||||
SizedBox(height: 8.0),
|
|
||||||
copyAndDepoyWidget,
|
|
||||||
cloneButton,
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
113
lib/screens/githostsetup_sshkey.dart
Normal file
113
lib/screens/githostsetup_sshkey.dart
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'githostsetup_button.dart';
|
||||||
|
|
||||||
|
class GitHostSetupSshKey extends StatelessWidget {
|
||||||
|
final Function doneFunction;
|
||||||
|
final Function copyKeyFunction;
|
||||||
|
final String publicKey;
|
||||||
|
|
||||||
|
final Function openDeployKeyPage;
|
||||||
|
final bool canOpenDeployKeyPage;
|
||||||
|
|
||||||
|
GitHostSetupSshKey({
|
||||||
|
@required this.doneFunction,
|
||||||
|
@required this.copyKeyFunction,
|
||||||
|
@required this.openDeployKeyPage,
|
||||||
|
@required this.publicKey,
|
||||||
|
@required this.canOpenDeployKeyPage,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Widget copyAndDepoyWidget;
|
||||||
|
Widget cloneButton;
|
||||||
|
if (this.publicKey.isEmpty) {
|
||||||
|
copyAndDepoyWidget = Container();
|
||||||
|
cloneButton = Container();
|
||||||
|
} else {
|
||||||
|
cloneButton = GitHostSetupButton(
|
||||||
|
text: "Clone Repo",
|
||||||
|
onPressed: this.doneFunction,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (canOpenDeployKeyPage) {
|
||||||
|
copyAndDepoyWidget = Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: RaisedButton(
|
||||||
|
child: Text(
|
||||||
|
"Copy Key",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.button,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onPressed: copyKeyFunction,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 8.0),
|
||||||
|
Expanded(
|
||||||
|
child: RaisedButton(
|
||||||
|
child: Text(
|
||||||
|
"Open Deploy Key Webpage",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.button,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
onPressed: openDeployKeyPage,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
copyAndDepoyWidget = GitHostSetupButton(
|
||||||
|
text: "Copy Key",
|
||||||
|
onPressed: this.copyKeyFunction,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String publicKeyStr = "";
|
||||||
|
if (this.publicKey == null || this.publicKey.isEmpty) {
|
||||||
|
publicKeyStr = "Generating ...";
|
||||||
|
} else {
|
||||||
|
publicKeyStr = this.publicKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
var publicKeyWidget = SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 160.0,
|
||||||
|
child: Container(
|
||||||
|
color: Theme.of(context).buttonColor,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
publicKeyStr,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
maxLines: null,
|
||||||
|
style: Theme.of(context).textTheme.body1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Deploy Public Key',
|
||||||
|
style: Theme.of(context).textTheme.headline,
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.0),
|
||||||
|
publicKeyWidget,
|
||||||
|
SizedBox(height: 8.0),
|
||||||
|
copyAndDepoyWidget,
|
||||||
|
cloneButton,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user