WIP #183 Custom names and icons
This commit is contained in:
@ -11,7 +11,7 @@ class EntitiesCardWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if ((card.linkedEntity!= null) && (card.linkedEntity.isHidden)) {
|
||||
if ((card.linkedEntity!= null) && (card.linkedEntity.entity.isHidden)) {
|
||||
return Container(width: 0.0, height: 0.0,);
|
||||
}
|
||||
List<Widget> body = [];
|
||||
@ -24,12 +24,16 @@ class EntitiesCardWidget extends StatelessWidget {
|
||||
|
||||
List<Widget> _buildCardBody(BuildContext context) {
|
||||
List<Widget> result = [];
|
||||
card.entities.forEach((Entity entity) {
|
||||
if (!entity.isHidden) {
|
||||
card.entities.forEach((EntityWrapper entity) {
|
||||
if (!entity.entity.isHidden) {
|
||||
result.add(
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(0.0, Sizes.rowPadding, 0.0, Sizes.rowPadding),
|
||||
child: entity.buildDefaultWidget(context),
|
||||
child: EntityModel(
|
||||
entity: entity,
|
||||
handleTap: true,
|
||||
child: entity.entity.buildDefaultWidget(context)
|
||||
),
|
||||
));
|
||||
}
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ class GlanceCardWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if ((card.linkedEntity!= null) && (card.linkedEntity.isHidden)) {
|
||||
if ((card.linkedEntity!= null) && (card.linkedEntity.entity.isHidden)) {
|
||||
return Container(width: 0.0, height: 0.0,);
|
||||
}
|
||||
List<Widget> rows = [];
|
||||
@ -25,14 +25,18 @@ class GlanceCardWidget extends StatelessWidget {
|
||||
Widget _buildRows(BuildContext context) {
|
||||
List<Widget> result = [];
|
||||
double width = MediaQuery.of(context).size.width - Sizes.leftWidgetPadding - (2*Sizes.rightWidgetPadding);
|
||||
List<Entity> toShow = card.entities.where((entity) {return !entity.isHidden;}).toList();
|
||||
List<EntityWrapper> toShow = card.entities.where((entity) {return !entity.entity.isHidden;}).toList();
|
||||
int columnsCount = toShow.length >= card.columnsCount ? card.columnsCount : toShow.length;
|
||||
card.entities.forEach((Entity entity) {
|
||||
if (!entity.isHidden) {
|
||||
card.entities.forEach((EntityWrapper entity) {
|
||||
if (!entity.entity.isHidden) {
|
||||
result.add(
|
||||
SizedBox(
|
||||
width: width / columnsCount,
|
||||
child: entity.buildGlanceWidget(context),
|
||||
child: EntityModel(
|
||||
entity: entity,
|
||||
child: entity.entity.buildGlanceWidget(context, card.showName, card.showState),
|
||||
handleTap: true
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class MediaControlCardWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if ((card.linkedEntity == null) || (card.linkedEntity.isHidden)) {
|
||||
if ((card.linkedEntity == null) || (card.linkedEntity.entity.isHidden)) {
|
||||
return Container(width: 0.0, height: 0.0,);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class UnsupportedCardWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if ((card.linkedEntity!= null) && (card.linkedEntity.isHidden)) {
|
||||
if ((card.linkedEntity!= null) && (card.linkedEntity.entity.isHidden)) {
|
||||
return Container(width: 0.0, height: 0.0,);
|
||||
}
|
||||
List<Widget> body = [];
|
||||
@ -32,7 +32,11 @@ class UnsupportedCardWidget extends StatelessWidget {
|
||||
result.addAll(<Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(0.0, Sizes.rowPadding, 0.0, Sizes.rowPadding),
|
||||
child: card.linkedEntity.buildDefaultWidget(context),
|
||||
child: EntityModel(
|
||||
entity: card.linkedEntity,
|
||||
handleTap: true,
|
||||
child: card.linkedEntity.entity.buildDefaultWidget(context)
|
||||
),
|
||||
)
|
||||
]);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user