File tree Expand file tree Collapse file tree 2 files changed +29
-18
lines changed
Expand file tree Collapse file tree 2 files changed +29
-18
lines changed Original file line number Diff line number Diff line change @@ -172,21 +172,27 @@ class _LightboxPageLayoutState extends State<_LightboxPageLayout> {
172172 shape: const Border (), // Remove bottom border from [AppBarTheme]
173173 elevation: appBarElevation,
174174
175- // TODO(#41): Show message author's avatar
176- title: RichText (
177- text: TextSpan (children: [
178- TextSpan (
179- text: '${widget .message .senderFullName }\n ' ,
180-
181- // Restate default
182- style: themeData.textTheme.titleLarge! .copyWith (color: appBarForegroundColor)),
183- TextSpan (
184- text: timestampText,
185-
186- // Make smaller, like a subtitle
187- style: themeData.textTheme.titleSmall! .copyWith (color: appBarForegroundColor)),
188- ])),
189- bottom: widget.buildAppBarBottom (context));
175+ title: Row (
176+ children: [
177+ Avatar (size: 40 , borderRadius: 32 / 8 , userId: widget.message.senderId),
178+ const SizedBox (width: 8 ),
179+ Expanded (
180+ child: RichText (
181+ text: TextSpan (children: [
182+ TextSpan (
183+ text: '${widget .message .senderFullName }\n ' ,
184+ // Restate default
185+ style: themeData.textTheme.titleLarge! .copyWith (color: appBarForegroundColor)),
186+ TextSpan (
187+ text: timestampText,
188+ // Make smaller, like a subtitle
189+ style: themeData.textTheme.titleSmall! .copyWith (color: appBarForegroundColor)),
190+ ])),
191+ ),
192+ ],
193+ ),
194+ bottom: widget.buildAppBarBottom (context)
195+ );
190196 }
191197
192198 Widget ? bottomAppBar;
Original file line number Diff line number Diff line change @@ -236,14 +236,19 @@ void main() {
236236 debugNetworkImageHttpClientProvider = null ;
237237 });
238238
239- testWidgets ('app bar shows sender name and date' , (tester) async {
239+ testWidgets ('app bar shows sender avatar, name and date' , (tester) async {
240240 prepareBoringImageHttpClient ();
241241 final timestamp = DateTime .parse ("2024-07-23 23:12:24" ).millisecondsSinceEpoch ~ / 1000 ;
242242 final message = eg.streamMessage (sender: eg.otherUser, timestamp: timestamp);
243243 await setupPage (tester, message: message, thumbnailUrl: null );
244244
245- // We're looking for a RichText, in the app bar, with both the
246- // sender's name and the timestamp.
245+ // Check Avatar properties
246+ final avatar = tester.widget <Avatar >(find.byType (Avatar ));
247+ check (avatar.size).equals (40 );
248+ check (avatar.borderRadius).equals (32 / 8 );
249+ check (avatar.userId).equals (message.senderId);
250+
251+ // Check sender name and timestamp
247252 final labelTextWidget = tester.widget <RichText >(
248253 find.descendant (of: find.byType (AppBar ).last,
249254 matching: find.textContaining (findRichText: true ,
You can’t perform that action at this time.
0 commit comments