2019-09-07 15:47:09 +03:00
|
|
|
part of '../../main.dart';
|
2018-11-25 20:44:19 +02:00
|
|
|
|
2019-09-07 18:23:04 +03:00
|
|
|
class EntityButtonCardBody extends StatelessWidget {
|
2018-11-25 20:44:19 +02:00
|
|
|
|
2019-09-07 18:23:04 +03:00
|
|
|
EntityButtonCardBody({
|
2018-11-25 20:44:19 +02:00
|
|
|
Key key,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final EntityWrapper entityWrapper = EntityModel.of(context).entityWrapper;
|
2019-03-13 00:56:57 +02:00
|
|
|
if (entityWrapper.entity.statelessType == StatelessEntityType.MISSED) {
|
2019-03-12 23:35:33 +02:00
|
|
|
return MissedEntityWidget();
|
|
|
|
}
|
2019-03-13 00:56:57 +02:00
|
|
|
if (entityWrapper.entity.statelessType > StatelessEntityType.MISSED) {
|
|
|
|
return Container(width: 0.0, height: 0.0,);
|
|
|
|
}
|
2019-09-07 17:27:23 +03:00
|
|
|
|
2019-03-13 00:56:57 +02:00
|
|
|
return InkWell(
|
|
|
|
onTap: () => entityWrapper.handleTap(),
|
|
|
|
onLongPress: () => entityWrapper.handleHold(),
|
2019-09-07 17:27:23 +03:00
|
|
|
child: FractionallySizedBox(
|
|
|
|
widthFactor: 1,
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
LayoutBuilder(
|
|
|
|
builder: (BuildContext context, BoxConstraints constraints) {
|
|
|
|
return EntityIcon(
|
|
|
|
padding: EdgeInsets.fromLTRB(2.0, 6.0, 2.0, 2.0),
|
|
|
|
size: constraints.maxWidth / 2.5,
|
|
|
|
);
|
|
|
|
}
|
2019-03-13 00:56:57 +02:00
|
|
|
),
|
2019-09-07 17:27:23 +03:00
|
|
|
_buildName()
|
|
|
|
],
|
|
|
|
),
|
2019-03-13 00:56:57 +02:00
|
|
|
),
|
|
|
|
);
|
2018-11-25 20:44:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Widget _buildName() {
|
|
|
|
return EntityName(
|
|
|
|
padding: EdgeInsets.fromLTRB(Sizes.buttonPadding, 0.0, Sizes.buttonPadding, Sizes.rowPadding),
|
|
|
|
textOverflow: TextOverflow.ellipsis,
|
|
|
|
maxLines: 3,
|
|
|
|
wordsWrap: true,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
fontSize: Sizes.nameFontSize,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|