Add shortTitle to entity presenter for ViewScaffold title
This commit is contained in:
parent
f04425c770
commit
ed50b921b8
|
|
@ -106,7 +106,7 @@ class _EntityListTileState extends State<EntityListTile> {
|
|||
onLongPress: () =>
|
||||
inspectEntity(entity: widget.entity, longPress: true),
|
||||
title: Text(
|
||||
EntityPresenter().initialize(widget.entity, context).title,
|
||||
EntityPresenter().initialize(widget.entity, context).title(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class EntityStateTitle extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
String titleText = '';
|
||||
if (entity.isOld) {
|
||||
titleText = EntityPresenter().initialize(entity, context).title;
|
||||
titleText = EntityPresenter().initialize(entity, context).title();
|
||||
}
|
||||
|
||||
return Text(
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class EntityTopFilter extends StatelessWidget {
|
|||
child: Text(
|
||||
EntityPresenter()
|
||||
.initialize(filterEntity, context)
|
||||
.title,
|
||||
.title(),
|
||||
style: TextStyle(
|
||||
fontSize: 17, color: state.headerTextColor),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class EntityPresenter {
|
|||
BaseEntity entity;
|
||||
BuildContext context;
|
||||
|
||||
String get title {
|
||||
String title({bool isShort = false}) {
|
||||
final localization = AppLocalization.of(context);
|
||||
final type = localization.lookup('${entity.entityType}');
|
||||
var name = entity.listDisplayName;
|
||||
|
|
@ -36,7 +36,7 @@ class EntityPresenter {
|
|||
EntityType.user,
|
||||
EntityType.product,
|
||||
].contains(entity.entityType) ||
|
||||
isMobile(context)) {
|
||||
(isMobile(context) && isShort)) {
|
||||
return name;
|
||||
} else if (isMobile(context)) {
|
||||
return '$type $name';
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ class ViewScaffold extends StatelessWidget {
|
|||
? localization.pending
|
||||
: entity.listDisplayName;
|
||||
if (!(isFilter ?? false)) {
|
||||
title = EntityPresenter().initialize(entity, context).title;
|
||||
final presenter = EntityPresenter().initialize(entity, context);
|
||||
title = presenter.title(isShort: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,9 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
|
|||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Text(
|
||||
EntityPresenter().initialize(client, context).title,
|
||||
EntityPresenter()
|
||||
.initialize(client, context)
|
||||
.title(),
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
|
|
|||
|
|
@ -221,8 +221,9 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
EntityPresenter().initialize(invoice, context).title),
|
||||
child: Text(EntityPresenter()
|
||||
.initialize(invoice, context)
|
||||
.title()),
|
||||
),
|
||||
if (isDesktop(context)) ...activitySelector,
|
||||
if (isDesktop(context)) ...pageSelector,
|
||||
|
|
|
|||
Loading…
Reference in New Issue