mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-22 06:08:54 -04:00
contacts ui cleanup
This commit is contained in:
parent
103975bb56
commit
19a366dcab
9 changed files with 84 additions and 39 deletions
|
@ -5,7 +5,6 @@ import '../../proto/proto.dart' as proto;
|
|||
import '../../theme/theme.dart';
|
||||
|
||||
const _kOnTap = 'onTap';
|
||||
const _kOnDelete = 'onDelete';
|
||||
|
||||
class ContactItemWidget extends StatelessWidget {
|
||||
const ContactItemWidget(
|
||||
|
@ -70,13 +69,23 @@ class ContactItemWidget extends StatelessWidget {
|
|||
await _onTap(_contact);
|
||||
}),
|
||||
endActions: [
|
||||
if (_onDoubleTap != null)
|
||||
SliderTileAction(
|
||||
icon: Icons.edit,
|
||||
label: translate('button.edit'),
|
||||
actionScale: ScaleKind.secondary,
|
||||
onPressed: (_context) =>
|
||||
singleFuture<void>((this, _kOnTap), () async {
|
||||
await _onDoubleTap(_contact);
|
||||
}),
|
||||
),
|
||||
if (_onDelete != null)
|
||||
SliderTileAction(
|
||||
icon: Icons.delete,
|
||||
label: translate('button.delete'),
|
||||
actionScale: ScaleKind.tertiary,
|
||||
onPressed: (_context) =>
|
||||
singleFuture<void>((this, _kOnDelete), () async {
|
||||
singleFuture<void>((this, _kOnTap), () async {
|
||||
await _onDelete(_contact);
|
||||
}),
|
||||
),
|
||||
|
|
|
@ -191,13 +191,13 @@ class _ContactsBrowserState extends State<ContactsBrowser>
|
|||
//final scaleConfig = theme.extension<ScaleConfig>()!;
|
||||
|
||||
final cilState = context.watch<ContactInvitationListCubit>().state;
|
||||
final cilBusy = cilState.busy;
|
||||
//final cilBusy = cilState.busy;
|
||||
final contactInvitationRecordList =
|
||||
cilState.state.asData?.value.map((x) => x.value).toIList() ??
|
||||
const IListConst([]);
|
||||
|
||||
final ciState = context.watch<ContactListCubit>().state;
|
||||
final ciBusy = ciState.busy;
|
||||
//final ciBusy = ciState.busy;
|
||||
final contactList =
|
||||
ciState.state.asData?.value.map((x) => x.value).toIList();
|
||||
|
||||
|
@ -243,8 +243,8 @@ class _ContactsBrowserState extends State<ContactsBrowser>
|
|||
selected: widget.selectedContactRecordKey ==
|
||||
contact.localConversationRecordKey.toVeilid(),
|
||||
disabled: false,
|
||||
onTap: _onTapContact,
|
||||
onDoubleTap: _onStartChat,
|
||||
onDoubleTap: _onTapContact,
|
||||
onTap: _onStartChat,
|
||||
onDelete: _onDeleteContact)
|
||||
.paddingLTRB(0, 4, 0, 0);
|
||||
case ContactsBrowserElementKind.invitation:
|
||||
|
|
|
@ -75,12 +75,29 @@ class _ContactsDialogState extends State<ContactsDialog> {
|
|||
: null,
|
||||
actions: [
|
||||
if (_selectedContact != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.chat_bubble),
|
||||
tooltip: translate('contacts_dialog.new_chat'),
|
||||
onPressed: () async {
|
||||
await onChatStarted(_selectedContact!);
|
||||
})
|
||||
Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.chat_bubble),
|
||||
tooltip: translate('contacts_dialog.new_chat'),
|
||||
onPressed: () async {
|
||||
await onChatStarted(_selectedContact!);
|
||||
}),
|
||||
Text(translate('contacts_dialog.new_chat'),
|
||||
style: theme.textTheme.labelSmall!
|
||||
.copyWith(color: scale.primaryScale.borderText)),
|
||||
]).paddingLTRB(8, 0, 8, 0),
|
||||
if (enableSplit && _selectedContact != null)
|
||||
Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
tooltip: translate('contacts_dialog.close_contact'),
|
||||
onPressed: () async {
|
||||
await onContactSelected(null);
|
||||
}),
|
||||
Text(translate('contacts_dialog.close_contact'),
|
||||
style: theme.textTheme.labelSmall!
|
||||
.copyWith(color: scale.primaryScale.borderText)),
|
||||
]).paddingLTRB(8, 0, 8, 0),
|
||||
]),
|
||||
body: LayoutBuilder(builder: (context, constraint) {
|
||||
final maxWidth = constraint.maxWidth;
|
||||
|
|
|
@ -67,6 +67,7 @@ class _EditContactFormState extends State<EditContactForm> {
|
|||
return FormBuilder(
|
||||
key: widget.formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
AvatarWidget(
|
||||
name: widget.contact.profile.name,
|
||||
|
@ -79,53 +80,53 @@ class _EditContactFormState extends State<EditContactForm> {
|
|||
).paddingLTRB(0, 0, 0, 16),
|
||||
SelectableText(widget.contact.profile.name,
|
||||
style: textTheme.headlineMedium)
|
||||
.decoratorLabel(
|
||||
.noEditDecoratorLabel(
|
||||
context,
|
||||
translate('contact_form.form_name'),
|
||||
scale: scale.secondaryScale,
|
||||
)
|
||||
.paddingSymmetric(vertical: 8),
|
||||
.paddingSymmetric(vertical: 4),
|
||||
SelectableText(widget.contact.profile.pronouns,
|
||||
style: textTheme.headlineSmall)
|
||||
.decoratorLabel(
|
||||
.noEditDecoratorLabel(
|
||||
context,
|
||||
translate('contact_form.form_pronouns'),
|
||||
scale: scale.secondaryScale,
|
||||
)
|
||||
.paddingSymmetric(vertical: 8),
|
||||
Row(children: [
|
||||
.paddingSymmetric(vertical: 4),
|
||||
Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
_availabilityWidget(context, widget.contact.profile.availability),
|
||||
SelectableText(widget.contact.profile.status,
|
||||
style: textTheme.bodyMedium)
|
||||
.paddingSymmetric(horizontal: 8)
|
||||
])
|
||||
.decoratorLabel(
|
||||
.noEditDecoratorLabel(
|
||||
context,
|
||||
translate('contact_form.form_status'),
|
||||
scale: scale.secondaryScale,
|
||||
)
|
||||
.paddingSymmetric(vertical: 8),
|
||||
.paddingSymmetric(vertical: 4),
|
||||
SelectableText(widget.contact.profile.about,
|
||||
minLines: 1, maxLines: 8, style: textTheme.bodyMedium)
|
||||
.decoratorLabel(
|
||||
.noEditDecoratorLabel(
|
||||
context,
|
||||
translate('contact_form.form_about'),
|
||||
scale: scale.secondaryScale,
|
||||
)
|
||||
.paddingSymmetric(vertical: 8),
|
||||
.paddingSymmetric(vertical: 4),
|
||||
SelectableText(
|
||||
widget.contact.identityPublicKey.value.toVeilid().toString(),
|
||||
style: textTheme.labelMedium!
|
||||
.copyWith(fontFamily: 'Source Code Pro'))
|
||||
.decoratorLabel(
|
||||
.noEditDecoratorLabel(
|
||||
context,
|
||||
translate('contact_form.form_fingerprint'),
|
||||
scale: scale.secondaryScale,
|
||||
)
|
||||
.paddingSymmetric(vertical: 8),
|
||||
.paddingSymmetric(vertical: 4),
|
||||
Divider(color: border).paddingLTRB(8, 0, 8, 8),
|
||||
FormBuilderTextField(
|
||||
autofocus: true,
|
||||
//autofocus: true,
|
||||
name: EditContactForm.formFieldNickname,
|
||||
initialValue: widget.contact.nickname,
|
||||
decoration: InputDecoration(
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:awesome_extensions/awesome_extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_translate/flutter_translate.dart';
|
||||
|
||||
|
@ -22,14 +21,15 @@ class EmptyContactListWidget extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person_add_sharp,
|
||||
color: scale.primaryScale.subtleBorder,
|
||||
size: 48,
|
||||
),
|
||||
// Icon(
|
||||
// Icons.person_add_sharp,
|
||||
// color: scale.primaryScale.subtleBorder,
|
||||
// size: 48,
|
||||
// ),
|
||||
Text(
|
||||
textAlign: TextAlign.center,
|
||||
translate('contact_list.invite_people'),
|
||||
//maxLines: 3,
|
||||
style: textTheme.bodyMedium?.copyWith(
|
||||
color: scale.primaryScale.subtleBorder,
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue