Skip to content

Commit

Permalink
krille-chan#104 FluffyChat: clip too long text in abook
Browse files Browse the repository at this point in the history
  • Loading branch information
carowebtec authored and Hannich Matthias committed Aug 13, 2023
1 parent 4049336 commit d8ba70b
Showing 1 changed file with 54 additions and 35 deletions.
89 changes: 54 additions & 35 deletions lib/pages/addressbook/addressbook_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ class AddressbookView extends StatelessWidget {
autofocus: false,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.search),
label: Text(L10n.of(context)!.abookSearchDesc),
label: Text(
L10n.of(context)!.abookSearchDesc,
),
),
),
),
Expand Down Expand Up @@ -118,18 +120,21 @@ class AddressbookView extends StatelessWidget {
: const Icon(Icons.circle_outlined, size: 16.0),
onPressed: () => controller.toggleEntry(e),
),
Text(
(e.longName != null && e.longName!.isNotEmpty)
? '${e.longName} (${e.info})'
: (e.kind == 'group')
? '${e.title} (${e.info}) (${e.scgroupUsersActive!.length}/${e.scgroupUsersActive!.length + e.scgroupUsersInactive!.length})'
: '${e.title} (${e.info})',
style: TextStyle(
decoration: (e.active || e.kind == 'group')
? TextDecoration.none
: TextDecoration.lineThrough,
Expanded(
child: Text(
(e.longName != null && e.longName!.isNotEmpty)
? '${e.longName} (${e.info})'
: (e.kind == 'group')
? '${e.title} (${e.info}) (${e.scgroupUsersActive!.length}/${e.scgroupUsersActive!.length + e.scgroupUsersInactive!.length})'
: '${e.title} (${e.info})',
overflow: TextOverflow.ellipsis,
style: TextStyle(
decoration: (e.active || e.kind == 'group')
? TextDecoration.none
: TextDecoration.lineThrough,
),
),
),
)
],
),
),
Expand All @@ -140,7 +145,9 @@ class AddressbookView extends StatelessWidget {
SliverToBoxAdapter(
child: Row(
children: [
Text(L10n.of(context)!.noSearchResult),
Text(
L10n.of(context)!.noSearchResult,
),
],
),
),
Expand Down Expand Up @@ -183,19 +190,22 @@ class AddressbookView extends StatelessWidget {
onPressed: () => controller.toggleEntry(entry.node),
tooltip: L10n.of(context)!.selectContact,
),
Text(
entry.node.longName != null &&
entry.node.longName!.isNotEmpty
? entry.node.longName!
: (entry.node.kind == 'group')
? '${entry.node.title} (${entry.node.scgroupUsersActive!.length}/${entry.node.scgroupUsersActive!.length + entry.node.scgroupUsersInactive!.length})'
: entry.node.title,
style: TextStyle(
decoration: (entry.node.active ||
entry.node.category ||
entry.node.kind == 'group')
? TextDecoration.none
: TextDecoration.lineThrough,
Expanded(
child: Text(
entry.node.longName != null &&
entry.node.longName!.isNotEmpty
? entry.node.longName!
: (entry.node.kind == 'group')
? '${entry.node.title} (${entry.node.scgroupUsersActive!.length}/${entry.node.scgroupUsersActive!.length + entry.node.scgroupUsersInactive!.length})'
: entry.node.title,
overflow: TextOverflow.ellipsis,
style: TextStyle(
decoration: (entry.node.active ||
entry.node.category ||
entry.node.kind == 'group')
? TextDecoration.none
: TextDecoration.lineThrough,
),
),
),
],
Expand Down Expand Up @@ -238,8 +248,11 @@ class AddressbookView extends StatelessWidget {
onPressed: () => controller.toggleEntry(e),
tooltip: L10n.of(context)!.removeSelectionContact,
),
Text(
'${e.title} (${e.info})',
Expanded(
child: Text(
'${e.title} (${e.info})',
overflow: TextOverflow.ellipsis,
),
),
],
),
Expand All @@ -262,9 +275,12 @@ class AddressbookView extends StatelessWidget {
),
tooltip: L10n.of(context)!.removeSelectionContact,
),
Text(
'${controller.usersInSCGroups.where((u) => u.username == groupMemberName).toList().first.longName} (via ${e.title})',
),
Expanded(
child: Text(
'${controller.usersInSCGroups.where((u) => u.username == groupMemberName).toList().first.longName} (via ${e.title})',
overflow: TextOverflow.ellipsis,
),
)
],
),
)
Expand All @@ -279,10 +295,13 @@ class AddressbookView extends StatelessWidget {
onPressed: () => controller.toggleEntry(e),
tooltip: L10n.of(context)!.removeSelectionContact,
),
Text(
(e.longName != null && e.longName!.isNotEmpty)
? '${e.longName} (${e.info})'
: '${e.title} (${e.info})',
Expanded(
child: Text(
(e.longName != null && e.longName!.isNotEmpty)
? '${e.longName} (${e.info})'
: '${e.title} (${e.info})',
overflow: TextOverflow.ellipsis,
),
),
],
),
Expand Down

0 comments on commit d8ba70b

Please sign in to comment.