WIP #183
This commit is contained in:
@ -1,16 +1,22 @@
|
||||
part of '../main.dart';
|
||||
|
||||
class EntityIcon extends StatelessWidget {
|
||||
|
||||
final EdgeInsetsGeometry padding;
|
||||
final double iconSize;
|
||||
|
||||
const EntityIcon({Key key, this.iconSize: Sizes.iconSize, this.padding: const EdgeInsets.fromLTRB(
|
||||
Sizes.leftWidgetPadding, 0.0, 12.0, 0.0)}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final entityModel = EntityModel.of(context);
|
||||
return GestureDetector(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
Sizes.leftWidgetPadding, 0.0, 12.0, 0.0),
|
||||
padding: padding,
|
||||
child: MaterialDesignIcons.createIconWidgetFromEntityData(
|
||||
entityModel.entity,
|
||||
Sizes.iconSize,
|
||||
iconSize,
|
||||
EntityColor.stateColor(entityModel.entity.state)
|
||||
),
|
||||
),
|
||||
|
@ -1,16 +1,21 @@
|
||||
part of '../main.dart';
|
||||
|
||||
class EntityName extends StatelessWidget {
|
||||
|
||||
final EdgeInsetsGeometry padding;
|
||||
|
||||
const EntityName({Key key, this.padding: const EdgeInsets.only(right: 10.0)}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final entityModel = EntityModel.of(context);
|
||||
return GestureDetector(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
padding: padding,
|
||||
child: Text(
|
||||
"${entityModel.entity.displayName}",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: false,
|
||||
softWrap: true,
|
||||
style: TextStyle(fontSize: Sizes.nameFontSize),
|
||||
),
|
||||
),
|
||||
|
30
lib/entity_widgets/glance_entity_container.dart
Normal file
30
lib/entity_widgets/glance_entity_container.dart
Normal file
@ -0,0 +1,30 @@
|
||||
part of '../main.dart';
|
||||
|
||||
class GlanceEntityContainer extends StatelessWidget {
|
||||
GlanceEntityContainer({
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
EntityName(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
),
|
||||
EntityIcon(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
iconSize: Sizes.largeIconSize,
|
||||
),
|
||||
SimpleEntityState(
|
||||
textAlign: TextAlign.center,
|
||||
expanded: false,
|
||||
padding: EdgeInsets.all(0.0),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -3,18 +3,20 @@ part of '../../main.dart';
|
||||
class SimpleEntityState extends StatelessWidget {
|
||||
|
||||
final bool expanded;
|
||||
final TextAlign textAlign;
|
||||
final EdgeInsetsGeometry padding;
|
||||
|
||||
const SimpleEntityState({Key key, this.expanded: true}) : super(key: key);
|
||||
const SimpleEntityState({Key key, this.expanded: true, this.textAlign: TextAlign.right, this.padding: const EdgeInsets.fromLTRB(0.0, 0.0, Sizes.rightWidgetPadding, 0.0)}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final entityModel = EntityModel.of(context);
|
||||
Widget result = Padding(
|
||||
padding: EdgeInsets.fromLTRB(0.0, 0.0, Sizes.rightWidgetPadding, 0.0),
|
||||
padding: padding,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
"${entityModel.entity.state}${entityModel.entity.unitOfMeasurement}",
|
||||
textAlign: TextAlign.right,
|
||||
textAlign: textAlign,
|
||||
maxLines: 4,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
softWrap: true,
|
||||
|
Reference in New Issue
Block a user