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
5ac25e46
Commit
5ac25e46
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Update pay contact after saving
parent
2a23cd8c
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/contact_fav_icon.dart
+6
-0
6 additions, 0 deletions
lib/ui/widgets/first_screen/contact_fav_icon.dart
lib/ui/widgets/first_screen/pay_recipient_widget.dart
+56
-51
56 additions, 51 deletions
lib/ui/widgets/first_screen/pay_recipient_widget.dart
with
62 additions
and
51 deletions
lib/ui/widgets/first_screen/contact_fav_icon.dart
+
6
−
0
View file @
5ac25e46
...
...
@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'../../../data/models/contact.dart'
;
import
'../../../data/models/contact_cubit.dart'
;
import
'../../../data/models/payment_cubit.dart'
;
import
'../../contacts_cache.dart'
;
import
'../third_screen/contact_form_dialog.dart'
;
...
...
@@ -12,10 +13,12 @@ class ContactFavIcon extends StatelessWidget {
super
.
key
,
required
this
.
contact
,
required
this
.
contactsCubit
,
this
.
paymentCubit
,
});
final
ContactsCubit
contactsCubit
;
final
Contact
contact
;
final
PaymentCubit
?
paymentCubit
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -41,6 +44,9 @@ class ContactFavIcon extends StatelessWidget {
contact:
contact
,
onSave:
(
Contact
c
)
{
context
.
read
<
ContactsCubit
>()
.
updateContact
(
c
);
if
(
paymentCubit
!=
null
)
{
paymentCubit
!.
selectUser
(
c
);
}
ContactsCache
()
.
saveContact
(
c
);
});
},
...
...
This diff is collapsed.
Click to expand it.
lib/ui/widgets/first_screen/pay_recipient_widget.dart
+
56
−
51
View file @
5ac25e46
...
...
@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'../../../data/models/contact_cubit.dart'
;
import
'../../../data/models/contact_state.dart'
;
import
'../../../data/models/payment_cubit.dart'
;
import
'../../../data/models/payment_state.dart'
;
import
'../../ui_helpers.dart'
;
import
'contact_fav_icon.dart'
;
...
...
@@ -12,60 +13,64 @@ class PayRecipientWidget extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
PaymentCubit
paymentCubit
=
BlocProvider
.
of
<
PaymentCubit
>(
context
);
final
ContactsCubit
contactsCubit
=
BlocProvider
.
of
<
ContactsCubit
>(
context
);
return
Card
(
elevation:
4
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
10
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
avatar
(
paymentCubit
.
state
.
contact
!.
avatar
),
const
SizedBox
(
width:
16.0
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
if
(
paymentCubit
.
state
.
contact
!.
title
!=
null
)
Text
(
paymentCubit
.
state
.
contact
!.
title
,
style:
const
TextStyle
(
fontSize:
20.0
,
fontWeight:
FontWeight
.
bold
,
return
BlocBuilder
<
PaymentCubit
,
PaymentState
>(
builder:
(
BuildContext
context
,
PaymentState
state
)
{
final
ContactsCubit
contactsCubit
=
BlocProvider
.
of
<
ContactsCubit
>(
context
);
return
Card
(
elevation:
4
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
10
),
),
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
avatar
(
state
.
contact
!.
avatar
),
const
SizedBox
(
width:
16.0
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
if
(
state
.
contact
!.
title
!=
null
)
Text
(
state
.
contact
!.
title
,
style:
const
TextStyle
(
fontSize:
20.0
,
fontWeight:
FontWeight
.
bold
,
),
),
)
,
if
(
paymentCubit
.
state
.
contact
!.
subtitle
!=
null
)
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
2
,
0
,
0
),
child:
Text
(
paymentCubit
.
state
.
contact
!.
subtitle
!
,
style:
const
TextStyle
(
fontSize:
16.0
,
),
))
,
]
,
if
(
state
.
contact
!.
subtitle
!=
null
)
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
2
,
0
,
0
),
child:
Text
(
state
.
contact
!.
subtitle
!
,
style:
const
TextStyle
(
fontSize:
16.0
,
)
,
)
),
]
,
)
,
),
),
// Is not is contact, allow to add to contacts
if
(
!
contactsCubit
.
isContact
(
paymentCubit
.
state
.
contact
!.
pubKey
))
BlocBuilder
<
ContactsCubit
,
ContactsState
>(
builder:
(
BuildContext
context
,
ContactsState
state
)
{
// Is not is contact, allow to add to contacts
// if (!contactsCubit.isContact(state.contact!.pubKey))
BlocBuilder
<
ContactsCubit
,
ContactsState
>(
builder:
(
BuildContext
context
,
ContactsState
contactState
)
{
return
ContactFavIcon
(
contact:
paymentCubit
.
state
.
contact
!
,
contactsCubit:
context
.
read
<
ContactsCubit
>());
contact:
state
.
contact
!
,
contactsCubit:
context
.
read
<
ContactsCubit
>(),
paymentCubit:
context
.
watch
<
PaymentCubit
>());
}),
IconButton
(
icon:
const
Icon
(
Icons
.
cancel
),
onPressed:
()
{
context
.
read
<
PaymentCubit
>()
.
clearRecipient
();
},
),
],
),
));
IconButton
(
icon:
const
Icon
(
Icons
.
cancel
),
onPressed:
()
{
context
.
read
<
PaymentCubit
>()
.
clearRecipient
();
},
),
],
),
));
});
}
}
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