fix: Compact recipient selector #0

This commit is contained in:
Janez T
2026-03-22 09:37:53 +01:00
parent 059125c714
commit 7486837ad0
4 changed files with 38 additions and 32 deletions

View File

@@ -489,7 +489,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 123; CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_TEAM = JND55328G8; DEVELOPMENT_TEAM = JND55328G8;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -511,7 +511,7 @@
buildSettings = { buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)"; BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 123; CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_TEAM = JND55328G8; DEVELOPMENT_TEAM = JND55328G8;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
@@ -530,7 +530,7 @@
buildSettings = { buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)"; BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 123; CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_TEAM = JND55328G8; DEVELOPMENT_TEAM = JND55328G8;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
@@ -547,7 +547,7 @@
buildSettings = { buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)"; BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 123; CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_TEAM = JND55328G8; DEVELOPMENT_TEAM = JND55328G8;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
@@ -679,7 +679,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 123; CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_TEAM = JND55328G8; DEVELOPMENT_TEAM = JND55328G8;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -702,7 +702,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 123; CURRENT_PROJECT_VERSION = 124;
DEVELOPMENT_TEAM = JND55328G8; DEVELOPMENT_TEAM = JND55328G8;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;

View File

@@ -43,7 +43,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>123</string> <string>124</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>

View File

@@ -174,6 +174,8 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
return '${l10n.channel} $channelIdx$shortKey'; return '${l10n.channel} $channelIdx$shortKey';
} }
bool _isDenseSection(String type) => type == 'channel' || type == 'contact';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!; final l10n = AppLocalizations.of(context)!;
@@ -332,6 +334,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
subtitle: _channelSubtitle(context, channel), subtitle: _channelSubtitle(context, channel),
unreadCount: _unreadFor(channel), unreadCount: _unreadFor(channel),
isSelected: _isSelected('channel', channel), isSelected: _isSelected('channel', channel),
compact: true,
onTap: () { onTap: () {
widget.onSelect('channel', channel); widget.onSelect('channel', channel);
Navigator.pop(context); Navigator.pop(context);
@@ -357,6 +360,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
subtitle: contact.publicKeyShort, subtitle: contact.publicKeyShort,
unreadCount: _unreadFor(contact), unreadCount: _unreadFor(contact),
isSelected: _isSelected('contact', contact), isSelected: _isSelected('contact', contact),
compact: true,
onTap: () { onTap: () {
widget.onSelect('contact', contact); widget.onSelect('contact', contact);
Navigator.pop(context); Navigator.pop(context);
@@ -504,10 +508,11 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
}) { }) {
final colorScheme = Theme.of(context).colorScheme; final colorScheme = Theme.of(context).colorScheme;
final accentColor = _sectionColor(context, type); final accentColor = _sectionColor(context, type);
final compact = _isDenseSection(type);
return Container( return Container(
margin: const EdgeInsets.only(bottom: 12), margin: const EdgeInsets.only(bottom: 12),
padding: const EdgeInsets.all(14), padding: EdgeInsets.all(compact ? 12 : 14),
decoration: BoxDecoration( decoration: BoxDecoration(
color: colorScheme.surfaceContainerLow, color: colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
@@ -519,16 +524,16 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
Row( Row(
children: [ children: [
Container( Container(
width: 38, width: compact ? 34 : 38,
height: 38, height: compact ? 34 : 38,
decoration: BoxDecoration( decoration: BoxDecoration(
color: accentColor.withValues(alpha: 0.12), color: accentColor.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: Icon(icon, size: 18, color: accentColor), child: Icon(icon, size: compact ? 16 : 18, color: accentColor),
), ),
const SizedBox(width: 10), SizedBox(width: compact ? 8 : 10),
Expanded( Expanded(
child: Text( child: Text(
title, title,
@@ -539,9 +544,9 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
), ),
), ),
Container( Container(
padding: const EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 10, horizontal: compact ? 9 : 10,
vertical: 5, vertical: compact ? 4 : 5,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: colorScheme.surface, color: colorScheme.surface,
@@ -567,7 +572,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
color: colorScheme.onSurfaceVariant, color: colorScheme.onSurfaceVariant,
), ),
), ),
const SizedBox(height: 12), SizedBox(height: compact ? 10 : 12),
if (children.isEmpty) if (children.isEmpty)
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 8), padding: const EdgeInsets.symmetric(vertical: 8),
@@ -582,7 +587,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
else ...[ else ...[
for (var i = 0; i < children.length; i++) ...[ for (var i = 0; i < children.length; i++) ...[
children[i], children[i],
if (i != children.length - 1) const SizedBox(height: 8), if (i != children.length - 1) SizedBox(height: compact ? 6 : 8),
], ],
], ],
], ],
@@ -679,6 +684,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
required String subtitle, required String subtitle,
required int unreadCount, required int unreadCount,
required bool isSelected, required bool isSelected,
bool compact = false,
required VoidCallback onTap, required VoidCallback onTap,
}) { }) {
final colorScheme = Theme.of(context).colorScheme; final colorScheme = Theme.of(context).colorScheme;
@@ -687,14 +693,14 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
return Material( return Material(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(compact ? 18 : 20),
onTap: onTap, onTap: onTap,
child: Ink( child: Ink(
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected color: isSelected
? accentColor.withValues(alpha: 0.12) ? accentColor.withValues(alpha: 0.12)
: colorScheme.surface.withValues(alpha: 0.82), : colorScheme.surface.withValues(alpha: 0.82),
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(compact ? 18 : 20),
border: Border.all( border: Border.all(
color: isSelected color: isSelected
? accentColor.withValues(alpha: 0.24) ? accentColor.withValues(alpha: 0.24)
@@ -702,7 +708,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
), ),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12), padding: EdgeInsets.all(compact ? 10 : 12),
child: Row( child: Row(
children: [ children: [
Stack( Stack(
@@ -710,15 +716,15 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
children: [ children: [
ContactAvatar( ContactAvatar(
contact: contact, contact: contact,
radius: 22, radius: compact ? 20 : 22,
displayName: title, displayName: title,
), ),
Positioned( Positioned(
right: -3, right: -3,
bottom: -3, bottom: -3,
child: Container( child: Container(
width: 18, width: compact ? 16 : 18,
height: 18, height: compact ? 16 : 18,
decoration: BoxDecoration( decoration: BoxDecoration(
color: colorScheme.surface, color: colorScheme.surface,
shape: BoxShape.circle, shape: BoxShape.circle,
@@ -729,14 +735,14 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
alignment: Alignment.center, alignment: Alignment.center,
child: Icon( child: Icon(
_typeIcon(contact), _typeIcon(contact),
size: 10, size: compact ? 9 : 10,
color: accentColor, color: accentColor,
), ),
), ),
), ),
], ],
), ),
const SizedBox(width: 12), SizedBox(width: compact ? 10 : 12),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -756,11 +762,11 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
), ),
), ),
if (contact.isPublicChannel) ...[ if (contact.isPublicChannel) ...[
const SizedBox(width: 8), SizedBox(width: compact ? 6 : 8),
Container( Container(
padding: const EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 8, horizontal: compact ? 7 : 8,
vertical: 3, vertical: compact ? 2 : 3,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: accentColor.withValues(alpha: 0.10), color: accentColor.withValues(alpha: 0.10),
@@ -778,7 +784,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
], ],
], ],
), ),
const SizedBox(height: 4), SizedBox(height: compact ? 2 : 4),
Text( Text(
subtitle, subtitle,
maxLines: 1, maxLines: 1,
@@ -791,7 +797,7 @@ class _RecipientSelectorSheetState extends State<RecipientSelectorSheet> {
], ],
), ),
), ),
const SizedBox(width: 10), SizedBox(width: compact ? 8 : 10),
_buildTrailing( _buildTrailing(
context, context,
unreadCount: unreadCount, unreadCount: unreadCount,

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 2026.0321.1+37 version: 2026.0322.1+38
environment: environment:
sdk: ^3.9.2 sdk: ^3.9.2