updates and cleanup

This commit is contained in:
Christien Rioux 2025-03-17 22:00:26 -04:00
parent 6bd60207d8
commit ef1ded4494
11 changed files with 142 additions and 108 deletions

View file

@ -68,15 +68,27 @@ class ContactItemWidget extends StatelessWidget {
: () => singleFuture<void>((this, _kOnTap), () async {
await _onTap(_contact);
}),
endActions: [
startActions: [
if (_onDoubleTap != null)
SliderTileAction(
//icon: Icons.edit,
label: translate('button.chat'),
actionScale: ScaleKind.secondary,
onPressed: (_context) =>
singleFuture<void>((this, _kOnTap), () async {
await _onDoubleTap(_contact);
}),
),
],
endActions: [
if (_onTap != null)
SliderTileAction(
//icon: Icons.edit,
label: translate('button.edit'),
actionScale: ScaleKind.secondary,
onPressed: (_context) =>
singleFuture<void>((this, _kOnTap), () async {
await _onDoubleTap(_contact);
await _onTap(_contact);
}),
),
if (_onDelete != null)

View file

@ -39,14 +39,14 @@ class ContactsBrowserElement {
class ContactsBrowser extends StatefulWidget {
const ContactsBrowser(
{required this.onContactSelected,
required this.onChatStarted,
required this.onStartChat,
this.selectedContactRecordKey,
super.key});
@override
State<ContactsBrowser> createState() => _ContactsBrowserState();
final Future<void> Function(proto.Contact? contact) onContactSelected;
final Future<void> Function(proto.Contact contact) onChatStarted;
final Future<void> Function(proto.Contact contact) onStartChat;
final TypedKey? selectedContactRecordKey;
@override
@ -60,7 +60,7 @@ class ContactsBrowser extends StatefulWidget {
'onContactSelected', onContactSelected))
..add(
ObjectFlagProperty<Future<void> Function(proto.Contact contact)>.has(
'onChatStarted', onChatStarted));
'onStartChat', onStartChat));
}
}
@ -238,8 +238,8 @@ class _ContactsBrowserState extends State<ContactsBrowser>
selected: widget.selectedContactRecordKey ==
contact.localConversationRecordKey.toVeilid(),
disabled: false,
onDoubleTap: _onTapContact,
onTap: _onStartChat,
onDoubleTap: _onStartChat,
onTap: _onSelectContact,
onDelete: _onDeleteContact)
.paddingLTRB(0, 4, 0, 0);
case ContactsBrowserElementKind.invitation:
@ -293,12 +293,12 @@ class _ContactsBrowserState extends State<ContactsBrowser>
]);
}
Future<void> _onTapContact(proto.Contact contact) async {
Future<void> _onSelectContact(proto.Contact contact) async {
await widget.onContactSelected(contact);
}
Future<void> _onStartChat(proto.Contact contact) async {
await widget.onChatStarted(contact);
await widget.onStartChat(contact);
}
Future<void> _onDeleteContact(proto.Contact contact) async {

View file

@ -135,7 +135,7 @@ class _ContactsDialogState extends State<ContactsDialog> {
?.localConversationRecordKey
.toVeilid(),
onContactSelected: _onContactSelected,
onChatStarted: _onChatStarted,
onStartChat: _onChatStarted,
).paddingLTRB(8, 0, 8, 8)))),
if (enableRight && enableLeft)
Container(