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
b32d4806
Commit
b32d4806
authored
2 years ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Allow edit contacts
parent
6c104166
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/third_screen/contacts_page.dart
+84
-54
84 additions, 54 deletions
lib/ui/widgets/third_screen/contacts_page.dart
with
84 additions
and
54 deletions
lib/ui/widgets/third_screen/contacts_page.dart
+
84
−
54
View file @
b32d4806
...
...
@@ -3,6 +3,7 @@ import 'package:easy_localization/easy_localization.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_slidable/flutter_slidable.dart'
;
import
'package:share_plus/share_plus.dart'
;
import
'../../../cubit/bottom_nav_cubit.dart'
;
import
'../../../data/models/contact.dart'
;
...
...
@@ -11,6 +12,7 @@ import '../../../data/models/contact_state.dart';
import
'../../../data/models/payment_cubit.dart'
;
import
'../../ui_helpers.dart'
;
import
'../bottom_widget.dart'
;
import
'contact_form.dart'
;
class
ContactsPage
extends
StatefulWidget
{
const
ContactsPage
({
super
.
key
});
...
...
@@ -64,70 +66,98 @@ class _ContactsPageState extends State<ContactsPage> {
itemBuilder:
(
BuildContext
context
,
int
index
)
{
final
Contact
contact
=
state
.
filteredContacts
[
index
];
return
Slidable
(
// Specify a key if the Slidable is dismissible.
key:
const
ValueKey
<
int
>(
0
),
// Specify a key if the Slidable is dismissible.
key:
const
ValueKey
<
int
>(
0
),
// The start action pane is the one at the left or the top side.
startActionPane:
ActionPane
(
// A motion is a widget used to control how the pane animates.
motion:
const
ScrollMotion
(),
// The start action pane is the one at the left or the top side.
startActionPane:
ActionPane
(
// A motion is a widget used to control how the pane animates.
motion:
const
ScrollMotion
(),
// All actions are defined in the children parameter.
children:
<
SlidableAction
>[
// A SlidableAction can have an icon and/or a label.
SlidableAction
(
onPressed:
(
BuildContext
c
)
{
_contactsCubit
.
removeContact
(
contact
);
},
backgroundColor:
const
Color
(
0xFFFE4A49
),
foregroundColor:
Colors
.
white
,
icon:
Icons
.
delete
,
label:
tr
(
'delete_contact'
),
),
/* SlidableAction(
// All actions are defined in the children parameter.
children:
<
SlidableAction
>[
// A SlidableAction can have an icon and/or a label.
SlidableAction
(
onPressed:
(
BuildContext
c
)
{
_contactsCubit
.
removeContact
(
contact
);
},
backgroundColor:
const
Color
(
0xFFFE4A49
),
foregroundColor:
Colors
.
white
,
icon:
Icons
.
delete
,
label:
tr
(
'delete_contact'
),
),
/* SlidableAction(
onPressed: (BuildContext c) {},
backgroundColor: const Color(0xFF21B7CA),
foregroundColor: Colors.white,
icon: Icons.share,
label: tr('share_contact'),
),*/
],
),
],
),
// The end action pane is the one at the right or the bottom side.
endActionPane:
ActionPane
(
motion:
const
ScrollMotion
(),
dismissible:
DismissiblePane
(
onDismissed:
()
{
onSent
(
context
,
contact
);
}),
children:
<
SlidableAction
>[
SlidableAction
(
onPressed:
(
BuildContext
c
)
{
FlutterClipboard
.
copy
(
contact
.
pubKey
)
.
then
(
(
dynamic
value
)
=
>
ScaffoldMessenger
.
of
(
context
)
.
showSnackBar
(
SnackBar
(
content:
Text
(
tr
(
'some_key_copied_to_clipboard'
)))));
// The end action pane is the one at the right or the bottom side.
endActionPane:
ActionPane
(
motion:
const
ScrollMotion
(),
dismissible:
DismissiblePane
(
onDismissed:
()
{
onSent
(
context
,
contact
);
}),
children:
<
SlidableAction
>[
SlidableAction
(
onPressed:
(
BuildContext
c
)
{
FlutterClipboard
.
copy
(
contact
.
pubKey
)
.
then
(
(
dynamic
value
)
=
>
ScaffoldMessenger
.
of
(
context
)
.
showSnackBar
(
SnackBar
(
content:
Text
(
tr
(
'some_key_copied_to_clipboard'
)))));
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
copy
,
label:
tr
(
'copy_contact_key'
),
),
if
(
showShare
())
SlidableAction
(
onPressed:
(
BuildContext
c
)
=
>
Share
.
share
(
contact
.
pubKey
),
backgroundColor:
Theme
.
of
(
context
)
.
secondaryHeaderColor
,
foregroundColor:
Theme
.
of
(
context
)
.
primaryColor
,
icon:
Icons
.
share
,
label:
tr
(
'share_this_key'
),
),
SlidableAction
(
onPressed:
(
BuildContext
c
)
{
onSent
(
c
,
contact
);
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColor
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
send
,
label:
tr
(
'send_g1'
),
),
],
),
child:
contactToListItem
(
contact
,
index
,
context
,
onLongPress:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
{
return
ContactEditDialog
(
contact:
contact
,
onSave:
(
Contact
c
)
{
_contactsCubit
.
updateContact
(
c
);
});
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColorDark
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
copy
,
label:
tr
(
'copy_contact_key'
),
),
SlidableAction
(
onPressed:
(
BuildContext
c
)
{
onSent
(
c
,
contact
);
},
backgroundColor:
Theme
.
of
(
context
)
.
primaryColor
,
foregroundColor:
Colors
.
white
,
icon:
Icons
.
send
,
label:
tr
(
'send_g1'
),
),
],
),
child:
contactToListItem
(
contact
,
index
,
context
),
);
);
},
onTap:
()
{
ScaffoldMessenger
.
of
(
context
)
.
showSnackBar
(
SnackBar
(
content:
Text
(
tr
(
'long_press_to_edit'
)),
),
);
}));
},
)),
const
BottomWidget
()
...
...
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