build method
dynamic
build( - dynamic context,
- dynamic ref
)
Implementation
@override
Widget build(BuildContext context, WidgetRef ref) {
final roomId = news.roomId().toString();
final userId = ref.watch(myUserIdStrProvider);
final isLikedByMe = ref.watch(likedByMeProvider(news));
final likesCount = ref.watch(totalLikesForNewsProvider(news));
final space = ref.watch(briefSpaceItemProvider(roomId));
final style = Theme.of(context).textTheme.bodyLarge!.copyWith(fontSize: 13);
return Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
const Spacer(),
LikeButton(
isLiked: isLikedByMe.valueOrNull ?? false,
likeCount: likesCount.valueOrNull ?? 0,
style: style,
color: Theme.of(context).colorScheme.textColor,
index: index,
onTap: () async {
final manager = await ref.read(newsReactionsProvider(news).future);
final status = manager.likedByMe();
_log.info('my like status: $status');
if (!status) {
await manager.sendLike();
} else {
await manager.redactLike(null, null);
}
},
),
const SizedBox(height: 10),
InkWell(
key: NewsUpdateKeys.newsSidebarActionBottomSheet,
onTap: () => showModalBottomSheet(
context: context,
builder: (context) => DefaultBottomSheet(
content: ActionBox(
news: news,
userId: userId,
roomId: roomId,
),
),
),
child: _SideBarItem(
icon: const Icon(Atlas.dots_horizontal_thin),
label: '',
style: style,
),
),
const SizedBox(height: 10),
ActerAvatar(
options: AvatarOptions(
AvatarInfo(
uniqueId: roomId,
displayName: space.avatarInfo.displayName,
avatar: space.avatarInfo.avatar,
onAvatarTap: () => goToSpace(context, roomId),
),
size: 42,
),
),
const SizedBox(height: 15),
],
);
}