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 1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:flutter/scheduler.dart' ;
3
3
import 'package:flutter/services.dart' ;
4
- import 'package:intl/intl.dart' ;
5
4
import 'package:video_player/video_player.dart' ;
6
5
7
6
import '../api/core.dart' ;
@@ -12,6 +11,7 @@ import '../model/binding.dart';
12
11
import 'actions.dart' ;
13
12
import 'content.dart' ;
14
13
import 'dialog.dart' ;
14
+ import 'message_list.dart' ;
15
15
import 'page.dart' ;
16
16
import 'store.dart' ;
17
17
import 'user.dart' ;
@@ -176,11 +176,8 @@ class _LightboxPageLayoutState extends State<_LightboxPageLayout> {
176
176
177
177
PreferredSizeWidget ? appBar;
178
178
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);
184
181
185
182
// We use plain [AppBar] instead of [ZulipAppBar], even though this page
186
183
// has a [PerAccountStore], because:
Original file line number Diff line number Diff line change @@ -1987,6 +1987,9 @@ enum MessageTimestampStyle {
1987
1987
none,
1988
1988
timeOnly,
1989
1989
1990
+ // TODO(#45): E.g. "Yesterday at 4:47 PM"; see details in #45
1991
+ lightbox,
1992
+
1990
1993
/// The longest format, with full date and time as numbers, not "Today"/etc.
1991
1994
///
1992
1995
/// For UI contexts focused just on the one message,
@@ -2002,6 +2005,7 @@ enum MessageTimestampStyle {
2002
2005
;
2003
2006
2004
2007
static final _timeOnlyFormat = DateFormat ('h:mm aa' , 'en_US' );
2008
+ static final _lightboxFormat = DateFormat .yMMMd ().add_Hms ();
2005
2009
static final _fullFormat = DateFormat .yMMMd ().add_jm ();
2006
2010
2007
2011
/// Format a [Message.timestamp] for this mode.
@@ -2013,6 +2017,7 @@ enum MessageTimestampStyle {
2013
2017
switch (this ) {
2014
2018
case none: return null ;
2015
2019
case timeOnly: return _timeOnlyFormat.format (asDateTime);
2020
+ case lightbox: return _lightboxFormat.format (asDateTime);
2016
2021
case full: return _fullFormat.format (asDateTime);
2017
2022
}
2018
2023
}
You can’t perform that action at this time.
0 commit comments