forked from Nexus/nexus
treewide: use dot shorthands where possible
Now this feature is stable, we should use it. I might have missed some usecases, but these can be added in future commits.
This commit is contained in:
parent
6281c1d13a
commit
d2ec5f035b
67 changed files with 391 additions and 534 deletions
|
|
@ -18,52 +18,46 @@ class MessageDisplayname extends ConsumerWidget {
|
|||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) =>
|
||||
switch (ref.watch(AuthorController.provider(event))) {
|
||||
AsyncData(:final value) || AsyncLoading(:final value?) => InkWell(
|
||||
onTapUp: clickable
|
||||
? (details) => context.showUserPopover(
|
||||
value,
|
||||
event.sender,
|
||||
roomId: event.roomId,
|
||||
globalPosition: details.globalPosition,
|
||||
)
|
||||
: null,
|
||||
child: Wrap(
|
||||
spacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
value.displayName ?? event.sender.localpart,
|
||||
style:
|
||||
style ??
|
||||
TextStyle(
|
||||
color: event.sender.colorHash,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Widget build(BuildContext context, WidgetRef ref) => switch (ref.watch(
|
||||
AuthorController.provider(event),
|
||||
)) {
|
||||
AsyncData(:final value) || AsyncLoading(:final value?) => InkWell(
|
||||
onTapUp: clickable
|
||||
? (details) => context.showUserPopover(
|
||||
value,
|
||||
event.sender,
|
||||
roomId: event.roomId,
|
||||
globalPosition: details.globalPosition,
|
||||
)
|
||||
: null,
|
||||
child: Wrap(
|
||||
spacing: 4,
|
||||
crossAxisAlignment: .center,
|
||||
children: [
|
||||
Text(
|
||||
value.displayName ?? event.sender.localpart,
|
||||
style:
|
||||
style ?? .new(color: event.sender.colorHash, fontWeight: .bold),
|
||||
maxLines: 1,
|
||||
overflow: .ellipsis,
|
||||
),
|
||||
|
||||
if (event.pmp != null)
|
||||
Text(
|
||||
"(via ${event.sender})",
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: event.sender.colorHash,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_ => Text(
|
||||
event.sender.localpart,
|
||||
style: TextStyle(
|
||||
color: event.sender.colorHash,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
};
|
||||
if (event.pmp != null)
|
||||
Text(
|
||||
"(via ${event.sender})",
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: event.sender.colorHash,
|
||||
fontWeight: .bold,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: .ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_ => Text(
|
||||
event.sender.localpart,
|
||||
style: .new(color: event.sender.colorHash, fontWeight: .bold),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue