This commit is contained in:
Christien Rioux 2023-09-23 22:19:53 -04:00
parent 95e5306eb3
commit cd8f5aebcb
6 changed files with 121 additions and 109 deletions

View file

@ -24,65 +24,41 @@ class ContactListWidget extends ConsumerWidget {
@override
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context, WidgetRef ref) {
final theme = Theme.of(context);
final textTheme = theme.textTheme;
final scale = theme.extension<ScaleScheme>()!;
return Container(
width: double.infinity,
decoration: ShapeDecoration(
color: scale.primaryScale.subtleBorder,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
)),
constraints: const BoxConstraints(
minHeight: 64,
),
child: Column(children: [
Text(
translate('contact_list.title'),
style: textTheme.titleMedium!
.copyWith(color: scale.primaryScale.subtleText),
).paddingLTRB(4, 4, 4, 0),
Container(
width: double.infinity,
decoration: ShapeDecoration(
color: scale.primaryScale.subtleBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(
color: scale.primaryScale.subtleBorder, width: 4))),
child: (contactList.isEmpty)
? const EmptyContactListWidget().toCenter()
: SearchableList<proto.Contact>(
autoFocusOnSearch: false,
initialList: contactList.toList(),
builder: (l, i, c) => ContactItemWidget(contact: c),
filter: (value) {
final lowerValue = value.toLowerCase();
return contactList
.where((element) =>
element.editedProfile.name
.toLowerCase()
.contains(lowerValue) ||
element.editedProfile.title
.toLowerCase()
.contains(lowerValue))
.toList();
},
inputDecoration: InputDecoration(
labelText: translate('contact_list.search'),
fillColor: Colors.white,
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.blue,
return SizedBox.expand(
child: styledTitleContainer(
context: context,
title: translate('contact_list.title'),
child: SizedBox.expand(
child: (contactList.isEmpty)
? const EmptyContactListWidget()
: SearchableList<proto.Contact>(
autoFocusOnSearch: false,
shrinkWrap: true,
initialList: contactList.toList(),
builder: (l, i, c) => ContactItemWidget(contact: c),
filter: (value) {
final lowerValue = value.toLowerCase();
return contactList
.where((element) =>
element.editedProfile.name
.toLowerCase()
.contains(lowerValue) ||
element.editedProfile.title
.toLowerCase()
.contains(lowerValue))
.toList();
},
inputDecoration: InputDecoration(
labelText: translate('contact_list.search'),
fillColor: Colors.white,
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.blue,
),
borderRadius: BorderRadius.circular(10),
),
),
borderRadius: BorderRadius.circular(10),
),
),
),
).expanded()
]),
).paddingLTRB(8, 0, 8, 8);
))).paddingLTRB(8, 0, 8, 8);
}
}

View file

@ -15,6 +15,7 @@ class EmptyContactListWidget extends ConsumerWidget {
final scale = theme.extension<ScaleScheme>()!;
return Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(

View file

@ -23,38 +23,10 @@ class PasteInviteDialog extends ConsumerStatefulWidget {
PasteInviteDialogState createState() => PasteInviteDialogState();
static Future<void> show(BuildContext context) async {
final theme = Theme.of(context);
final scale = theme.extension<ScaleScheme>()!;
final textTheme = theme.textTheme;
await showDialog<void>(
await showStyledDialog<void>(
context: context,
// ignore: prefer_expression_function_bodies
builder: (context) {
return AlertDialog(
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(Radius.circular(16)),
side: BorderSide(width: 4, color: scale.primaryScale.border),
),
contentPadding: EdgeInsets.zero,
backgroundColor: scale.primaryScale.border,
title: Text(
translate('paste_invite_dialog.title'),
style: textTheme.titleMedium,
textAlign: TextAlign.center,
),
titlePadding: EdgeInsets.fromLTRB(4, 4, 4, 0),
content: DecoratedBox(
decoration: ShapeDecoration(
color: scale.primaryScale.subtleBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: BorderSide(
width: 4, color: scale.primaryScale.border),
)),
child: const PasteInviteDialog().paddingAll(4)));
});
title: translate('paste_invite_dialog.title'),
child: const PasteInviteDialog());
}
}

View file

@ -22,23 +22,10 @@ class SendInviteDialog extends ConsumerStatefulWidget {
SendInviteDialogState createState() => SendInviteDialogState();
static Future<void> show(BuildContext context) async {
await showDialog<void>(
await showStyledDialog<void>(
context: context,
// ignore: prefer_expression_function_bodies
builder: (context) {
return AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
),
contentPadding: const EdgeInsets.only(
top: 10,
),
title: Text(
translate('send_invite_dialog.title'),
style: const TextStyle(fontSize: 24),
),
content: const SendInviteDialog());
});
title: translate('send_invite_dialog.title'),
child: const SendInviteDialog());
}
}
@ -146,11 +133,16 @@ class SendInviteDialogState extends ConsumerState<SendInviteDialog> {
@override
// ignore: prefer_expression_function_bodies
Widget build(BuildContext context) {
final windowSize = MediaQuery.of(context).size;
final maxDialogHeight = windowSize.height - 64;
final maxDialogWidth = windowSize.width - 64;
final theme = Theme.of(context);
//final scale = theme.extension<ScaleScheme>()!;
final textTheme = theme.textTheme;
return SizedBox(
height: 400,
return ConstrainedBox(
constraints:
BoxConstraints(maxHeight: maxDialogHeight, maxWidth: maxDialogWidth),
child: SingleChildScrollView(
padding: const EdgeInsets.all(8),
child: Column(