diff --git a/lib/entity_widgets/history_chart/combined_history_chart.dart b/lib/entity_widgets/history_chart/combined_history_chart.dart index 4ece6aa..fd97cad 100644 --- a/lib/entity_widgets/history_chart/combined_history_chart.dart +++ b/lib/entity_widgets/history_chart/combined_history_chart.dart @@ -62,9 +62,6 @@ class _CombinedHistoryChartWidgetState extends State listener: (model) => _onSelectionChanged(model), ) ], - behaviors: [ - charts.PanAndZoomBehavior(), - ], ), ) ], diff --git a/lib/entity_widgets/history_chart/numeric_state_history_chart.dart b/lib/entity_widgets/history_chart/numeric_state_history_chart.dart index 98120cc..ef40742 100644 --- a/lib/entity_widgets/history_chart/numeric_state_history_chart.dart +++ b/lib/entity_widgets/history_chart/numeric_state_history_chart.dart @@ -60,9 +60,6 @@ class _NumericStateHistoryChartWidgetState extends State _onSelectionChanged(model), ) ], - behaviors: [ - charts.PanAndZoomBehavior(), - ], ), ) ], diff --git a/lib/entity_widgets/history_chart/simple_state_history_chart.dart b/lib/entity_widgets/history_chart/simple_state_history_chart.dart index 05c3e00..3d7fcd2 100644 --- a/lib/entity_widgets/history_chart/simple_state_history_chart.dart +++ b/lib/entity_widgets/history_chart/simple_state_history_chart.dart @@ -64,9 +64,6 @@ class _SimpleStateHistoryChartWidgetState extends State 0)) { + result = new ListTile( + title: Text("$name", + textAlign: TextAlign.left, + overflow: TextOverflow.ellipsis, + style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 25.0)), + ); + } else { + result = new Container(width: 0.0, height: 0.0); + } + return result; + } + +} \ No newline at end of file diff --git a/lib/ui_widgets/entities_card.dart b/lib/ui_widgets/entities_card.dart index 61750cd..af00381 100644 --- a/lib/ui_widgets/entities_card.dart +++ b/lib/ui_widgets/entities_card.dart @@ -15,28 +15,13 @@ class EntitiesCardWidget extends StatelessWidget { return Container(width: 0.0, height: 0.0,); } List body = []; - body.add(_buildCardHeader()); + body.add(CardHeaderWidget(name: card.name)); body.addAll(_buildCardBody(context)); return Card( child: new Column(mainAxisSize: MainAxisSize.min, children: body) ); } - Widget _buildCardHeader() { - var result; - if ((card.name != null) && (card.name.trim().length > 0)) { - result = new ListTile( - title: Text("${card.name}", - textAlign: TextAlign.left, - overflow: TextOverflow.ellipsis, - style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 25.0)), - ); - } else { - result = new Container(width: 0.0, height: 0.0); - } - return result; - } - List _buildCardBody(BuildContext context) { List result = []; card.entities.forEach((Entity entity) { diff --git a/lib/ui_widgets/unsupported_card.dart b/lib/ui_widgets/unsupported_card.dart index c5d38f5..5a13ab1 100644 --- a/lib/ui_widgets/unsupported_card.dart +++ b/lib/ui_widgets/unsupported_card.dart @@ -15,7 +15,7 @@ class UnsupportedCardWidget extends StatelessWidget { return Container(width: 0.0, height: 0.0,); } List body = []; - body.add(_buildCardHeader()); + body.add(CardHeaderWidget(name: card.name ?? "")); body.addAll(_buildCardBody(context)); return Card( child: new Column( @@ -26,31 +26,27 @@ class UnsupportedCardWidget extends StatelessWidget { ); } - Widget _buildCardHeader() { - return ListTile( - title: Text("${card.name ?? card.type}", - textAlign: TextAlign.left, - overflow: TextOverflow.ellipsis, - style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 25.0)), - ); - } - List _buildCardBody(BuildContext context) { List result = []; - result.addAll([ - Padding( - padding: EdgeInsets.fromLTRB(Entity.leftWidgetPadding, 0.0, Entity.rightWidgetPadding, 0.0), - child: Text("Card type '${card.type}' is not supported yet"), - ), - Padding( - padding: EdgeInsets.fromLTRB(Entity.leftWidgetPadding, Entity.rowPadding, Entity.rightWidgetPadding, 0.0), - child: Text("Linked entity: ${card.linkedEntity?.entityId}"), - ), - Padding( - padding: EdgeInsets.fromLTRB(Entity.leftWidgetPadding, Entity.rowPadding, Entity.rightWidgetPadding, Entity.rowPadding), - child: Text("Child entities: ${card.entities}"), - ), - ]); + if (card.linkedEntity != null) { + result.addAll([ + Padding( + padding: EdgeInsets.fromLTRB(Entity.leftWidgetPadding, Entity.rowPadding, Entity.rightWidgetPadding, 0.0), + child: Text("'${card.type}' card is not supported yet"), + ), + Padding( + padding: EdgeInsets.fromLTRB(0.0, Entity.rowPadding, 0.0, Entity.rowPadding), + child: card.linkedEntity.buildDefaultWidget(context), + ) + ]); + } else { + result.addAll([ + Padding( + padding: EdgeInsets.fromLTRB(Entity.leftWidgetPadding, Entity.rowPadding, Entity.rightWidgetPadding, Entity.rowPadding), + child: Text("'${card.type}' card is not supported yet"), + ), + ]); + } return result; }