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
Fred
ginkgo
Commits
7fa0b900
Commit
7fa0b900
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Allow edit contacts
parent
a9a8d979
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ui/widgets/first_screen/pay_contact_search_page.dart
+2
-2
2 additions, 2 deletions
lib/ui/widgets/first_screen/pay_contact_search_page.dart
lib/ui/widgets/third_screen/contact_form.dart
+86
-0
86 additions, 0 deletions
lib/ui/widgets/third_screen/contact_form.dart
with
88 additions
and
2 deletions
lib/ui/widgets/first_screen/pay_contact_search_page.dart
+
2
−
2
View file @
7fa0b900
...
...
@@ -223,11 +223,11 @@ class _PayContactSearchPageState extends State<PayContactSearchPage> {
contact
,
index
,
context
,
()
{
onTap:
()
{
context
.
read
<
PaymentCubit
>()
.
selectUser
(
contact
);
Navigator
.
pop
(
context
);
},
BlocBuilder
<
ContactsCubit
,
ContactsState
>(
trailing:
BlocBuilder
<
ContactsCubit
,
ContactsState
>(
builder:
(
BuildContext
context
,
ContactsState
state
)
{
final
ContactsCubit
contactsCubit
=
context
.
read
<
ContactsCubit
>();
final
bool
isFavorite
=
contactsCubit
.
isContact
(
contact
.
pubKey
);
...
...
This diff is collapsed.
Click to expand it.
lib/ui/widgets/third_screen/contact_form.dart
0 → 100644
+
86
−
0
View file @
7fa0b900
import
'package:easy_localization/easy_localization.dart'
;
import
'package:flutter/material.dart'
;
import
'../../../data/models/contact.dart'
;
import
'../../ui_helpers.dart'
;
class
ContactEditDialog
extends
StatefulWidget
{
const
ContactEditDialog
(
{
super
.
key
,
required
this
.
contact
,
required
this
.
onSave
});
final
Contact
contact
;
final
Function
(
Contact
)
onSave
;
@override
State
<
ContactEditDialog
>
createState
()
=
>
_ContactEditDialogState
();
}
class
_ContactEditDialogState
extends
State
<
ContactEditDialog
>
{
final
GlobalKey
<
FormState
>
_formKey
=
GlobalKey
<
FormState
>();
late
Contact
_updatedContact
;
@override
void
initState
()
{
super
.
initState
();
_updatedContact
=
widget
.
contact
;
}
@override
Widget
build
(
BuildContext
context
)
{
return
AlertDialog
(
title:
Text
(
tr
(
'form_contact_title'
)),
content:
Form
(
key:
_formKey
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
TextFormField
(
initialValue:
humanizePubKey
(
_updatedContact
.
pubKey
),
decoration:
InputDecoration
(
labelText:
tr
(
'form_contact_pub_key'
),
),
enabled:
false
,
),
TextFormField
(
initialValue:
_updatedContact
.
name
,
decoration:
const
InputDecoration
(
labelText:
'Name'
),
validator:
(
String
?
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
tr
(
'form_contact_name_validation'
);
}
return
null
;
},
onChanged:
(
String
?
value
)
{
_updatedContact
=
_updatedContact
.
copyWith
(
name:
value
);
},
),
TextFormField
(
initialValue:
_updatedContact
.
notes
,
decoration:
InputDecoration
(
labelText:
tr
(
'form_contact_notes'
)),
onChanged:
(
String
?
value
)
{
_updatedContact
=
_updatedContact
.
copyWith
(
notes:
value
);
},
),
],
),
),
actions:
<
Widget
>[
TextButton
(
onPressed:
()
{
Navigator
.
of
(
context
)
.
pop
();
},
child:
Text
(
tr
(
'cancel'
)),
),
TextButton
(
onPressed:
()
{
if
(
_formKey
.
currentState
!.
validate
())
{
widget
.
onSave
(
_updatedContact
);
Navigator
.
of
(
context
)
.
pop
();
}
},
child:
Text
(
tr
(
'form_save'
)),
),
],
);
}
}
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