Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğecko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
Ğecko
Commits
ad001952
Commit
ad001952
authored
2 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
improve payment popup
parent
d76ad9b7
No related branches found
No related tags found
1 merge request
!31
Drag n drop wallets transfert
Pipeline
#17158
waiting for manual action
Stage: format
Stage: build_and_test
Stage: package
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/screens/wallet_view.dart
+73
-48
73 additions, 48 deletions
lib/screens/wallet_view.dart
with
73 additions
and
48 deletions
lib/screens/wallet_view.dart
+
73
−
48
View file @
ad001952
...
@@ -419,6 +419,43 @@ void paymentPopup(BuildContext context, String toAddress) {
...
@@ -419,6 +419,43 @@ void paymentPopup(BuildContext context, String toAddress) {
final
udValue
=
sub
.
udValue
;
final
udValue
=
sub
.
udValue
;
final
double
balanceRatio
=
isUdUnit
?
round
(
udValue
/
100
,
6
)
:
1
;
final
double
balanceRatio
=
isUdUnit
?
round
(
udValue
/
100
,
6
)
:
1
;
final
toWalletData
=
myWalletProvider
.
getWalletDataByAddress
(
toAddress
);
Future
executeTransfert
()
async
{
String
?
pin
;
if
(
myWalletProvider
.
pinCode
==
''
)
{
pin
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
homeContext
)
{
return
UnlockingWallet
(
wallet:
defaultWallet
);
},
),
);
}
log
.
d
(
pin
);
if
(
pin
!=
null
||
myWalletProvider
.
pinCode
!=
''
)
{
// Payment workflow !
WalletsProfilesProvider
walletViewProvider
=
Provider
.
of
<
WalletsProfilesProvider
>(
context
,
listen:
false
);
SubstrateSdk
sub
=
Provider
.
of
<
SubstrateSdk
>(
context
,
listen:
false
);
final
acc
=
sub
.
getCurrentWallet
();
log
.
d
(
"fromAddress:
${acc.address!}
,destAddress:
$toAddress
, amount:
${double.parse(walletViewProvider.payAmount.text)}
, password:
$pin
"
);
sub
.
pay
(
fromAddress:
acc
.
address
!
,
destAddress:
toAddress
,
amount:
double
.
parse
(
walletViewProvider
.
payAmount
.
text
),
password:
pin
??
myWalletProvider
.
pinCode
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
return
const
TransactionInProgress
();
}),
);
}
}
showModalBottomSheet
<
void
>(
showModalBottomSheet
<
void
>(
shape:
const
RoundedRectangleBorder
(
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
only
(
borderRadius:
BorderRadius
.
only
(
...
@@ -452,7 +489,7 @@ void paymentPopup(BuildContext context, String toAddress) {
...
@@ -452,7 +489,7 @@ void paymentPopup(BuildContext context, String toAddress) {
padding:
EdgeInsets
.
only
(
padding:
EdgeInsets
.
only
(
bottom:
MediaQuery
.
of
(
context
)
.
viewInsets
.
bottom
),
bottom:
MediaQuery
.
of
(
context
)
.
viewInsets
.
bottom
),
child:
Container
(
child:
Container
(
height:
4
0
0
,
height:
4
2
0
,
decoration:
const
ShapeDecoration
(
decoration:
const
ShapeDecoration
(
color:
Color
(
0xffffeed1
),
color:
Color
(
0xffffeed1
),
shape:
RoundedRectangleBorder
(
shape:
RoundedRectangleBorder
(
...
@@ -537,9 +574,36 @@ void paymentPopup(BuildContext context, String toAddress) {
...
@@ -537,9 +574,36 @@ void paymentPopup(BuildContext context, String toAddress) {
),
),
);
);
}),
}),
const
Spacer
(),
const
SizedBox
(
height:
12
),
Row
(
// const SizedBox(height: 10),
children:
[
Text
(
'to'
.
tr
(),
style:
TextStyle
(
fontSize:
19
,
fontWeight:
FontWeight
.
w500
,
color:
Colors
.
grey
[
600
]),
),
const
SizedBox
(
width:
10
),
// const Spacer(flex: 1),
Column
(
children:
[
const
SizedBox
(
height:
2
),
Text
(
toWalletData
==
null
?
getShortPubkey
(
toAddress
)
:
toWalletData
.
name
!
,
style:
const
TextStyle
(
fontSize:
21
,
fontWeight:
FontWeight
.
w600
,
),
),
// const Spacer(flex: 2),
],
),
],
),
const
SizedBox
(
height:
12
),
Text
(
Text
(
'amount'
.
tr
(),
'amount'
.
tr
(),
style:
TextStyle
(
style:
TextStyle
(
...
@@ -549,6 +613,9 @@ void paymentPopup(BuildContext context, String toAddress) {
...
@@ -549,6 +613,9 @@ void paymentPopup(BuildContext context, String toAddress) {
),
),
const
SizedBox
(
height:
10
),
const
SizedBox
(
height:
10
),
TextField
(
TextField
(
textInputAction:
TextInputAction
.
done
,
onEditingComplete:
()
async
=
>
canValidate
?
await
executeTransfert
()
:
null
,
key:
keyAmountField
,
key:
keyAmountField
,
controller:
walletViewProvider
.
payAmount
,
controller:
walletViewProvider
.
payAmount
,
autofocus:
true
,
autofocus:
true
,
...
@@ -577,7 +644,6 @@ void paymentPopup(BuildContext context, String toAddress) {
...
@@ -577,7 +644,6 @@ void paymentPopup(BuildContext context, String toAddress) {
// borderSide:
// borderSide:
// BorderSide(color: Colors.grey[500], width: 2),
// BorderSide(color: Colors.grey[500], width: 2),
// borderRadius: BorderRadius.circular(8)),
// borderRadius: BorderRadius.circular(8)),
focusedBorder:
OutlineInputBorder
(
focusedBorder:
OutlineInputBorder
(
borderSide:
borderSide:
BorderSide
(
color:
Colors
.
grey
[
500
]
!
,
width:
2
),
BorderSide
(
color:
Colors
.
grey
[
500
]
!
,
width:
2
),
...
@@ -586,7 +652,7 @@ void paymentPopup(BuildContext context, String toAddress) {
...
@@ -586,7 +652,7 @@ void paymentPopup(BuildContext context, String toAddress) {
contentPadding:
const
EdgeInsets
.
all
(
20
),
contentPadding:
const
EdgeInsets
.
all
(
20
),
),
),
style:
const
TextStyle
(
style:
const
TextStyle
(
fontSize:
40
,
fontSize:
35
,
color:
Colors
.
black
,
color:
Colors
.
black
,
fontWeight:
FontWeight
.
w600
,
fontWeight:
FontWeight
.
w600
,
),
),
...
@@ -603,48 +669,7 @@ void paymentPopup(BuildContext context, String toAddress) {
...
@@ -603,48 +669,7 @@ void paymentPopup(BuildContext context, String toAddress) {
backgroundColor:
orangeC
,
// foreground
backgroundColor:
orangeC
,
// foreground
),
),
onPressed:
canValidate
onPressed:
canValidate
?
()
async
{
?
()
async
=
>
await
executeTransfert
()
String
?
pin
;
if
(
myWalletProvider
.
pinCode
==
''
)
{
pin
=
await
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
homeContext
)
{
return
UnlockingWallet
(
wallet:
defaultWallet
);
},
),
);
}
log
.
d
(
pin
);
if
(
pin
!=
null
||
myWalletProvider
.
pinCode
!=
''
)
{
// Payment workflow !
WalletsProfilesProvider
walletViewProvider
=
Provider
.
of
<
WalletsProfilesProvider
>(
context
,
listen:
false
);
SubstrateSdk
sub
=
Provider
.
of
<
SubstrateSdk
>(
context
,
listen:
false
);
final
acc
=
sub
.
getCurrentWallet
();
log
.
d
(
"fromAddress:
${acc.address!}
,destAddress:
$toAddress
, amount:
${double.parse(walletViewProvider.payAmount.text)}
, password:
$pin
"
);
sub
.
pay
(
fromAddress:
acc
.
address
!
,
destAddress:
toAddress
,
amount:
double
.
parse
(
walletViewProvider
.
payAmount
.
text
),
password:
pin
??
myWalletProvider
.
pinCode
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
{
return
const
TransactionInProgress
();
}),
);
}
}
:
null
,
:
null
,
child:
Text
(
child:
Text
(
'executeTheTransfer'
.
tr
(),
'executeTheTransfer'
.
tr
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment