Make history timeago text wrappable
This commit is contained in:
parent
45122b1670
commit
bae237cdf7
|
|
@ -145,7 +145,10 @@ class _HistoryListTileState extends State<HistoryListTile> {
|
|||
clientId: clientId)
|
||||
: entity.listDisplayName);
|
||||
|
||||
subtitle = Text(localization.lookup('${history.entityType}'));
|
||||
subtitle = Text(
|
||||
localization.lookup('${history.entityType}'),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
|
|
@ -154,13 +157,25 @@ class _HistoryListTileState extends State<HistoryListTile> {
|
|||
child: ListTile(
|
||||
key: ValueKey('__${history.id}_${history.entityType}__'),
|
||||
leading: Icon(getEntityIcon(history.entityType)),
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
// TODO this needs to be localized
|
||||
trailing: LiveText(
|
||||
() => timeago.format(history.dateTime,
|
||||
locale: localeSelector(state, twoLetter: true) + '_short'),
|
||||
duration: Duration(minutes: 1),
|
||||
title: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
title,
|
||||
subtitle,
|
||||
],
|
||||
)),
|
||||
Flexible(
|
||||
child: LiveText(
|
||||
() => timeago.format(history.dateTime,
|
||||
locale: localeSelector(state, twoLetter: true) + '_short'),
|
||||
duration: Duration(minutes: 1),
|
||||
maxLines: 2,
|
||||
))
|
||||
],
|
||||
),
|
||||
/*
|
||||
trailing: _isHovered
|
||||
|
|
|
|||
|
|
@ -5,11 +5,17 @@ import 'dart:async';
|
|||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class LiveText extends StatefulWidget {
|
||||
const LiveText(this.value, {this.style, this.duration});
|
||||
const LiveText(
|
||||
this.value, {
|
||||
this.style,
|
||||
this.duration,
|
||||
this.maxLines = 1,
|
||||
});
|
||||
|
||||
final Duration duration;
|
||||
final Function value;
|
||||
final TextStyle style;
|
||||
final int maxLines;
|
||||
|
||||
@override
|
||||
_LiveTextState createState() => _LiveTextState();
|
||||
|
|
@ -45,7 +51,7 @@ class _LiveTextState extends State<LiveText> {
|
|||
return Text(
|
||||
value,
|
||||
style: widget.style,
|
||||
maxLines: 1,
|
||||
maxLines: widget.maxLines,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue