mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
SP-1268
This commit is contained in:
53
lib/features/scene/widgets/routines_expansion_tile.dart
Normal file
53
lib/features/scene/widgets/routines_expansion_tile.dart
Normal file
@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/scene_view_widget/scene_grid_view.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class RoutinesExpansionTile extends StatelessWidget {
|
||||
const RoutinesExpansionTile({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.emptyRoutinesMessage,
|
||||
required this.routines,
|
||||
required this.loadingStates,
|
||||
this.loadingSceneId,
|
||||
});
|
||||
final String title;
|
||||
final String emptyRoutinesMessage;
|
||||
final List<ScenesModel> routines;
|
||||
final Map<String, bool> loadingStates;
|
||||
final String? loadingSceneId;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ExpansionTile(
|
||||
tilePadding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
),
|
||||
initiallyExpanded: true,
|
||||
iconColor: ColorsManager.grayColor,
|
||||
title: BodyMedium(
|
||||
text: title,
|
||||
),
|
||||
childrenPadding: EdgeInsetsDirectional.only(bottom: 10),
|
||||
children: [
|
||||
Visibility(
|
||||
visible: routines.isNotEmpty,
|
||||
replacement: Center(
|
||||
child: BodyMedium(
|
||||
text: emptyRoutinesMessage,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
child: SceneGrid(
|
||||
scenes: routines,
|
||||
loadingSceneId: loadingSceneId,
|
||||
disablePlayButton: false,
|
||||
loadingStates: loadingStates,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user