Hide unused widgets

This commit is contained in:
Abdullah Alassaf
2024-12-17 01:13:36 +03:00
parent f81880a704
commit 33d2bbc91f
5 changed files with 218 additions and 204 deletions
@@ -6,9 +6,9 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/water_heater_bloc/water_heater_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/water_heater/Inching_widget.dart';
import 'package:syncrow_app/features/devices/view/widgets/water_heater/circulate_list_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/water_heater/circulate_widget.dart';
// import 'package:syncrow_app/features/devices/view/widgets/water_heater/Inching_widget.dart';
// import 'package:syncrow_app/features/devices/view/widgets/water_heater/circulate_list_view.dart';
// import 'package:syncrow_app/features/devices/view/widgets/water_heater/circulate_widget.dart';
import 'package:syncrow_app/features/shared_widgets/create_schedule.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/schedule_list.dart';
@@ -61,7 +61,7 @@ class WHTimerScheduleScreen extends StatelessWidget {
}
},
child: DefaultTabController(
length: 4,
length: 2,
child: DefaultScaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
@@ -220,54 +220,54 @@ class WHTimerScheduleScreen extends StatelessWidget {
),
),
),
Tab(
icon: Padding(
padding: const EdgeInsets.only(top: 10),
child: SvgPicture.asset(
Assets.scheduleCirculateIcon,
color: waterHeaterBloc.selectedTabIndex == 2
? Colors.white
: ColorsManager.blackColor,
),
),
child: Container(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Text(
'Circulate',
style: context.bodySmall.copyWith(
color: waterHeaterBloc.selectedTabIndex == 2
? Colors.white
: ColorsManager.blackColor,
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
),
),
Tab(
icon: Padding(
padding: const EdgeInsets.only(top: 10),
child: SvgPicture.asset(
Assets.scheduleInchingIcon,
color: waterHeaterBloc.selectedTabIndex == 3
? Colors.white
: ColorsManager.blackColor,
),
),
child: Container(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Text(
'Inching',
style: context.bodySmall.copyWith(
color: waterHeaterBloc.selectedTabIndex == 3
? Colors.white
: ColorsManager.blackColor,
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
),
),
// Tab(
// icon: Padding(
// padding: const EdgeInsets.only(top: 10),
// child: SvgPicture.asset(
// Assets.scheduleCirculateIcon,
// color: waterHeaterBloc.selectedTabIndex == 2
// ? Colors.white
// : ColorsManager.blackColor,
// ),
// ),
// child: Container(
// padding: const EdgeInsets.symmetric(vertical: 5),
// child: Text(
// 'Circulate',
// style: context.bodySmall.copyWith(
// color: waterHeaterBloc.selectedTabIndex == 2
// ? Colors.white
// : ColorsManager.blackColor,
// fontSize: 12,
// fontWeight: FontWeight.w400,
// ),
// ),
// ),
// ),
// Tab(
// icon: Padding(
// padding: const EdgeInsets.only(top: 10),
// child: SvgPicture.asset(
// Assets.scheduleInchingIcon,
// color: waterHeaterBloc.selectedTabIndex == 3
// ? Colors.white
// : ColorsManager.blackColor,
// ),
// ),
// child: Container(
// padding: const EdgeInsets.symmetric(vertical: 5),
// child: Text(
// 'Inching',
// style: context.bodySmall.copyWith(
// color: waterHeaterBloc.selectedTabIndex == 3
// ? Colors.white
// : ColorsManager.blackColor,
// fontSize: 12,
// fontWeight: FontWeight.w400,
// ),
// ),
// ),
// ),
],
)),
Expanded(
@@ -357,57 +357,57 @@ class WHTimerScheduleScreen extends StatelessWidget {
),
),
),
Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
waterHeaterBloc.createCirculate == true
? CirculateWidget(
endDuration: () {
waterHeaterBloc.add(SelectTimeEvent(
context: context, isEffective: false));
},
startDuration: () {
waterHeaterBloc.add(SelectTimeEvent(
context: context, isEffective: false));
},
isStartEndTime: true,
startTime: DateTime.now(),
endTime: DateTime.now(),
days: waterHeaterBloc.days,
selectedDays: [],
onToggleStartEndTime: (c) {},
onTimeChanged: (x, f) {},
onDaySelected: (p0) {},
)
: CirculateListView(
listSchedule: [], // Pass the schedule list here
onDismissed: (scheduleId) {
waterHeaterBloc.listSchedule.removeWhere(
(schedule) =>
schedule.scheduleId == scheduleId);
waterHeaterBloc
.add(DeleteScheduleEvent(id: scheduleId));
},
onToggleSchedule: (scheduleId, isEnabled) {
waterHeaterBloc.add(ToggleScheduleEvent(
id: scheduleId,
toggle: isEnabled,
));
},
)
],
),
),
Column(
children: [
SizedBox(height: 20),
Container(
child: InchingWidget(),
),
],
)
// Center(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// waterHeaterBloc.createCirculate == true
// ? CirculateWidget(
// endDuration: () {
// waterHeaterBloc.add(SelectTimeEvent(
// context: context, isEffective: false));
// },
// startDuration: () {
// waterHeaterBloc.add(SelectTimeEvent(
// context: context, isEffective: false));
// },
// isStartEndTime: true,
// startTime: DateTime.now(),
// endTime: DateTime.now(),
// days: waterHeaterBloc.days,
// selectedDays: [],
// onToggleStartEndTime: (c) {},
// onTimeChanged: (x, f) {},
// onDaySelected: (p0) {},
// )
// : CirculateListView(
// listSchedule: [], // Pass the schedule list here
// onDismissed: (scheduleId) {
// waterHeaterBloc.listSchedule.removeWhere(
// (schedule) =>
// schedule.scheduleId == scheduleId);
// waterHeaterBloc
// .add(DeleteScheduleEvent(id: scheduleId));
// },
// onToggleSchedule: (scheduleId, isEnabled) {
// waterHeaterBloc.add(ToggleScheduleEvent(
// id: scheduleId,
// toggle: isEnabled,
// ));
// },
// )
// ],
// ),
// ),
// Column(
// children: [
// SizedBox(height: 20),
// Container(
// child: InchingWidget(),
// ),
// ],
// )
],
),
),