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