2018-10-27 14:27:41 +03:00
|
|
|
part of '../main.dart';
|
|
|
|
|
|
|
|
class DefaultEntityContainer extends StatelessWidget {
|
|
|
|
DefaultEntityContainer({
|
|
|
|
Key key,
|
2018-11-04 22:57:53 +02:00
|
|
|
@required this.state
|
2018-10-27 14:27:41 +03:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final Widget state;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2018-11-24 00:37:55 +02:00
|
|
|
final EntityModel entityModel = EntityModel.of(context);
|
2019-03-13 00:56:57 +02:00
|
|
|
if (entityModel.entityWrapper.entity.statelessType == StatelessEntityType.MISSED) {
|
2019-03-12 23:35:33 +02:00
|
|
|
return MissedEntityWidget();
|
2019-03-13 00:56:57 +02:00
|
|
|
}
|
|
|
|
if (entityModel.entityWrapper.entity.statelessType == StatelessEntityType.DIVIDER) {
|
2020-04-07 00:39:16 +03:00
|
|
|
return Divider();
|
2019-03-13 00:56:57 +02:00
|
|
|
}
|
|
|
|
if (entityModel.entityWrapper.entity.statelessType == StatelessEntityType.SECTION) {
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: <Widget>[
|
2020-04-07 00:39:16 +03:00
|
|
|
Divider(),
|
2019-03-13 00:56:57 +02:00
|
|
|
Text(
|
|
|
|
"${entityModel.entityWrapper.entity.displayName}",
|
2020-04-04 18:13:55 +03:00
|
|
|
style: Theme.of(context).textTheme.body1.copyWith(
|
2020-04-07 00:39:16 +03:00
|
|
|
color: Theme.of(context).primaryColor
|
2020-04-04 18:13:55 +03:00
|
|
|
),
|
2019-03-13 00:56:57 +02:00
|
|
|
)
|
|
|
|
],
|
2019-03-12 23:35:33 +02:00
|
|
|
);
|
|
|
|
}
|
2019-09-09 12:25:13 +03:00
|
|
|
Widget result = Row(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: <Widget>[
|
|
|
|
EntityIcon(),
|
2019-03-13 00:56:57 +02:00
|
|
|
|
2019-09-09 12:25:13 +03:00
|
|
|
Flexible(
|
|
|
|
fit: FlexFit.tight,
|
|
|
|
flex: 3,
|
|
|
|
child: EntityName(
|
|
|
|
padding: EdgeInsets.fromLTRB(10.0, 2.0, 10.0, 2.0),
|
2019-03-13 00:56:57 +02:00
|
|
|
),
|
2019-09-09 12:25:13 +03:00
|
|
|
),
|
|
|
|
state
|
|
|
|
],
|
2019-03-13 00:56:57 +02:00
|
|
|
);
|
2019-09-09 12:25:13 +03:00
|
|
|
if (entityModel.handleTap) {
|
|
|
|
return InkWell(
|
|
|
|
onLongPress: () {
|
|
|
|
if (entityModel.handleTap) {
|
|
|
|
entityModel.entityWrapper.handleHold();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onTap: () {
|
|
|
|
if (entityModel.handleTap) {
|
|
|
|
entityModel.entityWrapper.handleTap();
|
|
|
|
}
|
|
|
|
},
|
2020-03-14 20:12:11 +02:00
|
|
|
onDoubleTap: () {
|
|
|
|
if (entityModel.handleTap) {
|
|
|
|
entityModel.entityWrapper.handleDoubleTap();
|
|
|
|
}
|
|
|
|
},
|
2019-09-09 12:25:13 +03:00
|
|
|
child: result,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return result;
|
|
|
|
}
|
2018-10-27 14:27:41 +03:00
|
|
|
}
|
|
|
|
}
|