From d5baabdd5399231ba6c8640415d29cae5d7badf7 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Mon, 9 Sep 2019 18:50:35 +0300 Subject: [PATCH 01/36] Project structure changes --- .../badge.dart => entities/badge.widget.dart} | 2 +- .../camera/widgets}/camera_stream_view.dart | 2 +- .../climate/widgets}/mode_selector.dart | 2 +- .../climate/widgets}/mode_swicth.dart | 2 +- .../default_entity_container.widget.dart} | 0 .../entity_colors.class.dart | 0 .../entity_icon.widget.dart} | 0 .../entity_model.widget.dart} | 0 .../entity_name.widget.dart} | 0 .../flat_service_button.widget.dart} | 2 +- .../light/widgets}/light_color_picker.dart | 2 +- .../missed_entity.widget.dart} | 0 .../simple_state.widget.dart} | 2 +- .../universal_slider.widget.dart} | 2 +- lib/main.dart | 48 +++++++++---------- .../widgets}/entity_attributes_list.dart | 0 .../entity_page_container.widget.dart} | 2 +- .../widgets}/last_updated.dart | 0 .../history_chart/combined_history_chart.dart | 0 .../history_chart/entity_history.dart | 0 .../history_chart/entity_history_moment.dart | 0 .../history_chart/history_control_widget.dart | 0 .../numeric_state_history_chart.dart | 0 .../simple_state_history_chart.dart | 0 lib/{ => utils}/mdi.class.dart | 2 +- 25 files changed, 34 insertions(+), 34 deletions(-) rename lib/{entity_widgets/common/badge.dart => entities/badge.widget.dart} (99%) rename lib/{entity_widgets/common => entities/camera/widgets}/camera_stream_view.dart (97%) rename lib/{entity_widgets/common => entities/climate/widgets}/mode_selector.dart (98%) rename lib/{entity_widgets/common => entities/climate/widgets}/mode_swicth.dart (97%) rename lib/{entity_widgets/default_entity_container.dart => entities/default_entity_container.widget.dart} (100%) rename lib/{entity_widgets => entities}/entity_colors.class.dart (100%) rename lib/{entity_widgets/entity_icon.dart => entities/entity_icon.widget.dart} (100%) rename lib/{entity_widgets/model_widgets.dart => entities/entity_model.widget.dart} (100%) rename lib/{entity_widgets/entity_name.dart => entities/entity_name.widget.dart} (100%) rename lib/{entity_widgets/common/flat_service_button.dart => entities/flat_service_button.widget.dart} (97%) rename lib/{entity_widgets/common => entities/light/widgets}/light_color_picker.dart (99%) rename lib/{entity_widgets/missed_entity.dart => entities/missed_entity.widget.dart} (100%) rename lib/{entity_widgets/common/simple_state.dart => entities/simple_state.widget.dart} (98%) rename lib/{entity_widgets/common/universal_slider.dart => entities/universal_slider.widget.dart} (98%) rename lib/{entity_widgets/common => pages/widgets}/entity_attributes_list.dart (100%) rename lib/{entity_widgets/entity_page_container.dart => pages/widgets/entity_page_container.widget.dart} (90%) rename lib/{entity_widgets/common => pages/widgets}/last_updated.dart (100%) rename lib/{entity_widgets => plugins}/history_chart/combined_history_chart.dart (100%) rename lib/{entity_widgets => plugins}/history_chart/entity_history.dart (100%) rename lib/{entity_widgets => plugins}/history_chart/entity_history_moment.dart (100%) rename lib/{entity_widgets => plugins}/history_chart/history_control_widget.dart (100%) rename lib/{entity_widgets => plugins}/history_chart/numeric_state_history_chart.dart (100%) rename lib/{entity_widgets => plugins}/history_chart/simple_state_history_chart.dart (100%) rename lib/{ => utils}/mdi.class.dart (99%) diff --git a/lib/entity_widgets/common/badge.dart b/lib/entities/badge.widget.dart similarity index 99% rename from lib/entity_widgets/common/badge.dart rename to lib/entities/badge.widget.dart index 32080cf..36c8984 100644 --- a/lib/entity_widgets/common/badge.dart +++ b/lib/entities/badge.widget.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../main.dart'; class BadgeWidget extends StatelessWidget { @override diff --git a/lib/entity_widgets/common/camera_stream_view.dart b/lib/entities/camera/widgets/camera_stream_view.dart similarity index 97% rename from lib/entity_widgets/common/camera_stream_view.dart rename to lib/entities/camera/widgets/camera_stream_view.dart index 4e62a6e..9300100 100644 --- a/lib/entity_widgets/common/camera_stream_view.dart +++ b/lib/entities/camera/widgets/camera_stream_view.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../../../main.dart'; class CameraStreamView extends StatefulWidget { diff --git a/lib/entity_widgets/common/mode_selector.dart b/lib/entities/climate/widgets/mode_selector.dart similarity index 98% rename from lib/entity_widgets/common/mode_selector.dart rename to lib/entities/climate/widgets/mode_selector.dart index 365933f..d77f130 100644 --- a/lib/entity_widgets/common/mode_selector.dart +++ b/lib/entities/climate/widgets/mode_selector.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../../../main.dart'; class ModeSelectorWidget extends StatelessWidget { diff --git a/lib/entity_widgets/common/mode_swicth.dart b/lib/entities/climate/widgets/mode_swicth.dart similarity index 97% rename from lib/entity_widgets/common/mode_swicth.dart rename to lib/entities/climate/widgets/mode_swicth.dart index d34ca3e..9051fd9 100644 --- a/lib/entity_widgets/common/mode_swicth.dart +++ b/lib/entities/climate/widgets/mode_swicth.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../../../main.dart'; class ModeSwitchWidget extends StatelessWidget { diff --git a/lib/entity_widgets/default_entity_container.dart b/lib/entities/default_entity_container.widget.dart similarity index 100% rename from lib/entity_widgets/default_entity_container.dart rename to lib/entities/default_entity_container.widget.dart diff --git a/lib/entity_widgets/entity_colors.class.dart b/lib/entities/entity_colors.class.dart similarity index 100% rename from lib/entity_widgets/entity_colors.class.dart rename to lib/entities/entity_colors.class.dart diff --git a/lib/entity_widgets/entity_icon.dart b/lib/entities/entity_icon.widget.dart similarity index 100% rename from lib/entity_widgets/entity_icon.dart rename to lib/entities/entity_icon.widget.dart diff --git a/lib/entity_widgets/model_widgets.dart b/lib/entities/entity_model.widget.dart similarity index 100% rename from lib/entity_widgets/model_widgets.dart rename to lib/entities/entity_model.widget.dart diff --git a/lib/entity_widgets/entity_name.dart b/lib/entities/entity_name.widget.dart similarity index 100% rename from lib/entity_widgets/entity_name.dart rename to lib/entities/entity_name.widget.dart diff --git a/lib/entity_widgets/common/flat_service_button.dart b/lib/entities/flat_service_button.widget.dart similarity index 97% rename from lib/entity_widgets/common/flat_service_button.dart rename to lib/entities/flat_service_button.widget.dart index 405d6a1..6dc4612 100644 --- a/lib/entity_widgets/common/flat_service_button.dart +++ b/lib/entities/flat_service_button.widget.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../main.dart'; class FlatServiceButton extends StatelessWidget { diff --git a/lib/entity_widgets/common/light_color_picker.dart b/lib/entities/light/widgets/light_color_picker.dart similarity index 99% rename from lib/entity_widgets/common/light_color_picker.dart rename to lib/entities/light/widgets/light_color_picker.dart index f3052f3..0ca6a45 100644 --- a/lib/entity_widgets/common/light_color_picker.dart +++ b/lib/entities/light/widgets/light_color_picker.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../../../main.dart'; class LightColorPicker extends StatefulWidget { diff --git a/lib/entity_widgets/missed_entity.dart b/lib/entities/missed_entity.widget.dart similarity index 100% rename from lib/entity_widgets/missed_entity.dart rename to lib/entities/missed_entity.widget.dart diff --git a/lib/entity_widgets/common/simple_state.dart b/lib/entities/simple_state.widget.dart similarity index 98% rename from lib/entity_widgets/common/simple_state.dart rename to lib/entities/simple_state.widget.dart index eb68ec4..47ffe36 100644 --- a/lib/entity_widgets/common/simple_state.dart +++ b/lib/entities/simple_state.widget.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../main.dart'; class SimpleEntityState extends StatelessWidget { diff --git a/lib/entity_widgets/common/universal_slider.dart b/lib/entities/universal_slider.widget.dart similarity index 98% rename from lib/entity_widgets/common/universal_slider.dart rename to lib/entities/universal_slider.widget.dart index 3ce9739..cc17104 100644 --- a/lib/entity_widgets/common/universal_slider.dart +++ b/lib/entities/universal_slider.widget.dart @@ -1,4 +1,4 @@ -part of '../../main.dart'; +part of '../main.dart'; class UniversalSlider extends StatelessWidget { diff --git a/lib/main.dart b/lib/main.dart index a4f6414..03c4af3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -51,35 +51,35 @@ part 'entities/fan/fan_entity.class.dart'; part 'entities/automation/automation_entity.class.dart'; part 'entities/camera/camera_entity.class.dart'; part 'entities/alarm_control_panel/alarm_control_panel_entity.class.dart'; -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 'entities/badge.widget.dart'; +part 'entities/entity_model.widget.dart'; +part 'entities/default_entity_container.widget.dart'; +part 'entities/missed_entity.widget.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'; -part 'entity_widgets/common/last_updated.dart'; -part 'entity_widgets/common/mode_swicth.dart'; -part 'entity_widgets/common/mode_selector.dart'; -part 'entity_widgets/common/universal_slider.dart'; -part 'entity_widgets/common/flat_service_button.dart'; -part 'entity_widgets/common/light_color_picker.dart'; -part 'entity_widgets/common/camera_stream_view.dart'; -part 'entity_widgets/entity_colors.class.dart'; -part 'entity_widgets/entity_page_container.dart'; -part 'entity_widgets/history_chart/entity_history.dart'; -part 'entity_widgets/history_chart/simple_state_history_chart.dart'; -part 'entity_widgets/history_chart/numeric_state_history_chart.dart'; -part 'entity_widgets/history_chart/combined_history_chart.dart'; -part 'entity_widgets/history_chart/history_control_widget.dart'; -part 'entity_widgets/history_chart/entity_history_moment.dart'; +part 'pages/widgets/entity_attributes_list.dart'; +part 'entities/entity_icon.widget.dart'; +part 'entities/entity_name.widget.dart'; +part 'pages/widgets/last_updated.dart'; +part 'entities/climate/widgets/mode_swicth.dart'; +part 'entities/climate/widgets/mode_selector.dart'; +part 'entities/universal_slider.widget.dart'; +part 'entities/flat_service_button.widget.dart'; +part 'entities/light/widgets/light_color_picker.dart'; +part 'entities/camera/widgets/camera_stream_view.dart'; +part 'entities/entity_colors.class.dart'; +part 'pages/widgets/entity_page_container.widget.dart'; +part 'plugins/history_chart/entity_history.dart'; +part 'plugins/history_chart/simple_state_history_chart.dart'; +part 'plugins/history_chart/numeric_state_history_chart.dart'; +part 'plugins/history_chart/combined_history_chart.dart'; +part 'plugins/history_chart/history_control_widget.dart'; +part 'plugins/history_chart/entity_history_moment.dart'; part 'entities/switch/widget/switch_state.dart'; part 'entities/slider/widgets/slider_controls.dart'; part 'entities/text/widgets/text_input_state.dart'; part 'entities/select/widgets/select_state.dart'; -part 'entity_widgets/common/simple_state.dart'; +part 'entities/simple_state.widget.dart'; part 'entities/timer/widgets/timer_state.dart'; part 'entities/climate/widgets/climate_state.widget.dart'; part 'entities/cover/widgets/cover_state.dart'; @@ -102,7 +102,7 @@ part 'pages/main.page.dart'; part 'home_assistant.class.dart'; part 'pages/log.page.dart'; part 'pages/entity.page.dart'; -part 'mdi.class.dart'; +part 'utils/mdi.class.dart'; part 'entity_collection.class.dart'; part 'managers/auth_manager.class.dart'; part 'managers/location_manager.class.dart'; diff --git a/lib/entity_widgets/common/entity_attributes_list.dart b/lib/pages/widgets/entity_attributes_list.dart similarity index 100% rename from lib/entity_widgets/common/entity_attributes_list.dart rename to lib/pages/widgets/entity_attributes_list.dart diff --git a/lib/entity_widgets/entity_page_container.dart b/lib/pages/widgets/entity_page_container.widget.dart similarity index 90% rename from lib/entity_widgets/entity_page_container.dart rename to lib/pages/widgets/entity_page_container.widget.dart index 2b09eff..5573e12 100644 --- a/lib/entity_widgets/entity_page_container.dart +++ b/lib/pages/widgets/entity_page_container.widget.dart @@ -1,4 +1,4 @@ -part of '../main.dart'; +part of '../../main.dart'; class EntityPageContainer extends StatelessWidget { EntityPageContainer({Key key, @required this.children}) : super(key: key); diff --git a/lib/entity_widgets/common/last_updated.dart b/lib/pages/widgets/last_updated.dart similarity index 100% rename from lib/entity_widgets/common/last_updated.dart rename to lib/pages/widgets/last_updated.dart diff --git a/lib/entity_widgets/history_chart/combined_history_chart.dart b/lib/plugins/history_chart/combined_history_chart.dart similarity index 100% rename from lib/entity_widgets/history_chart/combined_history_chart.dart rename to lib/plugins/history_chart/combined_history_chart.dart diff --git a/lib/entity_widgets/history_chart/entity_history.dart b/lib/plugins/history_chart/entity_history.dart similarity index 100% rename from lib/entity_widgets/history_chart/entity_history.dart rename to lib/plugins/history_chart/entity_history.dart diff --git a/lib/entity_widgets/history_chart/entity_history_moment.dart b/lib/plugins/history_chart/entity_history_moment.dart similarity index 100% rename from lib/entity_widgets/history_chart/entity_history_moment.dart rename to lib/plugins/history_chart/entity_history_moment.dart diff --git a/lib/entity_widgets/history_chart/history_control_widget.dart b/lib/plugins/history_chart/history_control_widget.dart similarity index 100% rename from lib/entity_widgets/history_chart/history_control_widget.dart rename to lib/plugins/history_chart/history_control_widget.dart diff --git a/lib/entity_widgets/history_chart/numeric_state_history_chart.dart b/lib/plugins/history_chart/numeric_state_history_chart.dart similarity index 100% rename from lib/entity_widgets/history_chart/numeric_state_history_chart.dart rename to lib/plugins/history_chart/numeric_state_history_chart.dart diff --git a/lib/entity_widgets/history_chart/simple_state_history_chart.dart b/lib/plugins/history_chart/simple_state_history_chart.dart similarity index 100% rename from lib/entity_widgets/history_chart/simple_state_history_chart.dart rename to lib/plugins/history_chart/simple_state_history_chart.dart diff --git a/lib/mdi.class.dart b/lib/utils/mdi.class.dart similarity index 99% rename from lib/mdi.class.dart rename to lib/utils/mdi.class.dart index 069fc93..63af439 100644 --- a/lib/mdi.class.dart +++ b/lib/utils/mdi.class.dart @@ -1,4 +1,4 @@ -part of 'main.dart'; +part of '../main.dart'; class MaterialDesignIcons { static final Map defaultIconsByDomains = { From 9c28b0085bfb77356804fd975dfbb469649eaa05 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Tue, 10 Sep 2019 15:40:49 +0300 Subject: [PATCH 02/36] Tablet UI in progress --- lib/const.dart | 1 + lib/view.dart | 96 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 76 insertions(+), 21 deletions(-) diff --git a/lib/const.dart b/lib/const.dart index 6e7c99e..9da7af2 100644 --- a/lib/const.dart +++ b/lib/const.dart @@ -113,4 +113,5 @@ class Sizes { static const inputWidth = 160.0; static const rowPadding = 10.0; static const doubleRowPadding = rowPadding*2; + static const minViewColumnWidth = 350; } \ No newline at end of file diff --git a/lib/view.dart b/lib/view.dart index e6e2d06..7a3ee9a 100644 --- a/lib/view.dart +++ b/lib/view.dart @@ -32,9 +32,19 @@ class ViewWidgetState extends State { ); } else { return ListView( - padding: EdgeInsets.all(0.0), - //physics: const AlwaysScrollableScrollPhysics(), - children: _buildChildren(context), + shrinkWrap: true, + padding: EdgeInsets.all(0), + children: [ + ConstrainedBox( + constraints: BoxConstraints(maxHeight: 3000), + child: CustomMultiChildLayout( + delegate: ViewLayoutBuilder( + cardsCount: widget.view.cards.length + ), + children: _buildChildren(context), + ), + ) + ], ); } } @@ -49,34 +59,31 @@ class ViewWidgetState extends State { List _buildChildren(BuildContext context) { List result = []; + int layoutChildId = 0; if (widget.view.badges.isNotEmpty) { - result.insert(0, - Wrap( - alignment: WrapAlignment.center, - spacing: 10.0, - runSpacing: 1.0, - children: _buildBadges(context), + result.add( + LayoutId( + id: "badges", + child: Wrap( + alignment: WrapAlignment.center, + spacing: 10.0, + runSpacing: 1.0, + children: _buildBadges(context), + ), ) ); } - - List cards = []; widget.view.cards.forEach((HACard card){ - cards.add( - ConstrainedBox( - constraints: BoxConstraints(maxWidth: 500), + result.add( + LayoutId( + id: 'card_$layoutChildId', child: card.build(context), ) ); + layoutChildId += 1; }); - result.add( - Column ( - children: cards, - ) - ); - return result; } @@ -84,7 +91,9 @@ class ViewWidgetState extends State { List result = []; widget.view.badges.forEach((Entity entity) { if (!entity.isHidden) { - result.add(entity.buildBadgeWidget(context)); + result.add( + entity.buildBadgeWidget(context) + ); } }); return result; @@ -95,5 +104,50 @@ class ViewWidgetState extends State { super.dispose(); } +} +class ViewLayoutBuilder extends MultiChildLayoutDelegate { + final int cardsCount; + + ViewLayoutBuilder({@required this.cardsCount}); + + @override + void performLayout(Size size) { + int columnsCount = (size.width ~/ Sizes.minViewColumnWidth); + double columnWidth = size.width / columnsCount; + List columnXPositions = []; + List columnYPositions = []; + double startY = 0; + if (hasChild("badges")) { + Size badgesSizes = layoutChild( + 'badges', BoxConstraints.tightFor(width: size.width)); + startY += badgesSizes.height; + positionChild('badges', Offset(0, 0)); + } + for (int i =0; i < columnsCount; i++) { + columnXPositions.add(i*columnWidth); + columnYPositions.add(startY); + } + for (int i = 0; i < cardsCount; i++) { + final String cardId = 'card_$i'; + + if (hasChild(cardId)) { + int columnToAdd = 0; + double minYPosition = columnYPositions[0]; + for (int i=1; i false; } \ No newline at end of file From a3a60dd707f4b8513a976bcede53cbbb101a2eb7 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 13:36:37 +0300 Subject: [PATCH 03/36] Create no-response.yml --- .github/no-response.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/no-response.yml diff --git a/.github/no-response.yml b/.github/no-response.yml new file mode 100644 index 0000000..e0e8617 --- /dev/null +++ b/.github/no-response.yml @@ -0,0 +1,11 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 14 +# Label requiring a response +responseRequiredLabel: more info needed +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. If the issue still relevant + feel free to reopen this issue and add more information, or report a new one. From a64aa73aae7e72f3f0706088deb4075704d57403 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:00:16 +0300 Subject: [PATCH 04/36] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..b814fc4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,41 @@ +--- +name: Bug report +about: Create a report to help improve HA Client +title: '' +labels: '' +assignees: '' + +--- + + +**HA Client version:** + +**Home Assistant version:** + +**Device name:** + +**Android version:** + +**Connection type:** + +**Login type:** + +**Description** + + +**Screenshots** + + +**Logs** + +``` +[Replace this text with your logs] +``` From c4663576d18a531f6d88443792082f5bf2beb1b0 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:05:45 +0300 Subject: [PATCH 05/36] Update issue templates --- .../ISSUE_TEMPLATE/entity-support-request.md | 12 ++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 17 +++++++++++++++++ .../lovelace-card-implementation-request.md | 12 ++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/entity-support-request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md diff --git a/.github/ISSUE_TEMPLATE/entity-support-request.md b/.github/ISSUE_TEMPLATE/entity-support-request.md new file mode 100644 index 0000000..6534418 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/entity-support-request.md @@ -0,0 +1,12 @@ +--- +name: Entity support request +about: Suggest to add support of any entity type +title: '' +labels: feature/improvement, ENTITY +assignees: '' + +--- + +**Entity type:** + +**Link to documentation:** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..29b288f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for HA Client if it is not a card or entity support +title: '' +labels: feature/improvement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md b/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md new file mode 100644 index 0000000..859313d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md @@ -0,0 +1,12 @@ +--- +name: Lovelace card implementation request +about: Suggest to add any Lovelace card support +title: '' +labels: feature/improvement, CARD +assignees: '' + +--- + +**Card name:** + +**Link to card repository or web page:** From 76bf07cfcddb0195a86a55ed311c68a4527b2124 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:06:44 +0300 Subject: [PATCH 06/36] Update issue templates --- .github/ISSUE_TEMPLATE/entity-support-request.md | 2 +- .../ISSUE_TEMPLATE/lovelace-card-support-request.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/lovelace-card-support-request.md diff --git a/.github/ISSUE_TEMPLATE/entity-support-request.md b/.github/ISSUE_TEMPLATE/entity-support-request.md index 6534418..c529d38 100644 --- a/.github/ISSUE_TEMPLATE/entity-support-request.md +++ b/.github/ISSUE_TEMPLATE/entity-support-request.md @@ -2,7 +2,7 @@ name: Entity support request about: Suggest to add support of any entity type title: '' -labels: feature/improvement, ENTITY +labels: ENTITY, feature/improvement assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/lovelace-card-support-request.md b/.github/ISSUE_TEMPLATE/lovelace-card-support-request.md new file mode 100644 index 0000000..998fabf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/lovelace-card-support-request.md @@ -0,0 +1,12 @@ +--- +name: Lovelace Card support request +about: Suggest to add any Lovelace card support +title: '' +labels: CARD, feature/improvement +assignees: '' + +--- + +**Card name:** + +**Link to card repository or web page:** From 555f305c22dd284324ea089d32d84bf814260630 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:07:24 +0300 Subject: [PATCH 07/36] Delete lovelace-card-implementation-request.md --- .../lovelace-card-implementation-request.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md diff --git a/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md b/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md deleted file mode 100644 index 859313d..0000000 --- a/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: Lovelace card implementation request -about: Suggest to add any Lovelace card support -title: '' -labels: feature/improvement, CARD -assignees: '' - ---- - -**Card name:** - -**Link to card repository or web page:** From dc5db28e01ea409b260a15bb0dd33cbb056e175c Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Thu, 12 Sep 2019 17:08:40 +0300 Subject: [PATCH 08/36] Packages update --- ios/Flutter/flutter_export_environment.sh | 10 ++++++++++ pubspec.lock | 20 ++++++++++---------- pubspec.yaml | 6 +++--- 3 files changed, 23 insertions(+), 13 deletions(-) create mode 100755 ios/Flutter/flutter_export_environment.sh diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..b7ea8ef --- /dev/null +++ b/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/home/estevez/sdk/flutter" +export "FLUTTER_APPLICATION_PATH=/home/estevez/src/ha_client" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "FLUTTER_FRAMEWORK_DIR=/home/estevez/sdk/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_BUILD_NAME=0.6.6" +export "FLUTTER_BUILD_NUMBER=660" diff --git a/pubspec.lock b/pubspec.lock index a90ac41..ce6d395 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,14 +21,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.3.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" cached_network_image: dependency: "direct main" description: @@ -77,7 +77,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" date_format: dependency: "direct main" description: @@ -138,7 +138,7 @@ packages: name: flutter_local_notifications url: "https://pub.dartlang.org" source: hosted - version: "0.8.2" + version: "0.8.2+1" flutter_markdown: dependency: "direct main" description: @@ -152,7 +152,7 @@ packages: name: flutter_secure_storage url: "https://pub.dartlang.org" source: hosted - version: "3.2.1+1" + version: "3.3.1" flutter_test: dependency: "direct dev" description: flutter @@ -234,14 +234,14 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.1.7" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "1.6.4" path_provider: dependency: transitive description: @@ -255,7 +255,7 @@ packages: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0+1" petitparser: dependency: transitive description: @@ -283,7 +283,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.5" share: dependency: "direct main" description: @@ -339,7 +339,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" synchronized: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 88209fa..1fa6816 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,11 +21,11 @@ dependencies: in_app_purchase: ^0.2.1+3 # flutter_svg: ^0.10.3 flutter_custom_tabs: ^0.6.0 - firebase_messaging: ^5.1.4 + firebase_messaging: ^5.1.5 flutter_webview_plugin: ^0.3.7 - flutter_secure_storage: ^3.2.1+1 + flutter_secure_storage: ^3.3.1 device_info: ^0.4.0+2 - flutter_local_notifications: ^0.8.2 + flutter_local_notifications: ^0.8.2+1 share: git: url: https://github.com/d-silveira/flutter-share.git From ecf0a696f79812fbccfcbf189ad7f0579369b95c Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 13:36:37 +0300 Subject: [PATCH 09/36] Create no-response.yml --- .github/no-response.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/no-response.yml diff --git a/.github/no-response.yml b/.github/no-response.yml new file mode 100644 index 0000000..e0e8617 --- /dev/null +++ b/.github/no-response.yml @@ -0,0 +1,11 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 14 +# Label requiring a response +responseRequiredLabel: more info needed +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. If the issue still relevant + feel free to reopen this issue and add more information, or report a new one. From 7ecfc8a9ffb9fe4605fd2f936309f98baca7c5e8 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:00:16 +0300 Subject: [PATCH 10/36] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..b814fc4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,41 @@ +--- +name: Bug report +about: Create a report to help improve HA Client +title: '' +labels: '' +assignees: '' + +--- + + +**HA Client version:** + +**Home Assistant version:** + +**Device name:** + +**Android version:** + +**Connection type:** + +**Login type:** + +**Description** + + +**Screenshots** + + +**Logs** + +``` +[Replace this text with your logs] +``` From bcf3dab0e2f1ce49f7ca312d7dcdd87689248eca Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:05:45 +0300 Subject: [PATCH 11/36] Update issue templates --- .../ISSUE_TEMPLATE/entity-support-request.md | 12 ++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 17 +++++++++++++++++ .../lovelace-card-implementation-request.md | 12 ++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/entity-support-request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md diff --git a/.github/ISSUE_TEMPLATE/entity-support-request.md b/.github/ISSUE_TEMPLATE/entity-support-request.md new file mode 100644 index 0000000..6534418 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/entity-support-request.md @@ -0,0 +1,12 @@ +--- +name: Entity support request +about: Suggest to add support of any entity type +title: '' +labels: feature/improvement, ENTITY +assignees: '' + +--- + +**Entity type:** + +**Link to documentation:** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..29b288f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for HA Client if it is not a card or entity support +title: '' +labels: feature/improvement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md b/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md new file mode 100644 index 0000000..859313d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md @@ -0,0 +1,12 @@ +--- +name: Lovelace card implementation request +about: Suggest to add any Lovelace card support +title: '' +labels: feature/improvement, CARD +assignees: '' + +--- + +**Card name:** + +**Link to card repository or web page:** From 092469d668ed3e95b3aa845d5469fc7604e5561c Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:06:44 +0300 Subject: [PATCH 12/36] Update issue templates --- .github/ISSUE_TEMPLATE/entity-support-request.md | 2 +- .../ISSUE_TEMPLATE/lovelace-card-support-request.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/lovelace-card-support-request.md diff --git a/.github/ISSUE_TEMPLATE/entity-support-request.md b/.github/ISSUE_TEMPLATE/entity-support-request.md index 6534418..c529d38 100644 --- a/.github/ISSUE_TEMPLATE/entity-support-request.md +++ b/.github/ISSUE_TEMPLATE/entity-support-request.md @@ -2,7 +2,7 @@ name: Entity support request about: Suggest to add support of any entity type title: '' -labels: feature/improvement, ENTITY +labels: ENTITY, feature/improvement assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/lovelace-card-support-request.md b/.github/ISSUE_TEMPLATE/lovelace-card-support-request.md new file mode 100644 index 0000000..998fabf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/lovelace-card-support-request.md @@ -0,0 +1,12 @@ +--- +name: Lovelace Card support request +about: Suggest to add any Lovelace card support +title: '' +labels: CARD, feature/improvement +assignees: '' + +--- + +**Card name:** + +**Link to card repository or web page:** From 9e2c67396680bf2c47fb47c38da5a5cffe2ba7e7 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Thu, 12 Sep 2019 14:07:24 +0300 Subject: [PATCH 13/36] Delete lovelace-card-implementation-request.md --- .../lovelace-card-implementation-request.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md diff --git a/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md b/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md deleted file mode 100644 index 859313d..0000000 --- a/.github/ISSUE_TEMPLATE/lovelace-card-implementation-request.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: Lovelace card implementation request -about: Suggest to add any Lovelace card support -title: '' -labels: feature/improvement, CARD -assignees: '' - ---- - -**Card name:** - -**Link to card repository or web page:** From 298a64b7ae0c5be50690052597d2a7e14c296bc0 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Thu, 12 Sep 2019 17:08:40 +0300 Subject: [PATCH 14/36] Packages update --- ios/Flutter/flutter_export_environment.sh | 10 ++++++++++ pubspec.lock | 20 ++++++++++---------- pubspec.yaml | 6 +++--- 3 files changed, 23 insertions(+), 13 deletions(-) create mode 100755 ios/Flutter/flutter_export_environment.sh diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..b7ea8ef --- /dev/null +++ b/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/home/estevez/sdk/flutter" +export "FLUTTER_APPLICATION_PATH=/home/estevez/src/ha_client" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "FLUTTER_FRAMEWORK_DIR=/home/estevez/sdk/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_BUILD_NAME=0.6.6" +export "FLUTTER_BUILD_NUMBER=660" diff --git a/pubspec.lock b/pubspec.lock index a90ac41..ce6d395 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,14 +21,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.3.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" cached_network_image: dependency: "direct main" description: @@ -77,7 +77,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" date_format: dependency: "direct main" description: @@ -138,7 +138,7 @@ packages: name: flutter_local_notifications url: "https://pub.dartlang.org" source: hosted - version: "0.8.2" + version: "0.8.2+1" flutter_markdown: dependency: "direct main" description: @@ -152,7 +152,7 @@ packages: name: flutter_secure_storage url: "https://pub.dartlang.org" source: hosted - version: "3.2.1+1" + version: "3.3.1" flutter_test: dependency: "direct dev" description: flutter @@ -234,14 +234,14 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.1.7" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "1.6.4" path_provider: dependency: transitive description: @@ -255,7 +255,7 @@ packages: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0+1" petitparser: dependency: transitive description: @@ -283,7 +283,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.5" share: dependency: "direct main" description: @@ -339,7 +339,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" synchronized: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 88209fa..1fa6816 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,11 +21,11 @@ dependencies: in_app_purchase: ^0.2.1+3 # flutter_svg: ^0.10.3 flutter_custom_tabs: ^0.6.0 - firebase_messaging: ^5.1.4 + firebase_messaging: ^5.1.5 flutter_webview_plugin: ^0.3.7 - flutter_secure_storage: ^3.2.1+1 + flutter_secure_storage: ^3.3.1 device_info: ^0.4.0+2 - flutter_local_notifications: ^0.8.2 + flutter_local_notifications: ^0.8.2+1 share: git: url: https://github.com/d-silveira/flutter-share.git From d61103ac4270c97fef51881a3d428e4c3c4f3911 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Sat, 14 Sep 2019 12:14:54 +0300 Subject: [PATCH 15/36] WIP #224 Dynamic multi column view --- lib/main.dart | 1 + lib/plugins/DynamicMultiColumnLayout.dart | 146 ++++++++++++++++++++++ lib/view.dart | 20 +-- pubspec.lock | 4 +- 4 files changed, 162 insertions(+), 9 deletions(-) create mode 100644 lib/plugins/DynamicMultiColumnLayout.dart diff --git a/lib/main.dart b/lib/main.dart index 03c4af3..f062ef6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,6 +25,7 @@ import 'package:in_app_purchase/in_app_purchase.dart'; import 'plugins/circular_slider/single_circular_slider.dart'; import 'package:share/receive_share_state.dart'; import 'package:share/share.dart'; +import 'plugins/DynamicMultiColumnLayout.dart'; import 'utils/logger.dart'; diff --git a/lib/plugins/DynamicMultiColumnLayout.dart b/lib/plugins/DynamicMultiColumnLayout.dart new file mode 100644 index 0000000..116462f --- /dev/null +++ b/lib/plugins/DynamicMultiColumnLayout.dart @@ -0,0 +1,146 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'dart:math' as math; + +class DynamicMultiColumnLayout extends MultiChildRenderObjectWidget { + + final int minColumnWidth; + + DynamicMultiColumnLayout({ + Key key, + this.minColumnWidth: 350, + List children = const [], + }) : super(key: key, children: children); + + @override + RenderCustomLayoutBox createRenderObject(BuildContext context) { + return RenderCustomLayoutBox(minColumnWidth: this.minColumnWidth); + } + +} + +class RenderCustomLayoutBox extends RenderBox + with ContainerRenderObjectMixin, + RenderBoxContainerDefaultsMixin { + + final int minColumnWidth; + + RenderCustomLayoutBox({ + this.minColumnWidth, + List children, + }) { + addAll(children); + } + + @override + void setupParentData(RenderBox child) { + if (child.parentData is! CustomLayoutParentData) { + child.parentData = CustomLayoutParentData(); + } + } + + double _getIntrinsicHeight(double childSize(RenderBox child)) { + double inflexibleSpace = 0.0; + RenderBox child = firstChild; + while (child != null) { + inflexibleSpace += childSize(child); + final FlexParentData childParentData = child.parentData; + child = childParentData.nextSibling; + } + return inflexibleSpace; + } + + double _getIntrinsicWidth(double childSize(RenderBox child)) { + double maxSpace = 0.0; + RenderBox child = firstChild; + while (child != null) { + maxSpace = math.max(maxSpace, childSize(child)); + final FlexParentData childParentData = child.parentData; + child = childParentData.nextSibling; + } + return maxSpace; + } + + @override + double computeMinIntrinsicWidth(double height) { + return _getIntrinsicWidth((RenderBox child) => child.getMinIntrinsicWidth(height)); + } + + @override + double computeMaxIntrinsicWidth(double height) { + return _getIntrinsicWidth((RenderBox child) => child.getMaxIntrinsicWidth(height)); + } + + @override + double computeMinIntrinsicHeight(double width) { + return _getIntrinsicHeight((RenderBox child) => child.getMinIntrinsicHeight(width)); + } + + @override + double computeMaxIntrinsicHeight(double width) { + return _getIntrinsicHeight((RenderBox child) => child.getMaxIntrinsicHeight(width)); + } + + @override + void performLayout() { + int columnsCount; + List columnXPositions = []; + List columnYPositions = []; + if (childCount == 0) { + size = constraints.biggest; + assert(size.isFinite); + return; + } + + columnsCount = (constraints.maxWidth ~/ this.minColumnWidth); + double columnWidth = constraints.maxWidth / columnsCount; + double startY = 0; + for (int i =0; i < columnsCount; i++) { + columnXPositions.add(i*columnWidth); + columnYPositions.add(startY); + } + RenderBox child = firstChild; + while (child != null) { + final CustomLayoutParentData childParentData = child.parentData; + + int columnToAdd = 0; + double minYPosition = columnYPositions[0]; + for (int i=0; i height) { + height = columnYPositions[i]; + } + } + + size = Size(width, height); + } + + @override + void paint(PaintingContext context, Offset offset) { + defaultPaint(context, offset); + } + + @override + bool hitTestChildren(HitTestResult result, { Offset position }) { + return defaultHitTestChildren(result, position: position); + } +} + +class CustomLayoutParentData extends ContainerBoxParentData { + +} \ No newline at end of file diff --git a/lib/view.dart b/lib/view.dart index 7a3ee9a..b3eef0b 100644 --- a/lib/view.dart +++ b/lib/view.dart @@ -31,6 +31,16 @@ class ViewWidgetState extends State { child: _buildPanelChild(context), ); } else { + return ListView( + shrinkWrap: true, + padding: EdgeInsets.all(0), + children: [ + DynamicMultiColumnLayout( + minColumnWidth: Sizes.minViewColumnWidth, + children: _buildChildren(context), + ) + ] + ); return ListView( shrinkWrap: true, padding: EdgeInsets.all(0), @@ -61,7 +71,7 @@ class ViewWidgetState extends State { List result = []; int layoutChildId = 0; - if (widget.view.badges.isNotEmpty) { + /*if (widget.view.badges.isNotEmpty) { result.add( LayoutId( id: "badges", @@ -73,15 +83,11 @@ class ViewWidgetState extends State { ), ) ); - } + }*/ widget.view.cards.forEach((HACard card){ result.add( - LayoutId( - id: 'card_$layoutChildId', - child: card.build(context), - ) + card.build(context) ); - layoutChildId += 1; }); return result; diff --git a/pubspec.lock b/pubspec.lock index ce6d395..9d96ec2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -164,7 +164,7 @@ packages: name: flutter_webview_plugin url: "https://pub.dartlang.org" source: hosted - version: "0.3.7" + version: "0.3.8" http: dependency: transitive description: @@ -374,7 +374,7 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.1.2" + version: "5.1.3" uuid: dependency: transitive description: From 20ffe03139b6634d7c7ba50107b5e0f0183aad55 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Sat, 14 Sep 2019 12:31:50 +0300 Subject: [PATCH 16/36] View widget improvements --- lib/main.dart | 2 +- lib/view.dart | 159 ------------------------------------- lib/viewWidget.widget.dart | 56 +++++++++++++ pubspec.yaml | 2 +- 4 files changed, 58 insertions(+), 161 deletions(-) delete mode 100644 lib/view.dart create mode 100644 lib/viewWidget.widget.dart diff --git a/lib/main.dart b/lib/main.dart index f062ef6..03f4efd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -115,7 +115,7 @@ part 'ui.dart'; part 'view.class.dart'; part 'cards/card.class.dart'; part 'panels/panel_class.dart'; -part 'view.dart'; +part 'viewWidget.widget.dart'; part 'cards/card_widget.dart'; part 'cards/widgets/card_header.widget.dart'; part 'panels/config_panel_widget.dart'; diff --git a/lib/view.dart b/lib/view.dart deleted file mode 100644 index b3eef0b..0000000 --- a/lib/view.dart +++ /dev/null @@ -1,159 +0,0 @@ -part of 'main.dart'; - -class ViewWidget extends StatefulWidget { - final HAView view; - - const ViewWidget({ - Key key, - this.view - }) : super(key: key); - - @override - State createState() { - return ViewWidgetState(); - } - -} - -class ViewWidgetState extends State { - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - if (widget.view.panel) { - return FractionallySizedBox( - widthFactor: 1, - heightFactor: 1, - child: _buildPanelChild(context), - ); - } else { - return ListView( - shrinkWrap: true, - padding: EdgeInsets.all(0), - children: [ - DynamicMultiColumnLayout( - minColumnWidth: Sizes.minViewColumnWidth, - children: _buildChildren(context), - ) - ] - ); - return ListView( - shrinkWrap: true, - padding: EdgeInsets.all(0), - children: [ - ConstrainedBox( - constraints: BoxConstraints(maxHeight: 3000), - child: CustomMultiChildLayout( - delegate: ViewLayoutBuilder( - cardsCount: widget.view.cards.length - ), - children: _buildChildren(context), - ), - ) - ], - ); - } - } - - Widget _buildPanelChild(BuildContext context) { - if (widget.view.cards != null && widget.view.cards.isNotEmpty) { - return widget.view.cards[0].build(context); - } else { - return Container(width: 0, height: 0); - } - } - - List _buildChildren(BuildContext context) { - List result = []; - int layoutChildId = 0; - - /*if (widget.view.badges.isNotEmpty) { - result.add( - LayoutId( - id: "badges", - child: Wrap( - alignment: WrapAlignment.center, - spacing: 10.0, - runSpacing: 1.0, - children: _buildBadges(context), - ), - ) - ); - }*/ - widget.view.cards.forEach((HACard card){ - result.add( - card.build(context) - ); - }); - - return result; - } - - List _buildBadges(BuildContext context) { - List result = []; - widget.view.badges.forEach((Entity entity) { - if (!entity.isHidden) { - result.add( - entity.buildBadgeWidget(context) - ); - } - }); - return result; - } - - @override - void dispose() { - super.dispose(); - } - -} - -class ViewLayoutBuilder extends MultiChildLayoutDelegate { - final int cardsCount; - - ViewLayoutBuilder({@required this.cardsCount}); - - @override - void performLayout(Size size) { - int columnsCount = (size.width ~/ Sizes.minViewColumnWidth); - double columnWidth = size.width / columnsCount; - List columnXPositions = []; - List columnYPositions = []; - double startY = 0; - if (hasChild("badges")) { - Size badgesSizes = layoutChild( - 'badges', BoxConstraints.tightFor(width: size.width)); - startY += badgesSizes.height; - positionChild('badges', Offset(0, 0)); - } - for (int i =0; i < columnsCount; i++) { - columnXPositions.add(i*columnWidth); - columnYPositions.add(startY); - } - for (int i = 0; i < cardsCount; i++) { - final String cardId = 'card_$i'; - - if (hasChild(cardId)) { - int columnToAdd = 0; - double minYPosition = columnYPositions[0]; - for (int i=1; i false; -} \ No newline at end of file diff --git a/lib/viewWidget.widget.dart b/lib/viewWidget.widget.dart new file mode 100644 index 0000000..ab620d7 --- /dev/null +++ b/lib/viewWidget.widget.dart @@ -0,0 +1,56 @@ +part of 'main.dart'; + +class ViewWidget extends StatelessWidget { + final HAView view; + + const ViewWidget({ + Key key, + this.view + }) : super(key: key); + + @override + Widget build(BuildContext context) { + if (this.view.panel) { + return FractionallySizedBox( + widthFactor: 1, + heightFactor: 1, + child: _buildPanelChild(context), + ); + } else { + return ListView( + shrinkWrap: true, + padding: EdgeInsets.all(0), + children: [ + _buildBadges(context), + DynamicMultiColumnLayout( + minColumnWidth: Sizes.minViewColumnWidth, + children: this.view.cards.map((card) => card.build(context)).toList(), + ) + ] + ); + } + } + + Widget _buildPanelChild(BuildContext context) { + if (this.view.cards != null && this.view.cards.isNotEmpty) { + return this.view.cards[0].build(context); + } else { + return Container(width: 0, height: 0); + } + } + + Widget _buildBadges(BuildContext context) { + if (this.view.badges.isNotEmpty) { + return Wrap( + alignment: WrapAlignment.center, + spacing: 10.0, + runSpacing: 1.0, + children: this.view.badges.map((badge) => + badge.buildBadgeWidget(context)).toList(), + ); + } else { + return Container(width: 0, height: 0,); + } + } + +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 1fa6816..e285b17 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: # flutter_svg: ^0.10.3 flutter_custom_tabs: ^0.6.0 firebase_messaging: ^5.1.5 - flutter_webview_plugin: ^0.3.7 + flutter_webview_plugin: ^0.3.8 flutter_secure_storage: ^3.3.1 device_info: ^0.4.0+2 flutter_local_notifications: ^0.8.2+1 From 6da7a5ab9058d471b96595148451ac9115253e8f Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Sat, 14 Sep 2019 18:32:44 +0300 Subject: [PATCH 17/36] Resolves #224 Main UI tablet support --- android/app/src/main/AndroidManifest.xml | 3 + lib/cards/card_widget.dart | 2 +- lib/const.dart | 3 + lib/entities/badge.widget.dart | 2 +- lib/entities/entity.class.dart | 61 ++++-- lib/entities/entity_wrapper.class.dart | 4 +- .../light/widgets/light_color_picker.dart | 1 - .../widgets/media_player_widgets.dart | 2 +- lib/main.dart | 1 - lib/pages/entity.page.dart | 28 ++- lib/pages/main.page.dart | 186 +++++++++++------- lib/pages/play_media.page.dart | 2 +- .../widgets/entity_page_container.widget.dart | 14 -- lib/plugins/DynamicMultiColumnLayout.dart | 5 +- lib/types/event_bus_events.dart | 4 +- 15 files changed, 194 insertions(+), 124 deletions(-) delete mode 100644 lib/pages/widgets/entity_page_container.widget.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 43fa34a..6a160c4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,9 @@ + +