File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 11import 'package:flutter/material.dart' ;
22import 'package:flutter/scheduler.dart' ;
33import 'package:flutter/services.dart' ;
4- import 'package:intl/intl.dart' ;
54import 'package:video_player/video_player.dart' ;
65
76import '../api/core.dart' ;
@@ -12,6 +11,7 @@ import '../model/binding.dart';
1211import 'actions.dart' ;
1312import 'content.dart' ;
1413import 'dialog.dart' ;
14+ import 'message_list.dart' ;
1515import 'page.dart' ;
1616import 'store.dart' ;
1717import 'user.dart' ;
@@ -176,11 +176,8 @@ class _LightboxPageLayoutState extends State<_LightboxPageLayout> {
176176
177177 PreferredSizeWidget ? appBar;
178178 if (_headerFooterVisible) {
179- // TODO(#45): Format with e.g. "Yesterday at 4:47 PM"
180- final timestampText = DateFormat
181- .yMMMd (/* TODO(#278): Pass selected language here, I think? */ )
182- .add_Hms ()
183- .format (DateTime .fromMillisecondsSinceEpoch (widget.message.timestamp * 1000 ));
179+ final timestampText = MessageTimestampStyle .lightbox
180+ .format (widget.message.timestamp);
184181
185182 // We use plain [AppBar] instead of [ZulipAppBar], even though this page
186183 // has a [PerAccountStore], because:
Original file line number Diff line number Diff line change @@ -1987,6 +1987,9 @@ enum MessageTimestampStyle {
19871987 none,
19881988 timeOnly,
19891989
1990+ // TODO(#45): E.g. "Yesterday at 4:47 PM"; see details in #45
1991+ lightbox,
1992+
19901993 /// The longest format, with full date and time as numbers, not "Today"/etc.
19911994 ///
19921995 /// For UI contexts focused just on the one message,
@@ -2002,6 +2005,7 @@ enum MessageTimestampStyle {
20022005 ;
20032006
20042007 static final _timeOnlyFormat = DateFormat ('h:mm aa' , 'en_US' );
2008+ static final _lightboxFormat = DateFormat .yMMMd ().add_Hms ();
20052009 static final _fullFormat = DateFormat .yMMMd ().add_jm ();
20062010
20072011 /// Format a [Message.timestamp] for this mode.
@@ -2013,6 +2017,7 @@ enum MessageTimestampStyle {
20132017 switch (this ) {
20142018 case none: return null ;
20152019 case timeOnly: return _timeOnlyFormat.format (asDateTime);
2020+ case lightbox: return _lightboxFormat.format (asDateTime);
20162021 case full: return _fullFormat.format (asDateTime);
20172022 }
20182023 }
You can’t perform that action at this time.
0 commit comments