Resolves #224 Main UI tablet support

This commit is contained in:
estevez-dev
2019-09-14 18:32:44 +03:00
parent 20ffe03139
commit 6da7a5ab90
15 changed files with 194 additions and 124 deletions

View File

@ -140,6 +140,6 @@ class BadgeWidget extends StatelessWidget {
],
),
onTap: () =>
eventBus.fire(new ShowEntityPageEvent(entityModel.entityWrapper.entity)));
eventBus.fire(new ShowEntityPageEvent(entity: entityModel.entityWrapper.entity)));
}
}

View File

@ -211,21 +211,56 @@ class Entity {
);
}
Widget buildEntityPageWidget(BuildContext context) {
Widget buildEntityPageWidget(BuildContext context, {bool showClose: false}) {
return EntityModel(
entityWrapper: EntityWrapper(entity: this),
child: EntityPageContainer(children: <Widget>[
Padding(
padding: EdgeInsets.only(top: Sizes.rowPadding, left: Sizes.leftWidgetPadding),
child: DefaultEntityContainer(state: _buildStatePartForPage(context)),
),
LastUpdatedWidget(),
Divider(),
_buildAdditionalControlsForPage(context),
Divider(),
buildHistoryWidget(),
EntityAttributesList()
]),
child: ListView(
padding: EdgeInsets.all(0),
children: <Widget>[
showClose ?
Container(
color: Colors.blue[300],
height: 36,
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 8),
child: Text(
this.displayName,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 22
),
),
),
),
IconButton(
padding: EdgeInsets.all(0),
icon: Icon(Icons.close),
color: Colors.white,
iconSize: 30.0,
onPressed: () {
eventBus.fire(ShowEntityPageEvent());
},
)
],
),
) :
Container(height: 0, width: 0,),
Padding(
padding: EdgeInsets.only(top: Sizes.rowPadding, left: Sizes.leftWidgetPadding),
child: DefaultEntityContainer(state: _buildStatePartForPage(context)),
),
LastUpdatedWidget(),
Divider(),
_buildAdditionalControlsForPage(context),
Divider(),
buildHistoryWidget(),
EntityAttributesList()
]
),
handleTap: false,
);
}

View File

@ -53,7 +53,7 @@ class EntityWrapper {
case EntityUIAction.moreInfo: {
eventBus.fire(
new ShowEntityPageEvent(entity));
new ShowEntityPageEvent(entity: entity));
break;
}
@ -93,7 +93,7 @@ class EntityWrapper {
case EntityUIAction.moreInfo: {
eventBus.fire(
new ShowEntityPageEvent(entity));
new ShowEntityPageEvent(entity: entity));
break;
}

View File

@ -27,7 +27,6 @@ class LightColorPickerState extends State<LightColorPicker> {
List<Widget> colorRows = [];
Border border;
bool isSomethingSelected = false;
Logger.d("Current colotfor picker: [${widget.color.hue}, ${widget.color.saturation}]");
for (double saturation = 1.0; saturation >= (0.0 + widget.saturationStep); saturation = double.parse((saturation - widget.saturationStep).toStringAsFixed(2))) {
List<Widget> rowChildren = [];
//Logger.d("$saturation");

View File

@ -229,7 +229,7 @@ class MediaPlayerPlaybackControls extends StatelessWidget {
IconButton(
icon: Icon(MaterialDesignIcons.getIconDataFromIconName(
"mdi:dots-vertical")),
onPressed: () => eventBus.fire(new ShowEntityPageEvent(entity))
onPressed: () => eventBus.fire(new ShowEntityPageEvent(entity: entity))
)
);
} else if (entity.supportStop && entity.state != EntityState.off && entity.state != EntityState.unavailable) {