mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 19:36:25 +08:00
Copy public key to clipboard
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import 'package:journal/storage/git.dart';
|
import 'package:journal/storage/git.dart';
|
||||||
@ -16,6 +17,7 @@ class OnBoardingScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class OnBoardingScreenState extends State<OnBoardingScreen> {
|
class OnBoardingScreenState extends State<OnBoardingScreen> {
|
||||||
var pageController = PageController();
|
var pageController = PageController();
|
||||||
|
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -32,12 +34,15 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
pref.setString("sshCloneUrl", sshUrl);
|
pref.setString("sshCloneUrl", sshUrl);
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
OnBoardingSshKey(doneFunction: () {
|
OnBoardingSshKey(
|
||||||
|
doneFunction: () {
|
||||||
pageController.nextPage(
|
pageController.nextPage(
|
||||||
duration: Duration(milliseconds: 200),
|
duration: Duration(milliseconds: 200),
|
||||||
curve: Curves.easeIn,
|
curve: Curves.easeIn,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
scaffoldKey: _scaffoldKey,
|
||||||
|
),
|
||||||
OnBoardingGitClone(
|
OnBoardingGitClone(
|
||||||
doneFunction: this.widget.onBoardingCompletedFunction,
|
doneFunction: this.widget.onBoardingCompletedFunction,
|
||||||
),
|
),
|
||||||
@ -45,6 +50,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
|
key: _scaffoldKey,
|
||||||
body: new Container(
|
body: new Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
@ -135,8 +141,12 @@ class OnBoardingGitUrlState extends State<OnBoardingGitUrl> {
|
|||||||
|
|
||||||
class OnBoardingSshKey extends StatefulWidget {
|
class OnBoardingSshKey extends StatefulWidget {
|
||||||
final Function doneFunction;
|
final Function doneFunction;
|
||||||
|
final GlobalKey<ScaffoldState> scaffoldKey;
|
||||||
|
|
||||||
OnBoardingSshKey({@required this.doneFunction});
|
OnBoardingSshKey({
|
||||||
|
@required this.doneFunction,
|
||||||
|
@required this.scaffoldKey,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
OnBoardingSshKeyState createState() {
|
OnBoardingSshKeyState createState() {
|
||||||
@ -153,6 +163,14 @@ class OnBoardingSshKeyState extends State<OnBoardingSshKey> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
print("Changing the state");
|
print("Changing the state");
|
||||||
publicKey = _publicKey;
|
publicKey = _publicKey;
|
||||||
|
|
||||||
|
Clipboard.setData(ClipboardData(text: publicKey));
|
||||||
|
var text = "Public Key copied to Clipboard";
|
||||||
|
this
|
||||||
|
.widget
|
||||||
|
.scaffoldKey
|
||||||
|
.currentState
|
||||||
|
.showSnackBar(new SnackBar(content: new Text(text)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user