This repository has been archived on 2023-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
ha_client/lib/entities/flat_service_button.widget.dart

41 lines
935 B
Dart
Raw Normal View History

2019-09-09 18:50:35 +03:00
part of '../main.dart';
2019-01-25 23:48:31 +02:00
class FlatServiceButton extends StatelessWidget {
final String serviceDomain;
final String serviceName;
final String entityId;
2019-01-25 23:48:31 +02:00
final String text;
final double fontSize;
FlatServiceButton({
Key key,
@required this.serviceDomain,
@required this.serviceName,
@required this.entityId,
2019-01-25 23:48:31 +02:00
@required this.text,
this.fontSize: Sizes.stateFontSize
}) : super(key: key);
void _setNewState() {
2019-10-28 19:59:47 +02:00
ConnectionManager().callService(serviceDomain, serviceName, entityId, null);
2019-01-25 23:48:31 +02:00
}
@override
Widget build(BuildContext context) {
return SizedBox(
height: fontSize*2.5,
child: FlatButton(
onPressed: (() {
_setNewState();
2019-01-25 23:48:31 +02:00
}),
child: Text(
text,
textAlign: TextAlign.right,
style:
new TextStyle(fontSize: fontSize, color: Colors.blue),
),
)
);
}
}