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
7514eb72
Commit
7514eb72
authored
1 year ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
wip: highlight wallet with status in safe wallet list
parent
b916c44d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#34347
waiting for manual action
Stage: format
Stage: build_and_test
Stage: package
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/screens/myWallets/wallets_home.dart
+13
-100
13 additions, 100 deletions
lib/screens/myWallets/wallets_home.dart
lib/widgets/wallet_tile.dart
+98
-13
98 additions, 13 deletions
lib/widgets/wallet_tile.dart
lib/widgets/wallet_tile_membre.dart
+209
-0
209 additions, 0 deletions
lib/widgets/wallet_tile_membre.dart
with
320 additions
and
113 deletions
lib/screens/myWallets/wallets_home.dart
+
13
−
100
View file @
7514eb72
...
...
@@ -10,15 +10,14 @@ import 'package:gecko/providers/my_wallets.dart';
import
'package:gecko/models/wallet_data.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gecko/providers/substrate_sdk.dart'
;
import
'package:gecko/providers/wallet_options.dart'
;
import
'package:gecko/screens/myWallets/chest_options.dart'
;
import
'package:gecko/screens/myWallets/import_g1_v1.dart'
;
import
'package:gecko/screens/myWallets/unlocking_wallet.dart'
;
import
'package:gecko/widgets/balance.dart'
;
import
'package:gecko/widgets/bottom_app_bar.dart'
;
import
'package:gecko/widgets/commons/offline_info.dart'
;
import
'package:gecko/widgets/payment_popup.dart'
;
import
'package:gecko/widgets/wallet_tile.dart'
;
import
'package:gecko/widgets/wallet_tile_membre.dart'
;
import
'package:provider/provider.dart'
;
import
'package:flutter_svg/flutter_svg.dart'
;
import
'package:tutorial_coach_mark/tutorial_coach_mark.dart'
;
...
...
@@ -224,8 +223,6 @@ class _WalletsHomeState extends State<WalletsHome> {
Widget
myWalletsTiles
(
BuildContext
context
,
int
currentChestNumber
)
{
final
myWalletProvider
=
Provider
.
of
<
MyWalletsProvider
>(
context
);
final
walletOptions
=
Provider
.
of
<
WalletOptionsProvider
>(
context
,
listen:
false
);
final
bool
isWalletsExists
=
myWalletProvider
.
checkIfWalletExist
();
final
sub
=
Provider
.
of
<
SubstrateSdk
>(
context
,
listen:
false
);
...
...
@@ -250,6 +247,13 @@ class _WalletsHomeState extends State<WalletsHome> {
return
Comparable
.
compare
(
p1
.
number
!
,
p2
.
number
!
);
});
// Get first wallet with identity
final
idtyWallet
=
listWallets
.
firstWhere
(
(
w
)
=
>
w
.
hasIdentity
(),
orElse:
()
=
>
WalletData
(
address:
''
),
);
listWallets
.
removeWhere
((
w
)
=
>
w
.
address
==
idtyWallet
.
address
);
WalletData
?
defaultWallet
=
myWalletProvider
.
getDefaultWallet
();
final
screenWidth
=
MediaQuery
.
of
(
context
)
.
size
.
width
;
int
nTule
;
...
...
@@ -303,6 +307,10 @@ class _WalletsHomeState extends State<WalletsHome> {
return
CustomScrollView
(
slivers:
<
Widget
>[
const
SliverToBoxAdapter
(
child:
SizedBox
(
height:
20
)),
if
(
idtyWallet
.
address
!=
''
)
SliverToBoxAdapter
(
child:
WalletTileMembre
(
repository:
idtyWallet
,
defaultWallet:
defaultWallet
)),
SliverGrid
.
count
(
key:
keyListWallets
,
crossAxisCount:
nTule
,
...
...
@@ -366,10 +374,7 @@ class _WalletsHomeState extends State<WalletsHome> {
List
<
dynamic
>
rejected
,
)
{
return
WalletTile
(
repository:
repository
,
walletOptions:
walletOptions
,
defaultWallet:
defaultWallet
,
currentChestNumber:
currentChestNumber
);
repository:
repository
,
defaultWallet:
defaultWallet
);
}),
),
Consumer
<
SubstrateSdk
>(
builder:
(
context
,
sub
,
_
)
{
...
...
@@ -443,95 +448,3 @@ class _WalletsHomeState extends State<WalletsHome> {
])));
}
}
class
BalanceBuilder
extends
StatelessWidget
{
const
BalanceBuilder
({
Key
?
key
,
required
this
.
address
,
required
this
.
isDefault
,
})
:
super
(
key:
key
);
final
String
address
;
final
bool
isDefault
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
color:
isDefault
?
orangeC
:
yellowC
,
child:
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
5
,
right:
5
,
top:
38
,
bottom:
10
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Opacity
(
opacity:
0.7
,
child:
Balance
(
address:
address
,
size:
16
,
color:
isDefault
?
Colors
.
white
:
Colors
.
black
,
loadingColor:
isDefault
?
yellowC
:
orangeC
),
)
],
)),
);
}
}
class
CustomClipperOval
extends
CustomClipper
<
Rect
>
{
@override
Rect
getClip
(
Size
size
)
{
return
Rect
.
fromCircle
(
center:
Offset
(
size
.
width
/
2
,
size
.
width
/
2
),
radius:
size
.
width
/
2
+
3
);
}
@override
bool
shouldReclip
(
CustomClipper
<
Rect
>
oldClipper
)
{
return
false
;
}
}
class
ClipOvalShadow
extends
StatelessWidget
{
final
Shadow
shadow
;
final
CustomClipper
<
Rect
>
clipper
;
final
Widget
child
;
const
ClipOvalShadow
({
Key
?
key
,
required
this
.
shadow
,
required
this
.
clipper
,
required
this
.
child
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
CustomPaint
(
painter:
_ClipOvalShadowPainter
(
clipper:
clipper
,
shadow:
shadow
,
),
child:
ClipRect
(
clipper:
clipper
,
child:
child
),
);
}
}
class
_ClipOvalShadowPainter
extends
CustomPainter
{
final
Shadow
shadow
;
final
CustomClipper
<
Rect
>
clipper
;
_ClipOvalShadowPainter
({
required
this
.
shadow
,
required
this
.
clipper
});
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
var
paint
=
shadow
.
toPaint
();
var
clipRect
=
clipper
.
getClip
(
size
)
.
shift
(
const
Offset
(
0
,
0
));
canvas
.
drawOval
(
clipRect
,
paint
);
}
@override
bool
shouldRepaint
(
CustomPainter
oldDelegate
)
{
return
true
;
}
}
This diff is collapsed.
Click to expand it.
lib/widgets/wallet_tile.dart
+
98
−
13
View file @
7514eb72
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:gecko/globals.dart'
;
import
'package:gecko/models/wallet_data.dart'
;
import
'package:gecko/models/widgets_keys.dart'
;
import
'package:gecko/providers/wallet_options.dart'
;
import
'package:gecko/screens/myWallets/wallet_options.dart'
;
import
'package:gecko/
screens/myWallets/wallets_hom
e.dart'
;
import
'package:gecko/
widgets/balanc
e.dart'
;
import
'package:gecko/widgets/commons/smooth_transition.dart'
;
import
'package:gecko/widgets/name_by_address.dart'
;
class
WalletTile
extends
StatelessWidget
{
const
WalletTile
(
{
Key
?
key
,
required
this
.
repository
,
required
this
.
walletOptions
,
required
this
.
defaultWallet
,
required
this
.
currentChestNumber
})
:
super
(
key:
key
);
const
WalletTile
({
Key
?
key
,
required
this
.
repository
,
required
this
.
defaultWallet
,
})
:
super
(
key:
key
);
final
WalletData
repository
;
final
WalletOptionsProvider
walletOptions
;
final
WalletData
defaultWallet
;
final
int
currentChestNumber
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -31,7 +25,6 @@ class WalletTile extends StatelessWidget {
child:
GestureDetector
(
key:
keyOpenWallet
(
repository
.
address
),
onTap:
()
{
walletOptions
.
getAddress
(
currentChestNumber
,
repository
.
derivation
!
);
Navigator
.
push
(
context
,
SmoothTransition
(
...
...
@@ -121,3 +114,95 @@ class WalletTile extends StatelessWidget {
);
}
}
class
BalanceBuilder
extends
StatelessWidget
{
const
BalanceBuilder
({
Key
?
key
,
required
this
.
address
,
required
this
.
isDefault
,
})
:
super
(
key:
key
);
final
String
address
;
final
bool
isDefault
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
color:
isDefault
?
orangeC
:
yellowC
,
child:
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
5
,
right:
5
,
top:
38
,
bottom:
10
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Opacity
(
opacity:
0.7
,
child:
Balance
(
address:
address
,
size:
16
,
color:
isDefault
?
Colors
.
white
:
Colors
.
black
,
loadingColor:
isDefault
?
yellowC
:
orangeC
),
)
],
)),
);
}
}
class
ClipOvalShadow
extends
StatelessWidget
{
final
Shadow
shadow
;
final
CustomClipper
<
Rect
>
clipper
;
final
Widget
child
;
const
ClipOvalShadow
({
Key
?
key
,
required
this
.
shadow
,
required
this
.
clipper
,
required
this
.
child
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
CustomPaint
(
painter:
_ClipOvalShadowPainter
(
clipper:
clipper
,
shadow:
shadow
,
),
child:
ClipRect
(
clipper:
clipper
,
child:
child
),
);
}
}
class
_ClipOvalShadowPainter
extends
CustomPainter
{
final
Shadow
shadow
;
final
CustomClipper
<
Rect
>
clipper
;
_ClipOvalShadowPainter
({
required
this
.
shadow
,
required
this
.
clipper
});
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
var
paint
=
shadow
.
toPaint
();
var
clipRect
=
clipper
.
getClip
(
size
)
.
shift
(
const
Offset
(
0
,
0
));
canvas
.
drawOval
(
clipRect
,
paint
);
}
@override
bool
shouldRepaint
(
CustomPainter
oldDelegate
)
{
return
true
;
}
}
class
CustomClipperOval
extends
CustomClipper
<
Rect
>
{
@override
Rect
getClip
(
Size
size
)
{
return
Rect
.
fromCircle
(
center:
Offset
(
size
.
width
/
2
,
size
.
width
/
2
),
radius:
size
.
width
/
2
+
3
);
}
@override
bool
shouldReclip
(
CustomClipper
<
Rect
>
oldClipper
)
{
return
false
;
}
}
This diff is collapsed.
Click to expand it.
lib/widgets/wallet_tile_membre.dart
0 → 100644
+
209
−
0
View file @
7514eb72
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:gecko/globals.dart'
;
import
'package:gecko/models/wallet_data.dart'
;
import
'package:gecko/models/widgets_keys.dart'
;
import
'package:gecko/screens/myWallets/wallet_options.dart'
;
import
'package:gecko/widgets/balance.dart'
;
import
'package:gecko/widgets/commons/smooth_transition.dart'
;
import
'package:gecko/widgets/name_by_address.dart'
;
class
WalletTileMembre
extends
StatelessWidget
{
const
WalletTileMembre
({
Key
?
key
,
required
this
.
repository
,
required
this
.
defaultWallet
,
})
:
super
(
key:
key
);
final
WalletData
repository
;
final
WalletData
defaultWallet
;
@override
Widget
build
(
BuildContext
context
)
{
return
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
70
,
vertical:
20
),
child:
GestureDetector
(
key:
keyOpenWallet
(
repository
.
address
),
onTap:
()
{
Navigator
.
push
(
context
,
SmoothTransition
(
page:
WalletOptions
(
wallet:
repository
,
),
),
);
},
child:
SizedBox
(
key:
repository
.
number
==
1
?
keyDragAndDrop
:
const
Key
(
'nothing'
),
height:
240
,
child:
ClipOvalShadow
(
shadow:
const
Shadow
(
color:
Colors
.
transparent
,
offset:
Offset
(
0
,
0
),
blurRadius:
5
,
),
clipper:
CustomClipperOval
(),
child:
ClipRRect
(
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
12
)),
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
Container
(
width:
double
.
infinity
,
height:
double
.
infinity
,
decoration:
const
BoxDecoration
(
gradient:
RadialGradient
(
radius:
0.8
,
colors:
[
Color
.
fromARGB
(
255
,
255
,
255
,
211
),
yellowC
,
],
),
),
child:
repository
.
imageCustomPath
==
null
||
repository
.
imageCustomPath
==
''
?
Image
.
asset
(
'assets/avatars/
${repository.imageDefaultPath}
'
,
alignment:
Alignment
.
bottomCenter
,
scale:
0.5
,
)
:
Container
(
decoration:
BoxDecoration
(
shape:
BoxShape
.
circle
,
color:
Colors
.
transparent
,
image:
DecorationImage
(
fit:
BoxFit
.
fitHeight
,
image:
FileImage
(
File
(
repository
.
imageCustomPath
!
),
),
),
),
),
)),
Stack
(
children:
<
Widget
>[
BalanceBuilder
(
address:
repository
.
address
,
isDefault:
repository
.
address
==
defaultWallet
.
address
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Column
(
children:
[
const
SizedBox
(
height:
7
),
Opacity
(
opacity:
0.7
,
child:
NameByAddress
(
wallet:
repository
,
size:
20
,
color:
defaultWallet
.
address
==
repository
.
address
?
Colors
.
white
:
Colors
.
black
,
fontWeight:
FontWeight
.
w600
,
fontStyle:
FontStyle
.
normal
,
))
],
),
],
),
]),
]),
),
),
),
),
);
}
}
class
BalanceBuilder
extends
StatelessWidget
{
const
BalanceBuilder
({
Key
?
key
,
required
this
.
address
,
required
this
.
isDefault
,
})
:
super
(
key:
key
);
final
String
address
;
final
bool
isDefault
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
color:
isDefault
?
orangeC
:
yellowC
,
child:
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
5
,
right:
5
,
top:
45
,
bottom:
10
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Opacity
(
opacity:
0.7
,
child:
Balance
(
address:
address
,
size:
16
,
color:
isDefault
?
Colors
.
white
:
Colors
.
black
,
loadingColor:
isDefault
?
yellowC
:
orangeC
),
)
],
)),
);
}
}
class
ClipOvalShadow
extends
StatelessWidget
{
final
Shadow
shadow
;
final
CustomClipper
<
Rect
>
clipper
;
final
Widget
child
;
const
ClipOvalShadow
({
Key
?
key
,
required
this
.
shadow
,
required
this
.
clipper
,
required
this
.
child
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
CustomPaint
(
painter:
_ClipOvalShadowPainter
(
clipper:
clipper
,
shadow:
shadow
,
),
child:
ClipRect
(
clipper:
clipper
,
child:
child
),
);
}
}
class
_ClipOvalShadowPainter
extends
CustomPainter
{
final
Shadow
shadow
;
final
CustomClipper
<
Rect
>
clipper
;
_ClipOvalShadowPainter
({
required
this
.
shadow
,
required
this
.
clipper
});
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
var
paint
=
shadow
.
toPaint
();
var
clipRect
=
clipper
.
getClip
(
size
)
.
shift
(
const
Offset
(
0
,
0
));
canvas
.
drawOval
(
clipRect
,
paint
);
}
@override
bool
shouldRepaint
(
CustomPainter
oldDelegate
)
{
return
true
;
}
}
class
CustomClipperOval
extends
CustomClipper
<
Rect
>
{
@override
Rect
getClip
(
Size
size
)
{
return
Rect
.
fromCircle
(
center:
Offset
(
size
.
width
/
2
,
size
.
width
/
2
),
radius:
size
.
width
/
2
+
3
);
}
@override
bool
shouldReclip
(
CustomClipper
<
Rect
>
oldClipper
)
{
return
false
;
}
}
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