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/ui.dart

34 lines
593 B
Dart
Raw Normal View History

2019-09-07 18:23:04 +03:00
part of 'main.dart';
2018-10-27 14:27:41 +03:00
class HomeAssistantUI {
List<HAView> views;
2018-11-04 21:02:12 +02:00
String title;
2018-10-27 14:27:41 +03:00
2019-03-21 14:08:07 +02:00
bool get isEmpty => views == null || views.isEmpty;
2018-10-27 14:27:41 +03:00
HomeAssistantUI() {
views = [];
}
Widget build(BuildContext context, TabController tabController) {
2018-10-27 14:27:41 +03:00
return TabBarView(
controller: tabController,
2018-11-16 14:30:43 +02:00
children: _buildViews(context)
2018-10-27 14:27:41 +03:00
);
}
List<Widget> _buildViews(BuildContext context) {
List<Widget> result = [];
views.forEach((view) {
result.add(
view.build(context)
);
});
return result;
}
2019-03-21 14:08:07 +02:00
void clear() {
views.clear();
}
2018-10-27 14:27:41 +03:00
}