Skip to content

Commit 04832ef

Browse files
committed
lightbox: added avatar image to top app bar
1 parent 30f7abe commit 04832ef

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

lib/widgets/lightbox.dart

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,32 @@ class _LightboxPageState extends State<_LightboxPage> {
140140
.add_Hms()
141141
.format(DateTime.fromMillisecondsSinceEpoch(widget.message.timestamp * 1000));
142142

143+
final avatarUrl = widget.message.avatarUrl == null // TODO get from user data
144+
? null // TODO handle computing gravatars
145+
: resolveUrl(widget.message.avatarUrl!, PerAccountStoreWidget.of(context).account,
146+
);
147+
148+
final avatar = avatarUrl != null
149+
? Padding(
150+
padding: const EdgeInsets.fromLTRB(8.0,4,0,0),
151+
child: Container(
152+
clipBehavior: Clip.antiAlias,
153+
width: 35,
154+
height: 35,
155+
decoration: const BoxDecoration(
156+
borderRadius: BorderRadius.all(Radius.circular(4))),
157+
child: RealmContentNetworkImage(avatarUrl),
158+
),
159+
)
160+
: const SizedBox.shrink();
161+
162+
143163
appBar = AppBar(
144164
centerTitle: false,
145165
foregroundColor: appBarForegroundColor,
146166
backgroundColor: appBarBackgroundColor,
147-
148-
// TODO(#41): Show message author's avatar
167+
leading: avatar,
168+
actions: const [CloseButton()],
149169
title: RichText(
150170
text: TextSpan(children: [
151171
TextSpan(

0 commit comments

Comments
 (0)