Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
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
vjrj
ginkgo
Commits
bb49ff33
Commit
bb49ff33
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Improved font in tx
parent
889edc8f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ui/widgets/fourth_screen/transaction_item.dart
+45
-33
45 additions, 33 deletions
lib/ui/widgets/fourth_screen/transaction_item.dart
with
45 additions
and
33 deletions
lib/ui/widgets/fourth_screen/transaction_item.dart
+
45
−
33
View file @
bb49ff33
...
@@ -19,17 +19,16 @@ import '../../ui_helpers.dart';
...
@@ -19,17 +19,16 @@ import '../../ui_helpers.dart';
import
'../third_screen/contact_form_dialog.dart'
;
import
'../third_screen/contact_form_dialog.dart'
;
class
TransactionListItem
extends
StatelessWidget
{
class
TransactionListItem
extends
StatelessWidget
{
const
TransactionListItem
(
const
TransactionListItem
({
super
.
key
,
{
super
.
key
,
required
this
.
pubKey
,
required
this
.
pubKey
,
required
this
.
transaction
,
required
this
.
transaction
,
required
this
.
index
,
required
this
.
index
,
required
this
.
isG1
,
required
this
.
isG1
,
required
this
.
currentUd
,
required
this
.
currentUd
,
required
this
.
currentSymbol
,
required
this
.
currentSymbol
,
required
this
.
isCurrencyBefore
,
required
this
.
isCurrencyBefore
,
this
.
afterCancel
,
this
.
afterCancel
,
this
.
afterRetry
});
this
.
afterRetry
});
final
String
pubKey
;
final
String
pubKey
;
final
Transaction
transaction
;
final
Transaction
transaction
;
...
@@ -99,12 +98,14 @@ class TransactionListItem extends StatelessWidget {
...
@@ -99,12 +98,14 @@ class TransactionListItem extends StatelessWidget {
final
ContactsCubit
contactsCubit
=
context
.
read
<
ContactsCubit
>();
final
ContactsCubit
contactsCubit
=
context
.
read
<
ContactsCubit
>();
const
double
txFontSize
=
14.0
;
return
Slidable
(
return
Slidable
(
// Specify a key if the Slidable is dismissible.
// Specify a key if the Slidable is dismissible.
key:
ValueKey
<
int
>(
index
),
key:
ValueKey
<
int
>(
index
),
// The end action pane is the one at the right or the bottom side.
// The end action pane is the one at the right or the bottom side.
startActionPane:
startActionPane:
ActionPane
(
motion:
const
ScrollMotion
(),
children:
<
SlidableAction
>[
ActionPane
(
motion:
const
ScrollMotion
(),
children:
<
SlidableAction
>[
if
(
transaction
.
isPending
)
if
(
transaction
.
isPending
)
SlidableAction
(
SlidableAction
(
onPressed:
(
BuildContext
c
)
{
onPressed:
(
BuildContext
c
)
{
...
@@ -128,11 +129,13 @@ class TransactionListItem extends StatelessWidget {
...
@@ -128,11 +129,13 @@ class TransactionListItem extends StatelessWidget {
SlidableAction
(
SlidableAction
(
onPressed:
(
BuildContext
c
)
async
{
onPressed:
(
BuildContext
c
)
async
{
context
.
read
<
PaymentCubit
>()
.
selectUser
(
context
.
read
<
PaymentCubit
>()
.
selectUser
(
transaction
.
to
,
transaction
.
to
,
);
);
context
.
read
<
BottomNavCubit
>()
.
updateIndex
(
0
);
context
.
read
<
BottomNavCubit
>()
.
updateIndex
(
0
);
},
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
foregroundColor:
Colors
.
white
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
replay
,
icon:
Icons
.
replay
,
label:
tr
(
'pay_again'
),
label:
tr
(
'pay_again'
),
...
@@ -146,7 +149,9 @@ class TransactionListItem extends StatelessWidget {
...
@@ -146,7 +149,9 @@ class TransactionListItem extends StatelessWidget {
onPressed:
(
BuildContext
c
)
async
{
onPressed:
(
BuildContext
c
)
async
{
await
_payAgain
(
context
,
transaction
,
true
);
await
_payAgain
(
context
,
transaction
,
true
);
},
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
foregroundColor:
Colors
.
white
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
replay
,
icon:
Icons
.
replay
,
label:
tr
(
'retry_payment'
),
label:
tr
(
'retry_payment'
),
...
@@ -156,7 +161,9 @@ class TransactionListItem extends StatelessWidget {
...
@@ -156,7 +161,9 @@ class TransactionListItem extends StatelessWidget {
onPressed:
(
BuildContext
c
)
async
{
onPressed:
(
BuildContext
c
)
async
{
await
_payAgain
(
context
,
transaction
,
true
);
await
_payAgain
(
context
,
transaction
,
true
);
},
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
foregroundColor:
Colors
.
white
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
replay
,
icon:
Icons
.
replay
,
label:
tr
(
'retry_payment'
),
label:
tr
(
'retry_payment'
),
...
@@ -185,7 +192,9 @@ class TransactionListItem extends StatelessWidget {
...
@@ -185,7 +192,9 @@ class TransactionListItem extends StatelessWidget {
},
},
);
);
},
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColor
,
backgroundColor:
Theme
.
of
(
context
)
.
primaryColor
,
foregroundColor:
Colors
.
white
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
contacts
,
icon:
Icons
.
contacts
,
label:
tr
(
'add_contact'
),
label:
tr
(
'add_contact'
),
...
@@ -201,11 +210,11 @@ class TransactionListItem extends StatelessWidget {
...
@@ -201,11 +210,11 @@ class TransactionListItem extends StatelessWidget {
child:
ListTile
(
child:
ListTile
(
leading:
(
icon
!=
null
)
leading:
(
icon
!=
null
)
?
Padding
(
?
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
16
,
0
,
16
),
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
16
,
0
,
16
),
child:
Icon
(
child:
Icon
(
icon
,
icon
,
color:
iconColor
,
color:
iconColor
,
))
))
:
null
,
:
null
,
tileColor:
tileColor
(
index
,
context
),
tileColor:
tileColor
(
index
,
context
),
title:
Row
(
title:
Row
(
...
@@ -236,7 +245,7 @@ class TransactionListItem extends StatelessWidget {
...
@@ -236,7 +245,7 @@ class TransactionListItem extends StatelessWidget {
myPubKey
,
transaction
.
to
)
myPubKey
,
transaction
.
to
)
}),
}),
style:
const
TextStyle
(
style:
const
TextStyle
(
fontSize:
14.0
,
fontSize:
txFontSize
,
// fontWeight: FontWeight.bold,
// fontWeight: FontWeight.bold,
),
),
),
),
...
@@ -264,21 +273,22 @@ class TransactionListItem extends StatelessWidget {
...
@@ -264,21 +273,22 @@ class TransactionListItem extends StatelessWidget {
Text
.
rich
(
TextSpan
(
Text
.
rich
(
TextSpan
(
children:
<
InlineSpan
>[
children:
<
InlineSpan
>[
if
(
isCurrencyBefore
)
if
(
isCurrencyBefore
)
currencyBalanceWidget
(
isG1
,
currentSymbol
),
currencyBalanceWidget
(
isG1
,
currentSymbol
,
txFontSize
),
if
(
isCurrencyBefore
)
separatorSpan
(),
if
(
isCurrencyBefore
)
separatorSpan
(),
TextSpan
(
TextSpan
(
text:
amountS
,
text:
amountS
,
style:
TextStyle
(
style:
TextStyle
(
// fontWeight: FontWeight.bold,
// fontWeight: FontWeight.bold,
fontSize:
txFontSize
,
color:
transaction
.
type
==
TransactionType
.
received
||
color:
transaction
.
type
==
TransactionType
.
received
||
transaction
.
type
==
TransactionType
.
receiving
transaction
.
type
==
TransactionType
.
receiving
?
positiveAmountColor
?
positiveAmountColor
:
negativeAmountColor
,
:
negativeAmountColor
,
),
),
),
),
if
(
!
isCurrencyBefore
)
separatorSpan
(),
if
(
!
isCurrencyBefore
)
separatorSpan
(),
if
(
!
isCurrencyBefore
)
if
(
!
isCurrencyBefore
)
currencyBalanceWidget
(
isG1
,
currentSymbol
)
,
currencyBalanceWidget
(
isG1
,
currentSymbol
,
txFontSize
)
],
],
)),
)),
const
SizedBox
(
height:
4.0
),
const
SizedBox
(
height:
4.0
),
...
@@ -298,14 +308,14 @@ class TransactionListItem extends StatelessWidget {
...
@@ -298,14 +308,14 @@ class TransactionListItem extends StatelessWidget {
)));
)));
}
}
Future
<
void
>
_payAgain
(
Future
<
void
>
_payAgain
(
BuildContext
context
,
Transaction
transaction
,
BuildContext
context
,
Transaction
transaction
,
bool
isRetry
)
async
{
bool
isRetry
)
async
{
final
double
amount
=
transaction
.
amount
.
abs
();
// positive
final
double
amount
=
transaction
.
amount
.
abs
();
// positive
await
payWithRetry
(
await
payWithRetry
(
context:
context
,
context:
context
,
to:
transaction
.
to
,
to:
transaction
.
to
,
amount:
amount:
isG1
?
amount
/
100
:
((
amount
/
currentUd
)
/
100
)
.
toPrecision
(
3
),
isG1
?
amount
/
100
:
((
amount
/
currentUd
)
/
100
)
.
toPrecision
(
3
),
comment:
transaction
.
comment
,
comment:
transaction
.
comment
,
isG1:
isG1
,
isG1:
isG1
,
currentUd:
currentUd
,
currentUd:
currentUd
,
...
@@ -315,11 +325,13 @@ class TransactionListItem extends StatelessWidget {
...
@@ -315,11 +325,13 @@ class TransactionListItem extends StatelessWidget {
}
}
}
}
InlineSpan
currencyBalanceWidget
(
bool
isG1
,
String
currentSymbol
)
{
InlineSpan
currencyBalanceWidget
(
bool
isG1
,
String
currentSymbol
,
double
txFontSize
)
{
return
TextSpan
(
children:
<
InlineSpan
>[
return
TextSpan
(
children:
<
InlineSpan
>[
TextSpan
(
TextSpan
(
text:
currentSymbol
,
text:
currentSymbol
,
style:
const
TextStyle
(
style:
TextStyle
(
fontSize:
txFontSize
,
color:
grey
,
color:
grey
,
),
),
),
),
...
...
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