Resolves #348 Glance card improvements
This commit is contained in:
parent
6650c5c145
commit
37e63637a7
@ -220,13 +220,21 @@ class CardWidget extends StatelessWidget {
|
|||||||
List<Widget> rows = [];
|
List<Widget> rows = [];
|
||||||
rows.add(CardHeaderWidget(name: card.name));
|
rows.add(CardHeaderWidget(name: card.name));
|
||||||
|
|
||||||
List<Widget> result = [];
|
|
||||||
int columnsCount = entitiesToShow.length >= card.columnsCount ? card.columnsCount : entitiesToShow.length;
|
int columnsCount = entitiesToShow.length >= card.columnsCount ? card.columnsCount : entitiesToShow.length;
|
||||||
|
|
||||||
|
rows.add(
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: Sizes.rowPadding, top: Sizes.rowPadding),
|
||||||
|
child: FractionallySizedBox(
|
||||||
|
widthFactor: 1,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
|
List<Widget> buttons = [];
|
||||||
|
double buttonWidth = constraints.maxWidth / columnsCount;
|
||||||
entitiesToShow.forEach((EntityWrapper entity) {
|
entitiesToShow.forEach((EntityWrapper entity) {
|
||||||
result.add(
|
buttons.add(
|
||||||
FractionallySizedBox(
|
SizedBox(
|
||||||
widthFactor: 1/columnsCount,
|
width: buttonWidth,
|
||||||
child: EntityModel(
|
child: EntityModel(
|
||||||
entityWrapper: entity,
|
entityWrapper: entity,
|
||||||
child: GlanceEntityContainer(
|
child: GlanceEntityContainer(
|
||||||
@ -238,19 +246,23 @@ class CardWidget extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
rows.add(
|
return Wrap(
|
||||||
Padding(
|
//spacing: 5.0,
|
||||||
padding: EdgeInsets.fromLTRB(0.0, Sizes.rowPadding, 0.0, 2*Sizes.rowPadding),
|
//alignment: WrapAlignment.spaceEvenly,
|
||||||
child: Wrap(
|
|
||||||
//alignment: WrapAlignment.spaceAround,
|
|
||||||
runSpacing: Sizes.rowPadding*2,
|
runSpacing: Sizes.rowPadding*2,
|
||||||
children: result,
|
children: buttons,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
child: new Column(mainAxisSize: MainAxisSize.min, children: rows)
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: rows
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,15 +54,10 @@ class GlanceEntityContainer extends StatelessWidget {
|
|||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: InkResponse(
|
child: InkResponse(
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(minWidth: Sizes.iconSize * 2),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
//mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
//crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: result,
|
children: result,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
onTap: () => entityWrapper.handleTap(),
|
onTap: () => entityWrapper.handleTap(),
|
||||||
onLongPress: () => entityWrapper.handleHold(),
|
onLongPress: () => entityWrapper.handleHold(),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user