diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..b87628bd
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "cSpell.words": [
+ "automations"
+ ]
+}
\ No newline at end of file
diff --git a/assets/icons/functions_icons/ac_cooling.svg b/assets/icons/functions_icons/ac_cooling.svg
new file mode 100644
index 00000000..e95c0d4e
--- /dev/null
+++ b/assets/icons/functions_icons/ac_cooling.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/ac_fan_auto.svg b/assets/icons/functions_icons/ac_fan_auto.svg
new file mode 100644
index 00000000..0acacfef
--- /dev/null
+++ b/assets/icons/functions_icons/ac_fan_auto.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/icons/functions_icons/ac_fan_high.svg b/assets/icons/functions_icons/ac_fan_high.svg
new file mode 100644
index 00000000..d6131531
--- /dev/null
+++ b/assets/icons/functions_icons/ac_fan_high.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/ac_fan_low.svg b/assets/icons/functions_icons/ac_fan_low.svg
new file mode 100644
index 00000000..f4bf56b7
--- /dev/null
+++ b/assets/icons/functions_icons/ac_fan_low.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/ac_fan_middle.svg b/assets/icons/functions_icons/ac_fan_middle.svg
new file mode 100644
index 00000000..ee940238
--- /dev/null
+++ b/assets/icons/functions_icons/ac_fan_middle.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/ac_heating.svg b/assets/icons/functions_icons/ac_heating.svg
new file mode 100644
index 00000000..47a160c8
--- /dev/null
+++ b/assets/icons/functions_icons/ac_heating.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/functions_icons/ac_power.svg b/assets/icons/functions_icons/ac_power.svg
new file mode 100644
index 00000000..cc2127f0
--- /dev/null
+++ b/assets/icons/functions_icons/ac_power.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/icons/functions_icons/ac_power_off.svg b/assets/icons/functions_icons/ac_power_off.svg
new file mode 100644
index 00000000..70f7f9aa
--- /dev/null
+++ b/assets/icons/functions_icons/ac_power_off.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/card_unlock.svg b/assets/icons/functions_icons/automation_functions/card_unlock.svg
new file mode 100644
index 00000000..dd77680a
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/card_unlock.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/current_temp.svg b/assets/icons/functions_icons/automation_functions/current_temp.svg
new file mode 100644
index 00000000..42cceb23
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/current_temp.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/doorbell.svg b/assets/icons/functions_icons/automation_functions/doorbell.svg
new file mode 100644
index 00000000..1dc515a9
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/doorbell.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/doorlock_normal_open.svg b/assets/icons/functions_icons/automation_functions/doorlock_normal_open.svg
new file mode 100644
index 00000000..8f4a5901
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/doorlock_normal_open.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/double_lock.svg b/assets/icons/functions_icons/automation_functions/double_lock.svg
new file mode 100644
index 00000000..d8ad971d
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/double_lock.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/fingerprint_unlock.svg b/assets/icons/functions_icons/automation_functions/fingerprint_unlock.svg
new file mode 100644
index 00000000..f9f5b84c
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/fingerprint_unlock.svg
@@ -0,0 +1,79 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/hijack_alarm.svg b/assets/icons/functions_icons/automation_functions/hijack_alarm.svg
new file mode 100644
index 00000000..e32997fb
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/hijack_alarm.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/lock_alarm.svg b/assets/icons/functions_icons/automation_functions/lock_alarm.svg
new file mode 100644
index 00000000..8bd2deeb
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/lock_alarm.svg
@@ -0,0 +1,149 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/motion.svg b/assets/icons/functions_icons/automation_functions/motion.svg
new file mode 100644
index 00000000..8d69463b
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/motion.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/password_unlock.svg b/assets/icons/functions_icons/automation_functions/password_unlock.svg
new file mode 100644
index 00000000..1920b69f
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/password_unlock.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/presence.svg b/assets/icons/functions_icons/automation_functions/presence.svg
new file mode 100644
index 00000000..d71a474d
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/presence.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/presence_state.svg b/assets/icons/functions_icons/automation_functions/presence_state.svg
new file mode 100644
index 00000000..d5de48e1
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/presence_state.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/remote_unlock_req.svg b/assets/icons/functions_icons/automation_functions/remote_unlock_req.svg
new file mode 100644
index 00000000..da128ff7
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/remote_unlock_req.svg
@@ -0,0 +1,15 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/remote_unlock_via_app.svg b/assets/icons/functions_icons/automation_functions/remote_unlock_via_app.svg
new file mode 100644
index 00000000..39fc859b
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/remote_unlock_via_app.svg
@@ -0,0 +1,40 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/residual_electricity.svg b/assets/icons/functions_icons/automation_functions/residual_electricity.svg
new file mode 100644
index 00000000..6a5b6127
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/residual_electricity.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/self_test_result.svg b/assets/icons/functions_icons/automation_functions/self_test_result.svg
new file mode 100644
index 00000000..8739327b
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/self_test_result.svg
@@ -0,0 +1,23 @@
+
diff --git a/assets/icons/functions_icons/automation_functions/temp_password_unlock.svg b/assets/icons/functions_icons/automation_functions/temp_password_unlock.svg
new file mode 100644
index 00000000..98d7573c
--- /dev/null
+++ b/assets/icons/functions_icons/automation_functions/temp_password_unlock.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/icons/functions_icons/celsius_degrees.svg b/assets/icons/functions_icons/celsius_degrees.svg
new file mode 100644
index 00000000..7acbd6e7
--- /dev/null
+++ b/assets/icons/functions_icons/celsius_degrees.svg
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/assets/icons/functions_icons/child_lock.svg b/assets/icons/functions_icons/child_lock.svg
new file mode 100644
index 00000000..6b0138bf
--- /dev/null
+++ b/assets/icons/functions_icons/child_lock.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/icons/functions_icons/factory_reset.svg b/assets/icons/functions_icons/factory_reset.svg
new file mode 100644
index 00000000..7a47f24b
--- /dev/null
+++ b/assets/icons/functions_icons/factory_reset.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/icons/functions_icons/fan_speed.svg b/assets/icons/functions_icons/fan_speed.svg
new file mode 100644
index 00000000..07a48834
--- /dev/null
+++ b/assets/icons/functions_icons/fan_speed.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/far_detection.svg b/assets/icons/functions_icons/far_detection.svg
new file mode 100644
index 00000000..2827d94a
--- /dev/null
+++ b/assets/icons/functions_icons/far_detection.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/icons/functions_icons/far_detection_function.svg b/assets/icons/functions_icons/far_detection_function.svg
new file mode 100644
index 00000000..894b84ed
--- /dev/null
+++ b/assets/icons/functions_icons/far_detection_function.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/icons/functions_icons/freezing.svg b/assets/icons/functions_icons/freezing.svg
new file mode 100644
index 00000000..6c02f2e4
--- /dev/null
+++ b/assets/icons/functions_icons/freezing.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/icons/functions_icons/indicator.svg b/assets/icons/functions_icons/indicator.svg
new file mode 100644
index 00000000..b58a976e
--- /dev/null
+++ b/assets/icons/functions_icons/indicator.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/light_countdown.svg b/assets/icons/functions_icons/light_countdown.svg
new file mode 100644
index 00000000..94f65b9a
--- /dev/null
+++ b/assets/icons/functions_icons/light_countdown.svg
@@ -0,0 +1,42 @@
+
diff --git a/assets/icons/functions_icons/master_state.svg b/assets/icons/functions_icons/master_state.svg
new file mode 100644
index 00000000..0aafae1a
--- /dev/null
+++ b/assets/icons/functions_icons/master_state.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/icons/functions_icons/motion_detection.svg b/assets/icons/functions_icons/motion_detection.svg
new file mode 100644
index 00000000..a9b2d685
--- /dev/null
+++ b/assets/icons/functions_icons/motion_detection.svg
@@ -0,0 +1,21 @@
+
diff --git a/assets/icons/functions_icons/motionless_detection.svg b/assets/icons/functions_icons/motionless_detection.svg
new file mode 100644
index 00000000..25a767c1
--- /dev/null
+++ b/assets/icons/functions_icons/motionless_detection.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/icons/functions_icons/nobody_time.svg b/assets/icons/functions_icons/nobody_time.svg
new file mode 100644
index 00000000..df80b517
--- /dev/null
+++ b/assets/icons/functions_icons/nobody_time.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/icons/functions_icons/reset_off.svg b/assets/icons/functions_icons/reset_off.svg
new file mode 100644
index 00000000..eac88f2b
--- /dev/null
+++ b/assets/icons/functions_icons/reset_off.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/icons/functions_icons/scene_child_lock.svg b/assets/icons/functions_icons/scene_child_lock.svg
new file mode 100644
index 00000000..7e56164a
--- /dev/null
+++ b/assets/icons/functions_icons/scene_child_lock.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/scene_child_unlock.svg b/assets/icons/functions_icons/scene_child_unlock.svg
new file mode 100644
index 00000000..4eafbdea
--- /dev/null
+++ b/assets/icons/functions_icons/scene_child_unlock.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/icons/functions_icons/scene_refresh.svg b/assets/icons/functions_icons/scene_refresh.svg
new file mode 100644
index 00000000..c54ffb04
--- /dev/null
+++ b/assets/icons/functions_icons/scene_refresh.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/icons/functions_icons/sensitivity.svg b/assets/icons/functions_icons/sensitivity.svg
new file mode 100644
index 00000000..b75ebd3e
--- /dev/null
+++ b/assets/icons/functions_icons/sensitivity.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/functions_icons/sesitivity_operation_icon.svg b/assets/icons/functions_icons/sesitivity_operation_icon.svg
new file mode 100644
index 00000000..612148c5
--- /dev/null
+++ b/assets/icons/functions_icons/sesitivity_operation_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/icons/functions_icons/switch_alarm_sound.svg b/assets/icons/functions_icons/switch_alarm_sound.svg
new file mode 100644
index 00000000..db645338
--- /dev/null
+++ b/assets/icons/functions_icons/switch_alarm_sound.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/icons/functions_icons/tempreture.svg b/assets/icons/functions_icons/tempreture.svg
new file mode 100644
index 00000000..448083a7
--- /dev/null
+++ b/assets/icons/functions_icons/tempreture.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/icons/routine/automation.svg b/assets/icons/routine/automation.svg
new file mode 100644
index 00000000..a67aadaf
--- /dev/null
+++ b/assets/icons/routine/automation.svg
@@ -0,0 +1,23 @@
+
diff --git a/assets/icons/routine/delay.svg b/assets/icons/routine/delay.svg
new file mode 100644
index 00000000..49a8d31c
--- /dev/null
+++ b/assets/icons/routine/delay.svg
@@ -0,0 +1,24 @@
+
diff --git a/assets/icons/routine/map.svg b/assets/icons/routine/map.svg
new file mode 100644
index 00000000..595a0d8c
--- /dev/null
+++ b/assets/icons/routine/map.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/icons/routine/notification.svg b/assets/icons/routine/notification.svg
new file mode 100644
index 00000000..f196f466
--- /dev/null
+++ b/assets/icons/routine/notification.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/icons/routine/schedule.svg b/assets/icons/routine/schedule.svg
new file mode 100644
index 00000000..423eb577
--- /dev/null
+++ b/assets/icons/routine/schedule.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/icons/routine/tab_to_run.svg b/assets/icons/routine/tab_to_run.svg
new file mode 100644
index 00000000..c8660bb8
--- /dev/null
+++ b/assets/icons/routine/tab_to_run.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/icons/routine/weather.svg b/assets/icons/routine/weather.svg
new file mode 100644
index 00000000..49ed9408
--- /dev/null
+++ b/assets/icons/routine/weather.svg
@@ -0,0 +1,242 @@
+
diff --git a/lib/main.dart b/lib/main.dart
index c544f227..2040d175 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart';
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
+import 'package:syncrow_web/pages/routiens/bloc/routine_bloc/routine_bloc.dart';
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
import 'package:syncrow_web/services/locator.dart';
import 'package:syncrow_web/utils/app_routes.dart';
@@ -14,7 +15,8 @@ import 'package:syncrow_web/utils/theme/theme.dart';
Future main() async {
try {
- const environment = String.fromEnvironment('FLAVOR', defaultValue: 'development');
+ const environment =
+ String.fromEnvironment('FLAVOR', defaultValue: 'development');
await dotenv.load(fileName: '.env.$environment');
WidgetsFlutterBinding.ensureInitialized();
initialSetup();
@@ -46,10 +48,14 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
- BlocProvider(create: (context) => HomeBloc()..add(const FetchUserInfo())),
+ BlocProvider(
+ create: (context) => HomeBloc()..add(const FetchUserInfo())),
BlocProvider(
create: (context) => VisitorPasswordBloc(),
- )
+ ),
+ BlocProvider(
+ create: (context) => RoutineBloc(),
+ ),
],
child: MaterialApp.router(
debugShowCheckedModeBanner: false,
diff --git a/lib/pages/common/custom_table.dart b/lib/pages/common/custom_table.dart
index 22baba36..60abc0d2 100644
--- a/lib/pages/common/custom_table.dart
+++ b/lib/pages/common/custom_table.dart
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
-import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_managment_bloc.dart';
+import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_bloc.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';
diff --git a/lib/pages/common/text_field/custom_text_field.dart b/lib/pages/common/text_field/custom_text_field.dart
index b695da4a..bb574e74 100644
--- a/lib/pages/common/text_field/custom_text_field.dart
+++ b/lib/pages/common/text_field/custom_text_field.dart
@@ -1,59 +1,107 @@
import 'package:flutter/material.dart';
+import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';
import 'package:syncrow_web/utils/style.dart';
class StatefulTextField extends StatefulWidget {
- const StatefulTextField(
- {super.key,
- required this.title,
- this.hintText = 'Please enter',
- required this.width,
- this.elevation = 0,
- required this.controller,
- this.onSubmitted});
+ const StatefulTextField({
+ super.key,
+ required this.title,
+ this.hintText = 'Please enter',
+ required this.width,
+ this.elevation,
+ required this.controller,
+ this.onSubmitted,
+ this.boxDecoration,
+ this.borderRadius,
+ this.height,
+ this.padding,
+ this.icon,
+ this.hintColor,
+ required this.onChanged,
+ this.isRequired,
+ });
final String title;
final String hintText;
final double width;
- final double elevation;
+ final double? elevation;
final TextEditingController controller;
final Function? onSubmitted;
+ final BoxDecoration? boxDecoration;
+ final double? borderRadius;
+ final double? height;
+ final double? padding;
+ final IconData? icon;
+ final Color? hintColor;
+ final Function(String)? onChanged;
+ final bool? isRequired;
@override
State createState() => _StatefulTextFieldState();
}
class _StatefulTextFieldState extends State {
+ @override
+ void dispose() {
+ widget.controller.dispose();
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
- return Container(
- child: CustomTextField(
- title: widget.title,
- controller: widget.controller,
- hintText: widget.hintText,
- width: widget.width,
- elevation: widget.elevation,
- onSubmittedFun: widget.onSubmitted),
+ return CustomTextField(
+ title: widget.title,
+ controller: widget.controller,
+ hintText: widget.hintText,
+ width: widget.width,
+ elevation: widget.elevation,
+ onSubmittedFun: widget.onSubmitted,
+ boxDecoration: widget.boxDecoration,
+ borderRadius: widget.borderRadius,
+ height: widget.height,
+ padding: widget.padding,
+ icon: widget.icon,
+ hintColor: widget.hintColor,
+ onChanged: widget.onChanged,
+ isRequired: widget.isRequired,
);
}
}
class CustomTextField extends StatelessWidget {
- const CustomTextField(
- {super.key,
- required this.title,
- required this.controller,
- this.hintText = 'Please enter',
- required this.width,
- this.elevation = 0,
- this.onSubmittedFun});
+ const CustomTextField({
+ super.key,
+ required this.title,
+ required this.controller,
+ this.hintText = 'Please enter',
+ required this.width,
+ this.elevation,
+ this.onSubmittedFun,
+ this.boxDecoration,
+ this.borderRadius,
+ this.height,
+ this.padding,
+ this.icon,
+ this.hintColor,
+ required this.onChanged,
+ this.isRequired,
+ });
final String title;
final TextEditingController controller;
final String hintText;
final double width;
- final double elevation;
+ final double? elevation;
final Function? onSubmittedFun;
+ final BoxDecoration? boxDecoration;
+ final double? borderRadius;
+ final double? height;
+ final double? padding;
+ final IconData? icon;
+ final Color? hintColor;
+ final Function(String)? onChanged;
+ final bool? isRequired;
@override
Widget build(BuildContext context) {
@@ -61,40 +109,65 @@ class CustomTextField extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
- Text(
- title,
- style: context.textTheme.bodyMedium!.copyWith(
- fontSize: 13,
- fontWeight: FontWeight.w600,
- color: const Color(0xff000000),
- ),
+ Row(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Visibility(
+ visible: isRequired == true,
+ child: Text('* ',
+ style: context.textTheme.bodyMedium!
+ .copyWith(color: Colors.red, fontSize: 13)),
+ ),
+ Text(
+ title,
+ style: context.textTheme.bodyMedium!.copyWith(
+ fontSize: 13,
+ fontWeight: FontWeight.w600,
+ color: const Color(0xff000000),
+ ),
+ ),
+ ],
),
const SizedBox(height: 8),
Material(
- elevation: elevation,
- borderRadius: BorderRadius.circular(8),
+ elevation: elevation ?? 0,
+ borderRadius: BorderRadius.circular(borderRadius ?? 8),
child: Container(
width: width,
- height: 45,
- decoration: containerDecoration,
-
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(8),
- // ),
+ height: height ?? 45,
+ decoration: boxDecoration ?? containerDecoration,
child: TextFormField(
controller: controller,
style: const TextStyle(color: Colors.black),
+
decoration: InputDecoration(
hintText: hintText,
- hintStyle: const TextStyle(fontSize: 12),
- contentPadding:
- const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
+ hintStyle: TextStyle(
+ fontSize: 12, color: hintColor ?? ColorsManager.blackColor),
+ contentPadding: EdgeInsets.symmetric(
+ horizontal: 12, vertical: padding ?? 10),
border: InputBorder.none,
+ suffixIcon: icon != null
+ ? Icon(icon, color: ColorsManager.greyColor)
+ : null,
),
onFieldSubmitted: (_) {
onSubmittedFun!();
},
+ onChanged: (value) {
+ onChanged!(value);
+ },
+
+ /// required validator
+ validator: (value) {
+ if (isRequired == true) {
+ if (value == null || value.isEmpty) {
+ return 'This field is required';
+ }
+ }
+ return null;
+ },
),
),
),
diff --git a/lib/pages/device_managment/ac/model/ac_model.dart b/lib/pages/device_managment/ac/model/ac_model.dart
index 2803e51e..1eb2145f 100644
--- a/lib/pages/device_managment/ac/model/ac_model.dart
+++ b/lib/pages/device_managment/ac/model/ac_model.dart
@@ -1,8 +1,5 @@
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
-
-enum TempModes { hot, cold, wind }
-
-enum FanSpeeds { auto, low, middle, high }
+import 'package:syncrow_web/utils/constants/app_enum.dart';
class AcStatusModel {
final String uuid;
diff --git a/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart b/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart
index 60d48256..81f0685d 100644
--- a/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart
+++ b/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart
@@ -3,9 +3,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
-import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';
+import 'package:syncrow_web/utils/constants/app_enum.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
class BatchAcMode extends StatelessWidget {
@@ -27,15 +27,19 @@ class BatchAcMode extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- _buildIconContainer(context, TempModes.cold, Assets.freezing, value == TempModes.cold),
- _buildIconContainer(context, TempModes.hot, Assets.acSun, value == TempModes.hot),
- _buildIconContainer(context, TempModes.wind, Assets.acAirConditioner, value == TempModes.wind),
+ _buildIconContainer(context, TempModes.cold, Assets.freezing,
+ value == TempModes.cold),
+ _buildIconContainer(
+ context, TempModes.hot, Assets.acSun, value == TempModes.hot),
+ _buildIconContainer(context, TempModes.wind, Assets.acAirConditioner,
+ value == TempModes.wind),
],
),
);
}
- Widget _buildIconContainer(BuildContext context, TempModes mode, String assetPath, bool isSelected) {
+ Widget _buildIconContainer(
+ BuildContext context, TempModes mode, String assetPath, bool isSelected) {
return Flexible(
child: GestureDetector(
onTap: () {
diff --git a/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart b/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart
index ba49047a..4d7eb449 100644
--- a/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart
+++ b/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart
@@ -3,9 +3,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
-import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';
+import 'package:syncrow_web/utils/constants/app_enum.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
class BatchFanSpeedControl extends StatelessWidget {
@@ -30,8 +30,10 @@ class BatchFanSpeedControl extends StatelessWidget {
runSpacing: 8,
spacing: 8,
children: [
- _buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto, value == FanSpeeds.auto),
- _buildIconContainer(context, FanSpeeds.low, Assets.acFanLow, value == FanSpeeds.low),
+ _buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto,
+ value == FanSpeeds.auto),
+ _buildIconContainer(context, FanSpeeds.low, Assets.acFanLow,
+ value == FanSpeeds.low),
],
),
const SizedBox(height: 8),
@@ -39,8 +41,10 @@ class BatchFanSpeedControl extends StatelessWidget {
runSpacing: 8,
spacing: 8,
children: [
- _buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle, value == FanSpeeds.middle),
- _buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh, value == FanSpeeds.high),
+ _buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle,
+ value == FanSpeeds.middle),
+ _buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh,
+ value == FanSpeeds.high),
],
)
],
@@ -48,7 +52,8 @@ class BatchFanSpeedControl extends StatelessWidget {
);
}
- Widget _buildIconContainer(BuildContext context, FanSpeeds speed, String assetPath, bool isSelected) {
+ Widget _buildIconContainer(BuildContext context, FanSpeeds speed,
+ String assetPath, bool isSelected) {
return GestureDetector(
onTap: () {
context.read().add(
diff --git a/lib/pages/device_managment/ac/view/control_list/ac_mode.dart b/lib/pages/device_managment/ac/view/control_list/ac_mode.dart
index c6ffc052..91ca0f8c 100644
--- a/lib/pages/device_managment/ac/view/control_list/ac_mode.dart
+++ b/lib/pages/device_managment/ac/view/control_list/ac_mode.dart
@@ -3,9 +3,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
-import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';
+import 'package:syncrow_web/utils/constants/app_enum.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
class AcMode extends StatelessWidget {
@@ -27,15 +27,19 @@ class AcMode extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- _buildIconContainer(context, TempModes.cold, Assets.freezing, value == TempModes.cold),
- _buildIconContainer(context, TempModes.hot, Assets.acSun, value == TempModes.hot),
- _buildIconContainer(context, TempModes.wind, Assets.acAirConditioner, value == TempModes.wind),
+ _buildIconContainer(context, TempModes.cold, Assets.freezing,
+ value == TempModes.cold),
+ _buildIconContainer(
+ context, TempModes.hot, Assets.acSun, value == TempModes.hot),
+ _buildIconContainer(context, TempModes.wind, Assets.acAirConditioner,
+ value == TempModes.wind),
],
),
);
}
- Widget _buildIconContainer(BuildContext context, TempModes mode, String assetPath, bool isSelected) {
+ Widget _buildIconContainer(
+ BuildContext context, TempModes mode, String assetPath, bool isSelected) {
return Flexible(
child: GestureDetector(
onTap: () {
diff --git a/lib/pages/device_managment/ac/view/control_list/fan_speed.dart b/lib/pages/device_managment/ac/view/control_list/fan_speed.dart
index 952e112b..09ca80cb 100644
--- a/lib/pages/device_managment/ac/view/control_list/fan_speed.dart
+++ b/lib/pages/device_managment/ac/view/control_list/fan_speed.dart
@@ -3,9 +3,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_bloc.dart';
import 'package:syncrow_web/pages/device_managment/ac/bloc/ac_event.dart';
-import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';
+import 'package:syncrow_web/utils/constants/app_enum.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
class FanSpeedControl extends StatelessWidget {
@@ -29,8 +29,10 @@ class FanSpeedControl extends StatelessWidget {
runSpacing: 8,
spacing: 8,
children: [
- _buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto, value == FanSpeeds.auto),
- _buildIconContainer(context, FanSpeeds.low, Assets.acFanLow, value == FanSpeeds.low),
+ _buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto,
+ value == FanSpeeds.auto),
+ _buildIconContainer(context, FanSpeeds.low, Assets.acFanLow,
+ value == FanSpeeds.low),
],
),
const SizedBox(height: 8),
@@ -38,8 +40,10 @@ class FanSpeedControl extends StatelessWidget {
runSpacing: 8,
spacing: 8,
children: [
- _buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle, value == FanSpeeds.middle),
- _buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh, value == FanSpeeds.high),
+ _buildIconContainer(context, FanSpeeds.middle, Assets.acFanMiddle,
+ value == FanSpeeds.middle),
+ _buildIconContainer(context, FanSpeeds.high, Assets.acFanHigh,
+ value == FanSpeeds.high),
],
)
],
@@ -47,7 +51,8 @@ class FanSpeedControl extends StatelessWidget {
);
}
- Widget _buildIconContainer(BuildContext context, FanSpeeds speed, String assetPath, bool isSelected) {
+ Widget _buildIconContainer(BuildContext context, FanSpeeds speed,
+ String assetPath, bool isSelected) {
return GestureDetector(
onTap: () {
context.read().add(
diff --git a/lib/pages/device_managment/all_devices/bloc/device_managment_bloc.dart b/lib/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_bloc.dart
similarity index 100%
rename from lib/pages/device_managment/all_devices/bloc/device_managment_bloc.dart
rename to lib/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_bloc.dart
diff --git a/lib/pages/device_managment/all_devices/bloc/device_managment_event.dart b/lib/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_event.dart
similarity index 100%
rename from lib/pages/device_managment/all_devices/bloc/device_managment_event.dart
rename to lib/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_event.dart
diff --git a/lib/pages/device_managment/all_devices/bloc/device_managment_state.dart b/lib/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_state.dart
similarity index 100%
rename from lib/pages/device_managment/all_devices/bloc/device_managment_state.dart
rename to lib/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_state.dart
diff --git a/lib/pages/device_managment/all_devices/bloc/switch_tabs/switch_tabs_bloc.dart b/lib/pages/device_managment/all_devices/bloc/switch_tabs/switch_tabs_bloc.dart
new file mode 100644
index 00000000..3eaccf70
--- /dev/null
+++ b/lib/pages/device_managment/all_devices/bloc/switch_tabs/switch_tabs_bloc.dart
@@ -0,0 +1,28 @@
+import 'dart:async';
+
+import 'package:bloc/bloc.dart';
+import 'package:equatable/equatable.dart';
+
+part 'switch_tabs_event.dart';
+part 'switch_tabs_state.dart';
+
+class SwitchTabsBloc extends Bloc {
+ SwitchTabsBloc() : super(SwitchTabsInitial()) {
+ on(_switchTab);
+ on(_newRoutineView);
+ }
+
+ FutureOr _switchTab(
+ TriggerSwitchTabsEvent event,
+ Emitter emit,
+ ) {
+ emit(SelectedTabState(event.isRoutineView));
+ }
+
+ FutureOr _newRoutineView(
+ CreateNewRoutineViewEvent event,
+ Emitter emit,
+ ) {
+ emit(ShowCreateRoutineState(event.showCreateNewRoutineView));
+ }
+}
diff --git a/lib/pages/device_managment/all_devices/bloc/switch_tabs/switch_tabs_event.dart b/lib/pages/device_managment/all_devices/bloc/switch_tabs/switch_tabs_event.dart
new file mode 100644
index 00000000..98cad361
--- /dev/null
+++ b/lib/pages/device_managment/all_devices/bloc/switch_tabs/switch_tabs_event.dart
@@ -0,0 +1,21 @@
+part of 'switch_tabs_bloc.dart';
+
+sealed class SwitchTabsEvent extends Equatable {
+ const SwitchTabsEvent();
+}
+
+class TriggerSwitchTabsEvent extends SwitchTabsEvent {
+ final bool isRoutineView;
+ const TriggerSwitchTabsEvent(this.isRoutineView);
+
+ @override
+ List