From b3fcca639ac37701b04803923c517f4e87debee0 Mon Sep 17 00:00:00 2001 From: Mohammad Salameh Date: Wed, 6 Mar 2024 21:34:23 +0300 Subject: [PATCH] Removed location from models Added the spaces models Added the rooms models Added the Spaces cubit Implemented the home dropdown functionality --- assets/images/blind.png | Bin 0 -> 3084 bytes assets/images/curtain.png | Bin 0 -> 12153 bytes .../app_layout/bloc/spaces_cubit.dart | 133 ++++++++++++++++++ .../app_layout/bloc/spaces_state.dart | 19 +++ .../app_layout/model/space_model.dart | 29 ++++ .../view/widgets/app_bar_home_dropdown.dart | 81 +++++++---- lib/features/devices/bloc/ac/ac_cubit.dart | 2 +- .../devices/bloc/curtains/curtains_cubit.dart | 2 +- lib/features/devices/bloc/devices_cubit.dart | 53 ++++--- lib/features/devices/model/ac_model.dart | 3 - lib/features/devices/model/curtain_model.dart | 3 - lib/features/devices/model/device_model.dart | 2 - lib/features/devices/model/light_model.dart | 3 - lib/features/devices/model/room_model.dart | 30 ++++ .../view/widgets/curtains/curtain_list.dart | 33 +---- .../view/widgets/devices_view_body.dart | 4 +- .../view/widgets/lights/lights_view.dart | 2 +- .../view/widgets/lights/lights_view_list.dart | 2 +- .../devices/view/widgets/switches.dart | 8 +- ..._categories_view.dart => wizard_page.dart} | 4 +- lib/my_app.dart | 4 + lib/utils/resource_manager/theme_manager.dart | 32 +++++ pubspec.lock | 48 ++----- 23 files changed, 359 insertions(+), 138 deletions(-) create mode 100644 assets/images/blind.png create mode 100644 assets/images/curtain.png create mode 100644 lib/features/app_layout/bloc/spaces_cubit.dart create mode 100644 lib/features/app_layout/bloc/spaces_state.dart create mode 100644 lib/features/app_layout/model/space_model.dart create mode 100644 lib/features/devices/model/room_model.dart rename lib/features/devices/view/widgets/{devices_categories_view.dart => wizard_page.dart} (95%) diff --git a/assets/images/blind.png b/assets/images/blind.png new file mode 100644 index 0000000000000000000000000000000000000000..35cad04b0083da1fd0b2940bfa9cf44251ed1d9f GIT binary patch literal 3084 zcma)8dpy)>7yr%F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 diff --git a/assets/images/curtain.png b/assets/images/curtain.png new file mode 100644 index 0000000000000000000000000000000000000000..c8b55c9fbca663dd39892f5b5e96fd4cf7ad8872 GIT binary patch literal 12153 zcmX|nc{o)6`~IOMOUfGAvL{B7HKfHZYws{KNF>WJVhAHrWXYCoDr@!+Gh-k7nw^-e z69zGu5VB78-|73u?~l3WnzLNF2OFw*HfP11l^&RzX=+&RjJ~|{=Sq;^_gt3Cat}FA4pxtM z+8BikLPJBj7PC%|S`5evRb~e{m(AbvYZhFF+VvCrS9faNpJ-vePm*YT`8^Va5x@c4J)KvBv7av6v$ig+MGW;YwY#9uPOGPWZP@$c?2% z?ov&!8(&{0uc~Qiq$_4~Db&B*`~8{ofc?$E>7Vu%si$J0@2g^dMDa^gX|u0Yf(Xnu zlF_hzhSo&?6ZW@G*|U1e=wGy?POms;y|=olI`n#1bRQ&;^nY{3bi`=KUI{*2Q+d=L zefdTKk4yQ!PV$Wo3*Ua&Tqfd_PVCgYzgvh!X9XUIZ93;FJ9wpNLr?YsOT5GnW?H2j zH70IxKd|U^_#_dxyNf>66~$yxH@+X(x*l))B99j}k;a)>Nu>9I`&)~HKYMBL*B75< zCv@t5c$qM^_h&A2`j~TxkBOY2E^OSVmr-Kdpximvn0$j3!w-DPt0F7lEvG^mFAm>m zInr>AUT|Hv&F-r4oHg;=n8|29U)q}T{5cQ7y)K1DJ<_8rjdVpHMPOtVT!Us-hm>|A zF9cBgj`0D6m%~Iucxm^6T=!@R)Ut`TAyqMx_-ppbD!LId9xUYhWPMkHvTNjjB2>AE z!LRV>f4mlOcdiOvgN*J<;;2=(${xNUDbvi_cBcXhbBnp7{rLNzM=gHX*UFua3P{t;eKI>lfp%yBn9bf`eik*1tJ2^+_OiCx=`lIv89=I{#BxVpta3`4h* zc2jNigvRI5Ek>aKLdfE>6KhP!c#7{ET-ny`2r02*b~g_vi%NQge9fztvHJ+ZN|kE( zGgoV#I7O3%mON@b;p9kzvcK=1TpOiqs`jya<$bdx(gq(-vs>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pacesInitial()); + + static SpacesCubit get(context) => BlocProvider.of(context); + + static List spaces = [ + SpaceModel( + id: '0', + name: 'Home', + rooms: [], + ), + SpaceModel( + id: '1', + name: 'Office', + rooms: [], + ), + SpaceModel( + id: '2', + name: 'Parent\'s House', + rooms: [], + ), + ]; + List rooms = [ + RoomModel(id: '0', name: 'Living Room', categories: [ + DevicesCategoryModel( + devices: [ + ACModel( + name: "Living Room AC", + id: '0', + status: false, + temperature: 20, + fanSpeed: 0, + tempMode: 0, + coolTo: 20, + type: '', + image: '', + timer: null, + bounds: Bounds( + min: 20, + max: 30, + ), + ), + ], + icon: Assets.iconsAC, + name: 'ACs', + type: DeviceType.AC, + page: const ACsView(), + ), + DevicesCategoryModel( + devices: [ + LightModel( + name: "Living Room Light", + id: '0', + status: false, + color: 0, + brightness: 20, + lightingMode: 1, + timer: null, + type: '', + image: '', + recentColors: [ + 0xFF83D9FF, + 0xFFFC3E81, + 0xFFC0FF66, + 0xFFFDC242, + ], + ), + ], + icon: Assets.iconsLight, + name: 'Lights', + type: DeviceType.Lights, + page: const LightsView(), + ), + DevicesCategoryModel( + devices: [], + icon: Assets.iconsDoorLock, + name: 'Doors', + type: DeviceType.Door, + page: const DoorView(), + ), + DevicesCategoryModel( + devices: [ + CurtainModel( + openPercentage: 10, + id: "1", + name: "Living Room Curtain", + status: false, + type: '', + image: '', + timer: null, + ), + ], + icon: Assets.iconsCurtain, + name: 'Curtains', + type: DeviceType.Curtain, + page: const CurtainView(), + ), + DevicesCategoryModel( + devices: [], + icon: Assets.iconsScreen, + name: 'Gateway', + type: DeviceType.Gateway, + page: const GateWayView(), + ), + ]), + RoomModel(id: '1', name: 'Bedroom', categories: []), + ]; + + SpaceModel selectedSpace = spaces.first; + + selectSpace(SpaceModel space) { + selectedSpace = space; + emit(SpacesSelected(space)); + } + +//TODO implement the methods to fetch the spaces from the API +} diff --git a/lib/features/app_layout/bloc/spaces_state.dart b/lib/features/app_layout/bloc/spaces_state.dart new file mode 100644 index 0000000..4491586 --- /dev/null +++ b/lib/features/app_layout/bloc/spaces_state.dart @@ -0,0 +1,19 @@ +part of 'spaces_cubit.dart'; + +abstract class SpacesState {} + +class SpacesInitial extends SpacesState {} + +class SpacesLoading extends SpacesState {} + +class SpacesLoaded extends SpacesState { + final List spaces; + + SpacesLoaded(this.spaces); +} + +class SpacesSelected extends SpacesState { + final SpaceModel space; + + SpacesSelected(this.space); +} diff --git a/lib/features/app_layout/model/space_model.dart b/lib/features/app_layout/model/space_model.dart new file mode 100644 index 0000000..4fb0c26 --- /dev/null +++ b/lib/features/app_layout/model/space_model.dart @@ -0,0 +1,29 @@ +import 'package:syncrow_app/features/devices/model/room_model.dart'; + +class SpaceModel { + final String id; + final String name; + final List rooms; + + SpaceModel({ + required this.id, + required this.name, + required this.rooms, + }); + + Map toJson() { + return { + 'id': id, + 'name': name, + 'rooms': rooms, + }; + } + + factory SpaceModel.fromJson(Map json) { + return SpaceModel( + id: json['id'], + name: json['name'], + rooms: json['rooms'], + ); + } +} diff --git a/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart b/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart index a0586a0..4603823 100644 --- a/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart +++ b/lib/features/app_layout/view/widgets/app_bar_home_dropdown.dart @@ -1,9 +1,12 @@ import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; +import 'package:syncrow_app/utils/context_extension.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import '../../../../generated/assets.dart'; -import '../../../shared_widgets/text_widgets/body_large.dart'; class AppBarHomeDropdown extends StatelessWidget { const AppBarHomeDropdown({ @@ -12,33 +15,57 @@ class AppBarHomeDropdown extends StatelessWidget { @override Widget build(BuildContext context) { - return TextButton( - onPressed: () {}, - child: SizedBox( - width: 150, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - Assets.iconsHome, - width: 25, - height: 25, - colorFilter: const ColorFilter.mode( - ColorsManager.textPrimaryColor, - BlendMode.srcIn, + return BlocBuilder( + builder: (context, state) { + return DropdownButton( + icon: const Icon( + Icons.expand_more, + color: Colors.black, + size: 25, + ), + underline: const SizedBox.shrink(), + padding: const EdgeInsets.all(0), + borderRadius: BorderRadius.circular(20), + value: SpacesCubit.get(context).selectedSpace, + items: SpacesCubit.spaces.map((space) { + return DropdownMenuItem( + value: space, + child: SizedBox( + width: 100, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SvgPicture.asset( + Assets.iconsHome, + width: 25, + height: 25, + colorFilter: const ColorFilter.mode( + ColorsManager.textPrimaryColor, + BlendMode.srcIn, + ), + ), + const SizedBox(width: 5), + Expanded( + child: BodyMedium( + text: space.name, + style: context.bodyMedium.copyWith( + fontSize: 15, + color: ColorsManager.textPrimaryColor, + overflow: TextOverflow.ellipsis, + ), + ), + ), + ], + ), ), - ), - const SizedBox(width: 5), - const BodyLarge(text: 'Home'), - const SizedBox(width: 5), - const Icon( - Icons.expand_more, - color: Colors.black, - ) - ], - ), - ), + ); + }).toList(), + onChanged: (value) { + SpacesCubit.get(context).selectSpace(value!); + }, + ); + }, ); } } diff --git a/lib/features/devices/bloc/ac/ac_cubit.dart b/lib/features/devices/bloc/ac/ac_cubit.dart index 6e36957..876af46 100644 --- a/lib/features/devices/bloc/ac/ac_cubit.dart +++ b/lib/features/devices/bloc/ac/ac_cubit.dart @@ -12,7 +12,7 @@ class AcCubit extends Cubit { static AcCubit get(context) => BlocProvider.of(context); - static DevicesCategoryModel category = DevicesCubit.categories[0]; + static DevicesCategoryModel category = DevicesCubit.allCategories[0]; ACModel? getSelectedAC() { for (var ac in category.devices) { diff --git a/lib/features/devices/bloc/curtains/curtains_cubit.dart b/lib/features/devices/bloc/curtains/curtains_cubit.dart index 5b0900d..99de110 100644 --- a/lib/features/devices/bloc/curtains/curtains_cubit.dart +++ b/lib/features/devices/bloc/curtains/curtains_cubit.dart @@ -9,5 +9,5 @@ class CurtainsCubit extends Cubit { static CurtainsCubit get(context) => BlocProvider.of(context); - static DevicesCategoryModel category = DevicesCubit.categories[4]; + static DevicesCategoryModel category = DevicesCubit.allCategories[3]; } diff --git a/lib/features/devices/bloc/devices_cubit.dart b/lib/features/devices/bloc/devices_cubit.dart index 7963077..1c48e39 100644 --- a/lib/features/devices/bloc/devices_cubit.dart +++ b/lib/features/devices/bloc/devices_cubit.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/devices/model/ac_model.dart'; +import 'package:syncrow_app/features/devices/model/curtain_model.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/light_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart'; @@ -20,7 +21,7 @@ class DevicesCubit extends Cubit { static DevicesCubit get(context) => BlocProvider.of(context); - static List categories = [ + static List allCategories = [ DevicesCategoryModel( devices: [ ACModel( @@ -32,7 +33,6 @@ class DevicesCubit extends Cubit { tempMode: 0, coolTo: 20, type: '', - location: '', image: '', timer: null, bounds: Bounds( @@ -49,7 +49,6 @@ class DevicesCubit extends Cubit { tempMode: 0, coolTo: 20, type: '', - location: '', image: '', timer: null, bounds: Bounds( @@ -66,7 +65,6 @@ class DevicesCubit extends Cubit { tempMode: 0, coolTo: 20, type: '', - location: '', image: '', timer: null, bounds: Bounds( @@ -83,7 +81,6 @@ class DevicesCubit extends Cubit { tempMode: 0, coolTo: 20, type: '', - location: '', image: '', timer: null, bounds: Bounds( @@ -108,7 +105,6 @@ class DevicesCubit extends Cubit { lightingMode: 1, timer: null, type: '', - location: '', image: '', recentColors: [ 0xFF83D9FF, @@ -126,7 +122,6 @@ class DevicesCubit extends Cubit { lightingMode: 1, timer: null, type: '', - location: '', image: '', recentColors: [ 0xFF83D9FF, @@ -144,7 +139,6 @@ class DevicesCubit extends Cubit { lightingMode: 1, timer: null, type: '', - location: '', image: '', recentColors: [ 0xFF83D9FF, @@ -162,7 +156,6 @@ class DevicesCubit extends Cubit { lightingMode: 1, timer: null, type: '', - location: '', image: '', recentColors: [ 0xFF83D9FF, @@ -180,7 +173,6 @@ class DevicesCubit extends Cubit { lightingMode: 1, timer: null, type: '', - location: '', image: '', recentColors: [ 0xFF83D9FF, @@ -203,7 +195,26 @@ class DevicesCubit extends Cubit { page: const DoorView(), ), DevicesCategoryModel( - devices: [], + devices: [ + CurtainModel( + openPercentage: 10, + id: "1", + name: "Living Room Curtain", + status: false, + type: '', + image: '', + timer: null, + ), + CurtainModel( + openPercentage: 20, + id: "2", + name: "Master Bedroom Curtain", + status: false, + type: '', + image: '', + timer: null, + ), + ], icon: Assets.iconsCurtain, name: 'Curtains', type: DeviceType.Curtain, @@ -226,25 +237,25 @@ class DevicesCubit extends Cubit { ]; selectCategory(int index) { - for (var i = 0; i < categories.length; i++) { + for (var i = 0; i < allCategories.length; i++) { if (i == index) { - categories[i].isSelected = true; + allCategories[i].isSelected = true; } else { - categories[i].isSelected = false; + allCategories[i].isSelected = false; } } emit(DevicesCategoryChanged()); } unselectAllCategories() { - for (var category in categories) { + for (var category in allCategories) { category.isSelected = false; } emit(DevicesCategoryChanged()); } Widget? get chosenCategoryView { - for (var category in categories) { + for (var category in allCategories) { if (category.isSelected) { return category.page; } @@ -253,7 +264,7 @@ class DevicesCubit extends Cubit { } selectDevice(DeviceModel device) { - for (var category in categories) { + for (var category in allCategories) { for (var device in category.devices) { if (device.isSelected) { category.isSelected = false; @@ -267,7 +278,7 @@ class DevicesCubit extends Cubit { } DeviceModel? getSelectedDevice() { - for (var category in categories) { + for (var category in allCategories) { for (var device in category.devices) { if (device.isSelected) { return device; @@ -296,8 +307,8 @@ class DevicesCubit extends Cubit { turnOnOffDevice(DeviceModel device) { device.status = !device.status!; - DevicesCategoryModel category = - categories.firstWhere((category) => category.devices.contains(device)); + DevicesCategoryModel category = allCategories + .firstWhere((category) => category.devices.contains(device)); updateDevicesStatus(category); emit(DeviceSwitchChanged()); } @@ -354,7 +365,7 @@ class DevicesCubit extends Cubit { } clearCategoriesSelection(BuildContext context) { - for (var category in categories) { + for (var category in allCategories) { category.isSelected = false; for (var device in category.devices) { device.isSelected = false; diff --git a/lib/features/devices/model/ac_model.dart b/lib/features/devices/model/ac_model.dart index 8da6acd..737118d 100644 --- a/lib/features/devices/model/ac_model.dart +++ b/lib/features/devices/model/ac_model.dart @@ -21,7 +21,6 @@ class ACModel extends DeviceModel { required super.name, required super.type, required super.status, - required super.location, required super.image, required super.timer, }); @@ -36,7 +35,6 @@ class ACModel extends DeviceModel { 'name': name, 'status': status, 'type': type, - 'location': location, 'image': image, }; } @@ -50,7 +48,6 @@ class ACModel extends DeviceModel { fanSpeed: json['fanSpeed'], tempMode: json['tempMode'], type: json['type'], - location: json['location'], image: json['image'], timer: json['timer'], coolTo: json['coolTo'], diff --git a/lib/features/devices/model/curtain_model.dart b/lib/features/devices/model/curtain_model.dart index 276cd34..6abc311 100644 --- a/lib/features/devices/model/curtain_model.dart +++ b/lib/features/devices/model/curtain_model.dart @@ -9,7 +9,6 @@ class CurtainModel extends DeviceModel { required super.name, required super.type, required super.status, - required super.location, required super.image, required super.timer, }); @@ -22,7 +21,6 @@ class CurtainModel extends DeviceModel { 'name': name, 'status': status, 'type': type, - 'location': location, 'image': image, }; } @@ -35,7 +33,6 @@ class CurtainModel extends DeviceModel { openPercentage: json['openPercentage'], timer: json['timer'], type: json['type'], - location: json['location'], image: json['image'], ); } diff --git a/lib/features/devices/model/device_model.dart b/lib/features/devices/model/device_model.dart index f4c5b9c..280ba6d 100644 --- a/lib/features/devices/model/device_model.dart +++ b/lib/features/devices/model/device_model.dart @@ -3,7 +3,6 @@ abstract class DeviceModel { final String? name; final String? type; bool? status; - final String? location; final String? image; final double? timer; bool isSelected = false; @@ -13,7 +12,6 @@ abstract class DeviceModel { required this.name, required this.type, required this.status, - required this.location, required this.image, required this.timer, }); diff --git a/lib/features/devices/model/light_model.dart b/lib/features/devices/model/light_model.dart index d267deb..ab2f258 100644 --- a/lib/features/devices/model/light_model.dart +++ b/lib/features/devices/model/light_model.dart @@ -17,7 +17,6 @@ class LightModel extends DeviceModel { required super.name, required super.type, required super.status, - required super.location, required super.image, required super.timer, }); @@ -33,7 +32,6 @@ class LightModel extends DeviceModel { 'name': name, 'status': status, 'type': type, - 'location': location, 'image': image, }; } @@ -48,7 +46,6 @@ class LightModel extends DeviceModel { lightingMode: json['lightingMode'], timer: json['timer'], type: json['type'], - location: json['location'], image: json['image'], recentColors: json['recentColors'], ); diff --git a/lib/features/devices/model/room_model.dart b/lib/features/devices/model/room_model.dart new file mode 100644 index 0000000..921eb36 --- /dev/null +++ b/lib/features/devices/model/room_model.dart @@ -0,0 +1,30 @@ +import 'package:syncrow_app/features/devices/model/device_category_model.dart'; + +class RoomModel { + final String id; + final String name; + + final List categories; + + RoomModel({ + required this.id, + required this.name, + required this.categories, + }); + + Map toJson() { + return { + 'id': id, + 'name': name, + 'devices': categories, + }; + } + + factory RoomModel.fromJson(Map json) { + return RoomModel( + id: json['id'], + name: json['name'], + categories: json['devices'], + ); + } +} diff --git a/lib/features/devices/view/widgets/curtains/curtain_list.dart b/lib/features/devices/view/widgets/curtains/curtain_list.dart index 667849f..5abb05e 100644 --- a/lib/features/devices/view/widgets/curtains/curtain_list.dart +++ b/lib/features/devices/view/widgets/curtains/curtain_list.dart @@ -36,40 +36,19 @@ class CurtainList extends StatelessWidget { padding: const EdgeInsets.all(0), itemCount: CurtainsCubit.category.devices.length, itemBuilder: (context, index) { - CurtainModel ac = + CurtainModel curtain = CurtainsCubit.category.devices[index] as CurtainModel; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - BodySmall( - text: - CurtainsCubit.category.devices[index].name ?? - ""), - IconButton( - onPressed: () { - DevicesCubit.get(context).selectDevice(ac); - }, - icon: const Icon( - Icons.arrow_forward_ios, - ), - style: ButtonStyle( - padding: MaterialStateProperty.all( - const EdgeInsets.all(0), - ), - iconSize: MaterialStateProperty.all(15), - alignment: Alignment.bottomRight, - ), - ), - ], - ), + const SizedBox(height: 20), + BodySmall( + text: + CurtainsCubit.category.devices[index].name ?? ""), const SizedBox(height: 5), if (CurtainsCubit.category.devices[index] is CurtainModel) DevicesDefaultSwitch( - model: ac, + model: curtain, ), ], ); diff --git a/lib/features/devices/view/widgets/devices_view_body.dart b/lib/features/devices/view/widgets/devices_view_body.dart index 0f26e56..d740482 100644 --- a/lib/features/devices/view/widgets/devices_view_body.dart +++ b/lib/features/devices/view/widgets/devices_view_body.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:smooth_page_indicator/smooth_page_indicator.dart'; -import 'package:syncrow_app/features/devices/view/widgets/devices_categories_view.dart'; +import 'package:syncrow_app/features/devices/view/widgets/wizard_page.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart'; @@ -35,7 +35,7 @@ class DevicesViewBody extends StatelessWidget { child: PageView( controller: pageController, children: const [ - DevicesCategoriesView(), + WizardPage(), Padding( padding: EdgeInsets.symmetric( horizontal: Constants.defaultPadding), diff --git a/lib/features/devices/view/widgets/lights/lights_view.dart b/lib/features/devices/view/widgets/lights/lights_view.dart index 98832e2..32671a1 100644 --- a/lib/features/devices/view/widgets/lights/lights_view.dart +++ b/lib/features/devices/view/widgets/lights/lights_view.dart @@ -28,7 +28,7 @@ class LightsView extends StatelessWidget { DevicesCubit.get(context).getSelectedDevice() as LightModel; } List lights = []; - for (var device in DevicesCubit.categories[1].devices) { + for (var device in DevicesCubit.allCategories[1].devices) { if (device is LightModel) { lights.add(device); } diff --git a/lib/features/devices/view/widgets/lights/lights_view_list.dart b/lib/features/devices/view/widgets/lights/lights_view_list.dart index b834ba8..5f3608e 100644 --- a/lib/features/devices/view/widgets/lights/lights_view_list.dart +++ b/lib/features/devices/view/widgets/lights/lights_view_list.dart @@ -30,7 +30,7 @@ class LightsViewList extends StatelessWidget { children: [ const BodySmall(text: "All Lights"), UniversalSwitch( - category: DevicesCubit.categories[1], + category: DevicesCubit.allCategories[1], ), LightsList(lights: lights), ], diff --git a/lib/features/devices/view/widgets/switches.dart b/lib/features/devices/view/widgets/switches.dart index 9e567cd..aac0661 100644 --- a/lib/features/devices/view/widgets/switches.dart +++ b/lib/features/devices/view/widgets/switches.dart @@ -28,7 +28,7 @@ class Switches extends StatelessWidget { padding: const EdgeInsets.only(top: 10), physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, - itemCount: DevicesCubit.categories.length, + itemCount: DevicesCubit.allCategories.length, itemBuilder: (_, index) { return InkWell( onTap: () { @@ -51,11 +51,11 @@ class Switches extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SvgPicture.asset( - DevicesCubit.categories[index].icon, + DevicesCubit.allCategories[index].icon, fit: BoxFit.contain, ), CustomSwitch( - category: DevicesCubit.categories[index], + category: DevicesCubit.allCategories[index], ), ], ), @@ -63,7 +63,7 @@ class Switches extends StatelessWidget { child: FittedBox( fit: BoxFit.scaleDown, child: BodyLarge( - text: DevicesCubit.categories[index].name, + text: DevicesCubit.allCategories[index].name, style: context.bodyLarge.copyWith( fontWeight: FontWeight.bold, height: 0, diff --git a/lib/features/devices/view/widgets/devices_categories_view.dart b/lib/features/devices/view/widgets/wizard_page.dart similarity index 95% rename from lib/features/devices/view/widgets/devices_categories_view.dart rename to lib/features/devices/view/widgets/wizard_page.dart index 7c5f697..61b8c66 100644 --- a/lib/features/devices/view/widgets/devices_categories_view.dart +++ b/lib/features/devices/view/widgets/wizard_page.dart @@ -7,8 +7,8 @@ import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.da import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; -class DevicesCategoriesView extends StatelessWidget { - const DevicesCategoriesView({ +class WizardPage extends StatelessWidget { + const WizardPage({ super.key, }); diff --git a/lib/my_app.dart b/lib/my_app.dart index 154b9e6..b92aa33 100644 --- a/lib/my_app.dart +++ b/lib/my_app.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/app_layout/bloc/nav_cubit.dart'; +import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart'; import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart'; @@ -29,6 +30,9 @@ class MyApp extends StatelessWidget { BlocProvider( create: (context) => NavCubit(), ), + BlocProvider( + create: (context) => SpacesCubit(), + ), BlocProvider( create: (context) => DevicesCubit(), ), diff --git a/lib/utils/resource_manager/theme_manager.dart b/lib/utils/resource_manager/theme_manager.dart index c028314..daf6bff 100644 --- a/lib/utils/resource_manager/theme_manager.dart +++ b/lib/utils/resource_manager/theme_manager.dart @@ -140,6 +140,38 @@ abstract class ThemeManager { // ), // ), + dropdownMenuTheme: const DropdownMenuThemeData( + textStyle: TextStyle( + fontFamily: FontsManager.fontFamily, + fontSize: FontSize.s16, + fontWeight: FontsManager.regular, + color: ColorsManager.textPrimaryColor, + ), + inputDecorationTheme: InputDecorationTheme( + border: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.grey), + borderRadius: BorderRadius.all(Radius.circular(8)), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: ColorsManager.primaryColor), + borderRadius: BorderRadius.all(Radius.circular(8)), + ), + labelStyle: TextStyle( + fontFamily: FontsManager.fontFamily, + color: Colors.grey, + fontSize: FontSize.s16, + fontWeight: FontsManager.regular, + ), + ), + menuStyle: MenuStyle( + backgroundColor: MaterialStatePropertyAll(Colors.white), + padding: MaterialStatePropertyAll(EdgeInsets.all(8)), + ), + ), + ///input decoration theme inputDecorationTheme: const InputDecorationTheme( border: OutlineInputBorder( diff --git a/pubspec.lock b/pubspec.lock index 7ddef2b..35200b7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -389,30 +389,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - url: "https://pub.dev" - source: hosted - version: "10.0.0" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.dev" - source: hosted - version: "2.0.1" lints: dependency: transitive description: @@ -425,26 +401,26 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" nested: dependency: transitive description: @@ -465,10 +441,10 @@ packages: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" path_parsing: dependency: transitive description: @@ -834,14 +810,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 - url: "https://pub.dev" - source: hosted - version: "13.0.0" web: dependency: transitive description: