File tree Expand file tree Collapse file tree 1 file changed +25
-6
lines changed
lib/screens/receive_transaction Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change
1
+ import 'dart:async' ;
2
+ import 'dart:developer' ;
3
+
1
4
import 'package:flutter/material.dart' ;
2
5
import 'package:flutter/services.dart' ;
3
6
import 'package:flutter_bloc/flutter_bloc.dart' ;
@@ -25,6 +28,9 @@ class ReceiveTransactionScreenState extends State<ReceiveTransactionScreen>
25
28
with TickerProviderStateMixin {
26
29
Account ? selectedAccount;
27
30
late AnimationController _loadingController;
31
+ bool isLoading = false ;
32
+ String copyText = 'Copy selected address' ;
33
+ bool enableButton = true ;
28
34
29
35
@override
30
36
void initState () {
@@ -49,13 +55,26 @@ class ReceiveTransactionScreenState extends State<ReceiveTransactionScreen>
49
55
return [
50
56
PaddedButton (
51
57
padding: EdgeInsets .zero,
52
- text: 'Copy selected address' ,
58
+ text: copyText ,
53
59
type: 'primary' ,
54
- enabled: true ,
55
- onPressed: () => {
56
- Clipboard .setData (
57
- ClipboardData (text: selectedAccount? .address ?? '' ))
58
- }),
60
+ enabled: enableButton,
61
+ isLoading: isLoading,
62
+ onPressed: () async {
63
+ await Clipboard .setData (
64
+ ClipboardData (text: selectedAccount? .address ?? '' ));
65
+ if (await Clipboard .hasStrings ()) {
66
+ setState (() {
67
+ enableButton = false ;
68
+ isLoading = true ;
69
+ });
70
+ Timer (Duration (milliseconds: 400 ), () {
71
+ setState (() {
72
+ enableButton = true ;
73
+ isLoading = false ;
74
+ });
75
+ });
76
+ }
77
+ }),
59
78
// TODO: Implement generate new address
60
79
// PaddedButton(
61
80
// padding: EdgeInsets.only(bottom: 8),
You can’t perform that action at this time.
0 commit comments