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
63c71fed
Commit
63c71fed
authored
2 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
feat: Edit wallet name in popup
parent
9ec7a659
No related branches found
No related tags found
No related merge requests found
Pipeline
#16031
failed
2 years ago
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/providers/wallet_options.dart
+106
-19
106 additions, 19 deletions
lib/providers/wallet_options.dart
lib/screens/myWallets/wallet_options.dart
+5
-3
5 additions, 3 deletions
lib/screens/myWallets/wallet_options.dart
with
111 additions
and
22 deletions
lib/providers/wallet_options.dart
+
106
−
19
View file @
63c71fed
...
@@ -23,6 +23,7 @@ class WalletOptionsProvider with ChangeNotifier {
...
@@ -23,6 +23,7 @@ class WalletOptionsProvider with ChangeNotifier {
FocusNode
walletNameFocus
=
FocusNode
();
FocusNode
walletNameFocus
=
FocusNode
();
TextEditingController
nameController
=
TextEditingController
();
TextEditingController
nameController
=
TextEditingController
();
late
bool
isDefaultWallet
;
late
bool
isDefaultWallet
;
bool
canValidateNameBool
=
false
;
Future
<
NewWallet
>
?
get
badWallet
=
>
null
;
Future
<
NewWallet
>
?
get
badWallet
=
>
null
;
...
@@ -41,25 +42,6 @@ class WalletOptionsProvider with ChangeNotifier {
...
@@ -41,25 +42,6 @@ class WalletOptionsProvider with ChangeNotifier {
_newWalletName
.
text
=
''
;
_newWalletName
.
text
=
''
;
}
}
bool
editWalletName
(
List
<
int
?
>
_wID
,
{
bool
?
isCesium
})
{
bool
nameState
;
if
(
isEditing
)
{
if
(
!
nameController
.
text
.
contains
(
':'
)
&&
nameController
.
text
.
length
<
=
39
)
{
_renameWallet
(
_wID
,
nameController
.
text
,
isCesium:
isCesium
!
);
nameState
=
true
;
}
else
{
nameState
=
false
;
}
}
else
{
nameState
=
true
;
}
isEditing
?
isEditing
=
false
:
isEditing
=
true
;
notifyListeners
();
return
nameState
;
}
Future
<
int
>
deleteWallet
(
context
,
WalletData
wallet
)
async
{
Future
<
int
>
deleteWallet
(
context
,
WalletData
wallet
)
async
{
SubstrateSdk
_sub
=
Provider
.
of
<
SubstrateSdk
>(
context
,
listen:
false
);
SubstrateSdk
_sub
=
Provider
.
of
<
SubstrateSdk
>(
context
,
listen:
false
);
final
bool
?
_answer
=
await
(
confirmPopup
(
context
,
final
bool
?
_answer
=
await
(
confirmPopup
(
context
,
...
@@ -290,6 +272,111 @@ class WalletOptionsProvider with ChangeNotifier {
...
@@ -290,6 +272,111 @@ class WalletOptionsProvider with ChangeNotifier {
);
);
}
}
Future
<
String
?
>
editWalletName
(
BuildContext
context
,
List
<
int
?
>
_wID
)
async
{
TextEditingController
walletName
=
TextEditingController
();
canValidateNameBool
=
false
;
return
showDialog
<
String
>(
context:
context
,
barrierDismissible:
true
,
builder:
(
BuildContext
context
)
{
return
AlertDialog
(
title:
const
Text
(
'Choisissez un nouveau nom
\n
pour votre portefeuille :'
,
textAlign:
TextAlign
.
center
,
style:
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
w500
),
),
content:
SizedBox
(
height:
100
,
child:
Column
(
children:
[
const
SizedBox
(
height:
20
),
TextField
(
onChanged:
(
_
)
=
>
canValidateName
(
context
,
walletName
),
textAlign:
TextAlign
.
center
,
autofocus:
true
,
controller:
walletName
,
style:
const
TextStyle
(
fontSize:
19
),
)
]),
),
actions:
<
Widget
>[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Consumer
<
WalletOptionsProvider
>(
builder:
(
context
,
_wOptions
,
_
)
{
return
TextButton
(
key:
const
Key
(
'infoPopup'
),
child:
Text
(
"Valider"
,
style:
TextStyle
(
fontSize:
21
,
color:
canValidateNameBool
?
const
Color
(
0xffD80000
)
:
Colors
.
grey
,
fontWeight:
FontWeight
.
w600
,
),
),
onPressed:
()
async
{
if
(
canValidateNameBool
)
{
nameController
.
text
=
walletName
.
text
;
_renameWallet
(
_wID
,
walletName
.
text
,
isCesium:
false
);
// notifyListeners();
Navigator
.
pop
(
context
);
}
},
);
})
],
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
TextButton
(
key:
const
Key
(
'cancel'
),
child:
Text
(
"Annuler"
,
style:
TextStyle
(
fontSize:
18
,
color:
Colors
.
grey
[
800
],
fontWeight:
FontWeight
.
w300
),
),
onPressed:
()
async
{
Navigator
.
pop
(
context
);
},
)
],
),
const
SizedBox
(
height:
20
)
],
);
},
);
}
bool
canValidateName
(
BuildContext
context
,
TextEditingController
walletName
)
{
MyWalletsProvider
_myWalletProvider
=
Provider
.
of
<
MyWalletsProvider
>(
context
,
listen:
false
);
bool
isNameValid
=
walletName
.
text
.
length
>
=
2
&&
!
walletName
.
text
.
contains
(
':'
)
&&
walletName
.
text
.
length
<
=
39
;
if
(
isNameValid
)
{
for
(
var
wallet
in
_myWalletProvider
.
listWallets
)
{
if
(
walletName
.
text
==
wallet
.
name
!
)
{
canValidateNameBool
=
false
;
break
;
}
canValidateNameBool
=
true
;
}
}
else
{
canValidateNameBool
=
false
;
}
notifyListeners
();
return
canValidateNameBool
;
}
void
reloadBuild
()
{
void
reloadBuild
()
{
notifyListeners
();
notifyListeners
();
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/screens/myWallets/wallet_options.dart
+
5
−
3
View file @
63c71fed
...
@@ -100,7 +100,8 @@ class WalletOptions extends StatelessWidget {
...
@@ -100,7 +100,8 @@ class WalletOptions extends StatelessWidget {
Column
(
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
walletName
(
walletProvider
,
_walletOptions
),
walletName
(
context
,
walletProvider
,
_walletOptions
),
SizedBox
(
height:
isTall
?
5
:
0
),
SizedBox
(
height:
isTall
?
5
:
0
),
// SizedBox(height: isTall ? 5 : 0),
// SizedBox(height: isTall ? 5 : 0),
balance
(
balance
(
...
@@ -246,7 +247,7 @@ class WalletOptions extends StatelessWidget {
...
@@ -246,7 +247,7 @@ class WalletOptions extends StatelessWidget {
);
);
}
}
Widget
walletName
(
WalletOptionsProvider
walletProvider
,
Widget
walletName
(
BuildContext
context
,
WalletOptionsProvider
walletProvider
,
WalletOptionsProvider
_walletOptions
)
{
WalletOptionsProvider
_walletOptions
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
_walletOptions
.
nameController
.
text
=
wallet
.
name
!
;
_walletOptions
.
nameController
.
text
=
wallet
.
name
!
;
...
@@ -284,7 +285,8 @@ class WalletOptions extends StatelessWidget {
...
@@ -284,7 +285,8 @@ class WalletOptions extends StatelessWidget {
key:
const
Key
(
'renameWallet'
),
key:
const
Key
(
'renameWallet'
),
onTap:
()
async
{
onTap:
()
async
{
// _isNewNameValid =
// _isNewNameValid =
walletProvider
.
editWalletName
(
wallet
.
id
(),
isCesium:
false
);
// walletProvider.editWalletName(wallet.id(), isCesium: false);
await
walletProvider
.
editWalletName
(
context
,
wallet
.
id
());
await
Future
.
delayed
(
const
Duration
(
milliseconds:
30
));
await
Future
.
delayed
(
const
Duration
(
milliseconds:
30
));
walletProvider
.
walletNameFocus
.
requestFocus
();
walletProvider
.
walletNameFocus
.
requestFocus
();
},
},
...
...
This diff is collapsed.
Click to expand it.
poka
@pokapow
mentioned in issue
#4 (closed)
·
2 years ago
mentioned in issue
#4 (closed)
mentioned in issue #4
Toggle commit list
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