mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-12-28 09:09:27 -05:00
minor ui cleanups
This commit is contained in:
parent
e2f810f6e5
commit
079efb02b9
@ -15,13 +15,13 @@ import '../chat_list.dart';
|
||||
class ChatListWidget extends StatelessWidget {
|
||||
const ChatListWidget({super.key});
|
||||
|
||||
Widget _itemBuilderDirect(proto.DirectChat direct,
|
||||
IMap<proto.TypedKey, proto.Contact> contactMap, bool busy) {
|
||||
Widget _itemBuilderDirect(
|
||||
proto.DirectChat direct, IMap<proto.TypedKey, proto.Contact> contactMap) {
|
||||
final contact = contactMap[direct.localConversationRecordKey];
|
||||
if (contact == null) {
|
||||
return const Text('...');
|
||||
}
|
||||
return ChatSingleContactItemWidget(contact: contact, disabled: busy)
|
||||
return ChatSingleContactItemWidget(contact: contact)
|
||||
.paddingLTRB(0, 4, 0, 0);
|
||||
}
|
||||
|
||||
@ -70,8 +70,10 @@ class ChatListWidget extends StatelessWidget {
|
||||
itemBuilder: (c) {
|
||||
switch (c.whichKind()) {
|
||||
case proto.Chat_Kind.direct:
|
||||
return _itemBuilderDirect(c.direct, contactMap,
|
||||
contactListV.busy || chatListV.busy);
|
||||
return _itemBuilderDirect(
|
||||
c.direct,
|
||||
contactMap,
|
||||
);
|
||||
case proto.Chat_Kind.group:
|
||||
return const Text(
|
||||
'group chats not yet supported!');
|
||||
|
@ -11,7 +11,7 @@ import '../chat_list.dart';
|
||||
class ChatSingleContactItemWidget extends StatelessWidget {
|
||||
const ChatSingleContactItemWidget({
|
||||
required proto.Contact contact,
|
||||
required bool disabled,
|
||||
bool disabled = false,
|
||||
super.key,
|
||||
}) : _contact = contact,
|
||||
_disabled = disabled;
|
||||
|
@ -242,7 +242,7 @@ class _ContactsBrowserState extends State<ContactsBrowser>
|
||||
contact: contact,
|
||||
selected: widget.selectedContactRecordKey ==
|
||||
contact.localConversationRecordKey.toVeilid(),
|
||||
disabled: ciBusy,
|
||||
disabled: false,
|
||||
onTap: _onTapContact,
|
||||
onDoubleTap: _onStartChat,
|
||||
onDelete: _onDeleteContact)
|
||||
@ -250,7 +250,7 @@ class _ContactsBrowserState extends State<ContactsBrowser>
|
||||
case ContactsBrowserElementKind.invitation:
|
||||
final invitation = element.invitation!;
|
||||
return ContactInvitationItemWidget(
|
||||
contactInvitationRecord: invitation, disabled: cilBusy)
|
||||
contactInvitationRecord: invitation, disabled: false)
|
||||
.paddingLTRB(0, 4, 0, 0);
|
||||
}
|
||||
},
|
||||
|
@ -27,36 +27,34 @@ class MenuItemWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => TextButton(
|
||||
onPressed: callback,
|
||||
style: TextButton.styleFrom(foregroundColor: foregroundColor).copyWith(
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.hovered)) {
|
||||
return backgroundHoverColor;
|
||||
}
|
||||
if (states.contains(WidgetState.focused)) {
|
||||
return backgroundFocusColor;
|
||||
}
|
||||
return backgroundColor;
|
||||
}),
|
||||
side: WidgetStateBorderSide.resolveWith((states) {
|
||||
if (states.contains(WidgetState.hovered)) {
|
||||
onPressed: callback,
|
||||
style: TextButton.styleFrom(foregroundColor: foregroundColor).copyWith(
|
||||
backgroundColor: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.hovered)) {
|
||||
return backgroundHoverColor;
|
||||
}
|
||||
if (states.contains(WidgetState.focused)) {
|
||||
return backgroundFocusColor;
|
||||
}
|
||||
return backgroundColor;
|
||||
}),
|
||||
side: WidgetStateBorderSide.resolveWith((states) {
|
||||
if (states.contains(WidgetState.hovered)) {
|
||||
return borderColor != null
|
||||
? BorderSide(width: 2, color: borderHoverColor!)
|
||||
: null;
|
||||
}
|
||||
if (states.contains(WidgetState.focused)) {
|
||||
return borderColor != null
|
||||
? BorderSide(width: 2, color: borderFocusColor!)
|
||||
: null;
|
||||
}
|
||||
return borderColor != null
|
||||
? BorderSide(width: 2, color: borderHoverColor!)
|
||||
? BorderSide(width: 2, color: borderColor!)
|
||||
: null;
|
||||
}
|
||||
if (states.contains(WidgetState.focused)) {
|
||||
return borderColor != null
|
||||
? BorderSide(width: 2, color: borderFocusColor!)
|
||||
: null;
|
||||
}
|
||||
return borderColor != null
|
||||
? BorderSide(width: 2, color: borderColor!)
|
||||
: null;
|
||||
}),
|
||||
shape: WidgetStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? 0)))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
}),
|
||||
shape: WidgetStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? 0)))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
@ -83,7 +81,7 @@ class MenuItemWidget extends StatelessWidget {
|
||||
onPressed: footerCallback),
|
||||
],
|
||||
),
|
||||
));
|
||||
);
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
|
@ -230,7 +230,7 @@ class HomeScreenState extends State<HomeScreen>
|
||||
menuScreenTapClose: canClose,
|
||||
mainScreenTapClose: canClose,
|
||||
disableDragGesture: !canClose,
|
||||
mainScreenScale: .15,
|
||||
mainScreenScale: .25,
|
||||
slideWidth: min(360, MediaQuery.of(context).size.width * 0.9),
|
||||
)));
|
||||
}
|
||||
|
@ -14,6 +14,10 @@ const kMobileWidthCutoff = 500.0;
|
||||
bool isMobileWidth(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width < kMobileWidthCutoff;
|
||||
|
||||
bool isMobileSize(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width < kMobileWidthCutoff ||
|
||||
MediaQuery.of(context).size.height < kMobileWidthCutoff;
|
||||
|
||||
bool responsiveVisibility({
|
||||
required BuildContext context,
|
||||
bool phone = true,
|
||||
|
@ -12,7 +12,7 @@ class StyledScaffold extends StatelessWidget {
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
final scaleConfig = theme.extension<ScaleConfig>()!;
|
||||
|
||||
final enableBorder = !isMobileWidth(context);
|
||||
final enableBorder = !isMobileSize(context);
|
||||
|
||||
final scaffold = clipBorder(
|
||||
clipEnabled: enableBorder,
|
||||
|
Loading…
Reference in New Issue
Block a user