Project structure change
This commit is contained in:
		| @@ -1,4 +1,4 @@ | ||||
| part of '../../main.dart'; | ||||
| part of '../main.dart'; | ||||
| 
 | ||||
| class CardWidget extends StatelessWidget { | ||||
| 
 | ||||
| @@ -127,7 +127,7 @@ class CardWidget extends StatelessWidget { | ||||
|       return Container(height: 0.0, width: 0.0,); | ||||
|     } | ||||
|     List<Widget> body = []; | ||||
|     body.add(CardHeaderWidget(name: card.name)); | ||||
|     body.add(CardHeader(name: card.name)); | ||||
|     entitiesToShow.forEach((EntityWrapper entity) { | ||||
|       if (!entity.entity.isHidden) { | ||||
|         body.add( | ||||
| @@ -154,7 +154,7 @@ class CardWidget extends StatelessWidget { | ||||
|       return Container(height: 0.0, width: 0.0,); | ||||
|     } | ||||
|     List<Widget> body = []; | ||||
|     body.add(CardHeaderWidget(name: card.name)); | ||||
|     body.add(CardHeader(name: card.name)); | ||||
|     body.add(MarkdownBody(data: card.content)); | ||||
|     return Card( | ||||
|         child: Padding( | ||||
| @@ -166,7 +166,7 @@ class CardWidget extends StatelessWidget { | ||||
| 
 | ||||
|   Widget _buildAlarmPanelCard(BuildContext context) { | ||||
|     List<Widget> body = []; | ||||
|     body.add(CardHeaderWidget( | ||||
|     body.add(CardHeader( | ||||
|       name: card.name ?? "", | ||||
|       subtitle: Text("${card.linkedEntityWrapper.entity.displayState}", | ||||
|         style: TextStyle( | ||||
| @@ -218,7 +218,7 @@ class CardWidget extends StatelessWidget { | ||||
|       return Container(height: 0.0, width: 0.0,); | ||||
|     } | ||||
|     List<Widget> rows = []; | ||||
|     rows.add(CardHeaderWidget(name: card.name)); | ||||
|     rows.add(CardHeader(name: card.name)); | ||||
| 
 | ||||
|     int columnsCount = entitiesToShow.length >= card.columnsCount ? card.columnsCount : entitiesToShow.length; | ||||
| 
 | ||||
| @@ -237,7 +237,7 @@ class CardWidget extends StatelessWidget { | ||||
|                           width: buttonWidth, | ||||
|                           child: EntityModel( | ||||
|                               entityWrapper: entity, | ||||
|                               child: GlanceEntityContainer( | ||||
|                               child: GlanceCardEntityContainer( | ||||
|                                 showName: card.showName, | ||||
|                                 showState: card.showState, | ||||
|                               ), | ||||
| @@ -282,7 +282,7 @@ class CardWidget extends StatelessWidget { | ||||
|     return Card( | ||||
|         child: EntityModel( | ||||
|             entityWrapper: card.linkedEntityWrapper, | ||||
|             child: ButtonEntityContainer(), | ||||
|             child: EntityButtonCardBody(), | ||||
|             handleTap: true | ||||
|         ) | ||||
|     ); | ||||
| @@ -308,7 +308,7 @@ class CardWidget extends StatelessWidget { | ||||
| 
 | ||||
|   Widget _buildUnsupportedCard(BuildContext context) { | ||||
|     List<Widget> body = []; | ||||
|     body.add(CardHeaderWidget(name: card.name ?? "")); | ||||
|     body.add(CardHeader(name: card.name ?? "")); | ||||
|     List<Widget> result = []; | ||||
|     if (card.linkedEntityWrapper != null) { | ||||
|       result.addAll(<Widget>[ | ||||
| @@ -1,12 +1,12 @@ | ||||
| part of '../../main.dart'; | ||||
| 
 | ||||
| class CardHeaderWidget extends StatelessWidget { | ||||
| class CardHeader extends StatelessWidget { | ||||
| 
 | ||||
|   final String name; | ||||
|   final Widget trailing; | ||||
|   final Widget subtitle; | ||||
| 
 | ||||
|   const CardHeaderWidget({Key key, this.name, this.trailing, this.subtitle}) : super(key: key); | ||||
|   const CardHeader({Key key, this.name, this.trailing, this.subtitle}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
| @@ -1,8 +1,8 @@ | ||||
| part of '../../main.dart'; | ||||
| 
 | ||||
| class ButtonEntityContainer extends StatelessWidget { | ||||
| class EntityButtonCardBody extends StatelessWidget { | ||||
| 
 | ||||
|   ButtonEntityContainer({ | ||||
|   EntityButtonCardBody({ | ||||
|     Key key, | ||||
|   }) : super(key: key); | ||||
| 
 | ||||
| @@ -1,6 +1,6 @@ | ||||
| part of '../../main.dart'; | ||||
| 
 | ||||
| class GlanceEntityContainer extends StatelessWidget { | ||||
| class GlanceCardEntityContainer extends StatelessWidget { | ||||
| 
 | ||||
|   final bool showName; | ||||
|   final bool showState; | ||||
| @@ -9,7 +9,7 @@ class GlanceEntityContainer extends StatelessWidget { | ||||
|   final double nameFontSize; | ||||
|   final bool wordsWrapInName; | ||||
| 
 | ||||
|   GlanceEntityContainer({ | ||||
|   GlanceCardEntityContainer({ | ||||
|     Key key, | ||||
|     @required this.showName, | ||||
|     @required this.showState, | ||||
| @@ -97,3 +97,18 @@ class CardType { | ||||
|   static const ALARM_PANEL = "alarm-panel"; | ||||
|   static const MARKDOWN = "markdown"; | ||||
| } | ||||
|  | ||||
| class Sizes { | ||||
|   static const rightWidgetPadding = 10.0; | ||||
|   static const leftWidgetPadding = 10.0; | ||||
|   static const buttonPadding = 4.0; | ||||
|   static const extendedWidgetHeight = 50.0; | ||||
|   static const iconSize = 28.0; | ||||
|   static const largeIconSize = 46.0; | ||||
|   static const stateFontSize = 15.0; | ||||
|   static const nameFontSize = 15.0; | ||||
|   static const smallFontSize = 14.0; | ||||
|   static const largeFontSize = 24.0; | ||||
|   static const inputWidth = 160.0; | ||||
|   static const rowPadding = 10.0; | ||||
| } | ||||
| @@ -51,8 +51,8 @@ part 'entity_widgets/common/badge.dart'; | ||||
| part 'entity_widgets/model_widgets.dart'; | ||||
| part 'entity_widgets/default_entity_container.dart'; | ||||
| part 'entity_widgets/missed_entity.dart'; | ||||
| part 'cards/widgets/glance_entity_container.dart'; | ||||
| part 'cards/widgets/button_entity_container.dart'; | ||||
| part 'cards/widgets/glance_card_entity_container.dart'; | ||||
| part 'cards/widgets/entity_button_card_body.widget.dart'; | ||||
| part 'entity_widgets/common/entity_attributes_list.dart'; | ||||
| part 'entity_widgets/entity_icon.dart'; | ||||
| part 'entity_widgets/entity_name.dart'; | ||||
| @@ -106,14 +106,13 @@ part 'managers/mobile_app_integration_manager.class.dart'; | ||||
| part 'managers/connection_manager.class.dart'; | ||||
| part 'managers/device_info_manager.class.dart'; | ||||
| part 'managers/startup_user_messages_manager.class.dart'; | ||||
| part 'ui_class/ui.dart'; | ||||
| part 'ui_class/view.class.dart'; | ||||
| part 'ui.dart'; | ||||
| part 'view.class.dart'; | ||||
| part 'cards/card.class.dart'; | ||||
| part 'ui_class/sizes_class.dart'; | ||||
| part 'ui_class/panel_class.dart'; | ||||
| part 'ui_widgets/view.dart'; | ||||
| part 'cards/widgets/card_widget.dart'; | ||||
| part 'cards/widgets/card_header_widget.dart'; | ||||
| part 'panels/panel_class.dart'; | ||||
| part 'view.dart'; | ||||
| part 'cards/card_widget.dart'; | ||||
| part 'cards/widgets/card_header.widget.dart'; | ||||
| part 'panels/config_panel_widget.dart'; | ||||
| part 'panels/widgets/link_to_web_config.dart'; | ||||
| part 'utils/logger.dart'; | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| part of '../main.dart'; | ||||
| part of 'main.dart'; | ||||
| 
 | ||||
| class HomeAssistantUI { | ||||
|   List<HAView> views; | ||||
| @@ -1,16 +0,0 @@ | ||||
| part of '../main.dart'; | ||||
|  | ||||
| class Sizes { | ||||
|   static const rightWidgetPadding = 10.0; | ||||
|   static const leftWidgetPadding = 10.0; | ||||
|   static const buttonPadding = 4.0; | ||||
|   static const extendedWidgetHeight = 50.0; | ||||
|   static const iconSize = 28.0; | ||||
|   static const largeIconSize = 46.0; | ||||
|   static const stateFontSize = 15.0; | ||||
|   static const nameFontSize = 15.0; | ||||
|   static const smallFontSize = 14.0; | ||||
|   static const largeFontSize = 24.0; | ||||
|   static const inputWidth = 160.0; | ||||
|   static const rowPadding = 10.0; | ||||
| } | ||||
| @@ -1,4 +1,4 @@ | ||||
| part of '../main.dart'; | ||||
| part of 'main.dart'; | ||||
| 
 | ||||
| class HAView { | ||||
|   List<HACard> cards = []; | ||||
| @@ -1,4 +1,4 @@ | ||||
| part of '../main.dart'; | ||||
| part of 'main.dart'; | ||||
| 
 | ||||
| class ViewWidget extends StatefulWidget { | ||||
|   final HAView view; | ||||
| @@ -41,7 +41,6 @@ class ViewWidgetState extends State<ViewWidget> { | ||||
| 
 | ||||
|   Widget _buildPanelChild(BuildContext context) { | ||||
|     if (widget.view.cards != null && widget.view.cards.isNotEmpty) { | ||||
|       Logger.d("Building panel view. Card ${widget.view.cards[0].type}"); | ||||
|       return widget.view.cards[0].build(context); | ||||
|     } else { | ||||
|       return Container(width: 0, height: 0); | ||||
		Reference in New Issue
	
	Block a user