mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +08:00
GitHostSetupScreen: Allow copying of the SSH Key
Also use functions with a specific type so the static type checker in Dart can help us catch such errors in the future.
This commit is contained in:
@ -3,9 +3,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'githostsetup_button.dart';
|
import 'githostsetup_button.dart';
|
||||||
import 'githostsetup_loading.dart';
|
import 'githostsetup_loading.dart';
|
||||||
|
|
||||||
|
typedef CopyKeyFunction = void Function(BuildContext context);
|
||||||
|
|
||||||
class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
|
class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
|
||||||
final Function doneFunction;
|
final Function doneFunction;
|
||||||
final Function copyKeyFunction;
|
final CopyKeyFunction copyKeyFunction;
|
||||||
final String publicKey;
|
final String publicKey;
|
||||||
|
|
||||||
final Function openDeployKeyPage;
|
final Function openDeployKeyPage;
|
||||||
@ -43,7 +45,7 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
|
|||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
GitHostSetupButton(
|
GitHostSetupButton(
|
||||||
text: "Copy Key",
|
text: "Copy Key",
|
||||||
onPressed: copyKeyFunction,
|
onPressed: () => copyKeyFunction(context),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0),
|
SizedBox(height: 16.0),
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
|
|||||||
|
|
||||||
class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
|
class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
|
||||||
final Function doneFunction;
|
final Function doneFunction;
|
||||||
final Function copyKeyFunction;
|
final CopyKeyFunction copyKeyFunction;
|
||||||
final String publicKey;
|
final String publicKey;
|
||||||
|
|
||||||
GitHostSetupSshKeyUnknownProvider({
|
GitHostSetupSshKeyUnknownProvider({
|
||||||
@ -117,7 +119,7 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
|
|||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
GitHostSetupButton(
|
GitHostSetupButton(
|
||||||
text: "Copy Key",
|
text: "Copy Key",
|
||||||
onPressed: copyKeyFunction,
|
onPressed: () => copyKeyFunction(context),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0),
|
SizedBox(height: 16.0),
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user