From c5f88caec38d8ced31b3848abedd67b5c2bc1ddd Mon Sep 17 00:00:00 2001 From: Mohammad Salameh Date: Wed, 6 Mar 2024 23:11:09 +0300 Subject: [PATCH] Partially implemented the page view functionality -page controller on change need to be figured correctly --- .../app_layout/bloc/spaces_cubit.dart | 295 +++++++++++++----- .../app_layout/bloc/spaces_state.dart | 8 + .../view/widgets/app_bar_home_dropdown.dart | 91 +++--- .../view/widgets/devices_view_body.dart | 126 ++------ .../view/widgets/devices_view_header.dart | 27 ++ .../lights/light_interface_switch.dart | 2 +- .../devices/view/widgets/room_page.dart | 98 ++++++ .../devices/view/widgets/rooms_slider.dart | 72 +++++ .../devices/view/widgets/wizard_page.dart | 44 +-- .../{switches.dart => wizard_switches.dart} | 4 +- .../text_widgets/custom_text_widget.dart | 7 +- lib/utils/resource_manager/color_manager.dart | 5 +- 12 files changed, 503 insertions(+), 276 deletions(-) create mode 100644 lib/features/devices/view/widgets/devices_view_header.dart create mode 100644 lib/features/devices/view/widgets/room_page.dart create mode 100644 lib/features/devices/view/widgets/rooms_slider.dart rename lib/features/devices/view/widgets/{switches.dart => wizard_switches.dart} (97%) diff --git a/lib/features/app_layout/bloc/spaces_cubit.dart b/lib/features/app_layout/bloc/spaces_cubit.dart index b9c447f..e4d6a71 100644 --- a/lib/features/app_layout/bloc/spaces_cubit.dart +++ b/lib/features/app_layout/bloc/spaces_cubit.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/app_layout/model/space_model.dart'; import 'package:syncrow_app/features/devices/model/ac_model.dart'; @@ -23,7 +24,172 @@ class SpacesCubit extends Cubit { SpaceModel( id: '0', name: 'Home', - rooms: [], + 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.iconsGateway, + name: 'Gateway', + type: DeviceType.Gateway, + page: const GateWayView(), + ), + ]), + RoomModel(id: '1', name: 'Bedroom', 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.iconsGateway, + name: 'Gateway', + type: DeviceType.Gateway, + page: const GateWayView(), + ), + ]), + ], ), SpaceModel( id: '1', @@ -36,98 +202,55 @@ class SpacesCubit extends Cubit { 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; + RoomModel? selectedRoom; + + PageController devicesPageController = PageController(); + + ScrollController roomsScrollController = ScrollController(); + + int selectedRoomIndex = 0; + selectSpace(SpaceModel space) { selectedSpace = space; emit(SpacesSelected(space)); } + updateSelectedRoomIndex(int index) { + selectedRoomIndex = index; + emit(RoomSelected(selectedSpace.rooms.elementAt(index))); + } + + selectRoom(RoomModel room) { + selectedRoom = room; + selectedRoomIndex = selectedSpace.rooms.indexOf(room) + 1; + print(selectedRoomIndex); + devicesPageController.animateToPage( + selectedRoomIndex, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + // roomsScrollController.animateTo( + // roomsScrollController.positions.elementAt(selectedRoomIndex).pixels, + // duration: const Duration(milliseconds: 300), + // curve: Curves.easeInOut, + // ); + emit(RoomSelected(room)); + } + + unselectRoom() { + selectedRoom = null; + selectedRoomIndex = 0; + devicesPageController.animateToPage( + selectedRoomIndex, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + + emit(RoomUnSelected()); + } + //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 index 4491586..9d9c527 100644 --- a/lib/features/app_layout/bloc/spaces_state.dart +++ b/lib/features/app_layout/bloc/spaces_state.dart @@ -17,3 +17,11 @@ class SpacesSelected extends SpacesState { SpacesSelected(this.space); } + +class RoomSelected extends SpacesState { + final RoomModel room; + + RoomSelected(this.room); +} + +class RoomUnSelected extends SpacesState {} 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 4603823..6ee43a4 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 @@ -17,53 +17,56 @@ class AppBarHomeDropdown extends StatelessWidget { Widget build(BuildContext context) { 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, + return Padding( + padding: const EdgeInsets.only(left: 10, right: 10), + child: 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, + ), + ), + ), + ], + ), ), - ), - ); - }).toList(), - onChanged: (value) { - SpacesCubit.get(context).selectSpace(value!); - }, + ); + }).toList(), + onChanged: (value) { + SpacesCubit.get(context).selectSpace(value!); + }, + ), ); }, ); diff --git a/lib/features/devices/view/widgets/devices_view_body.dart b/lib/features/devices/view/widgets/devices_view_body.dart index d740482..e15224d 100644 --- a/lib/features/devices/view/widgets/devices_view_body.dart +++ b/lib/features/devices/view/widgets/devices_view_body.dart @@ -1,13 +1,14 @@ 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/app_layout/bloc/spaces_cubit.dart'; +import 'package:syncrow_app/features/devices/view/widgets/devices_view_header.dart'; +import 'package:syncrow_app/features/devices/view/widgets/room_page.dart'; +import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.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'; -import '../../../../utils/resource_manager/strings_manager.dart'; import '../../bloc/devices_cubit.dart'; -import 'switches.dart'; class DevicesViewBody extends StatelessWidget { const DevicesViewBody({ @@ -21,7 +22,6 @@ class DevicesViewBody extends StatelessWidget { child: BlocBuilder( builder: (context, state) { //TODO : move to NavigationCubit - PageController pageController = PageController(); return state is DevicesLoading ? const Center(child: CircularProgressIndicator()) : Padding( @@ -31,95 +31,24 @@ class DevicesViewBody extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + const DevicesViewHeader(), + const RoomsSlider(), + const SizedBox( + height: 10, + ), Expanded( child: PageView( - controller: pageController, - children: const [ - WizardPage(), - Padding( - padding: EdgeInsets.symmetric( - horizontal: Constants.defaultPadding), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - TitleMedium( - text: "Home", - style: TextStyle( - fontSize: 32, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - Expanded( - flex: 3, - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - TitleMedium( - text: StringsManager.wizard, - style: TextStyle( - fontSize: 28, - ), - ), - Switches(), - ], - ), - ), - ) - ], - ), - ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: Constants.defaultPadding), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - TitleMedium( - text: "Office", - style: TextStyle( - fontSize: 32, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - Expanded( - flex: 3, - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - TitleMedium( - text: StringsManager.wizard, - style: TextStyle( - fontSize: 28, - ), - ), - Switches(), - ], - ), - ), - ) - ], - ), - ), + controller: + SpacesCubit.get(context).devicesPageController, + children: [ + const WizardPage(), + ...SpacesCubit.get(context).selectedSpace.rooms.map( + (room) { + return RoomPage( + room: room, + ); + }, + ) ], ), ), @@ -128,18 +57,21 @@ class DevicesViewBody extends StatelessWidget { vertical: 7, ), child: SmoothPageIndicator( - controller: pageController, + controller: + SpacesCubit.get(context).devicesPageController, count: 3, effect: const WormEffect( dotHeight: 8, dotWidth: 8, ), onDotClicked: (index) { - pageController.animateToPage( - index, - duration: const Duration(milliseconds: 300), - curve: Curves.ease, - ); + SpacesCubit.get(context) + .devicesPageController + .animateToPage( + index, + duration: const Duration(milliseconds: 300), + curve: Curves.ease, + ); }), ), ], diff --git a/lib/features/devices/view/widgets/devices_view_header.dart b/lib/features/devices/view/widgets/devices_view_header.dart new file mode 100644 index 0000000..5e8b382 --- /dev/null +++ b/lib/features/devices/view/widgets/devices_view_header.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:syncrow_app/features/devices/view/widgets/devices_mode_tab.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart'; +import 'package:syncrow_app/utils/context_extension.dart'; +import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; + +class DevicesViewHeader extends StatelessWidget { + const DevicesViewHeader({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TitleMedium( + text: StringsManager.devices, + style: context.titleMedium.copyWith( + fontSize: 25, + ), + ), + const DevicesModeTab(), + ], + ); + } +} diff --git a/lib/features/devices/view/widgets/lights/light_interface_switch.dart b/lib/features/devices/view/widgets/lights/light_interface_switch.dart index 54458ce..691b201 100644 --- a/lib/features/devices/view/widgets/lights/light_interface_switch.dart +++ b/lib/features/devices/view/widgets/lights/light_interface_switch.dart @@ -39,7 +39,7 @@ class LightInterfaceSwitch extends StatelessWidget { width: 35, decoration: ShapeDecoration( color: light.status ?? false - ? ColorsManager.primaryWithOpacity + ? ColorsManager.primaryColorWithOpacity : Colors.grey, shape: const CircleBorder(), ), diff --git a/lib/features/devices/view/widgets/room_page.dart b/lib/features/devices/view/widgets/room_page.dart new file mode 100644 index 0000000..d9b673a --- /dev/null +++ b/lib/features/devices/view/widgets/room_page.dart @@ -0,0 +1,98 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; +import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/shared_widgets/custom_switch.dart'; +import 'package:syncrow_app/features/shared_widgets/default_container.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; +import 'package:syncrow_app/utils/context_extension.dart'; +import 'package:syncrow_app/utils/resource_manager/constants.dart'; + +class RoomPage extends StatelessWidget { + const RoomPage({super.key, required this.room}); + + final RoomModel room; + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: Constants.defaultPadding), + child: SingleChildScrollView( + child: BlocBuilder( + builder: (context, state) { + return GridView.builder( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + childAspectRatio: 1.5, + ), + padding: const EdgeInsets.only(top: 10), + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: room.categories.length, + itemBuilder: (_, index) { + return InkWell( + onTap: () { + DevicesCubit.get(context).selectCategory(index); + //Navigate to the chosen category view without animation + + // Navigator.push( + // context, + // CustomPageRoute( + // builder: (context) { + // return DevicesCubit.get(context) + // .chosenCategoryView!; + // }, + // ), + // ); + }, + child: DefaultContainer( + child: Padding( + padding: + const EdgeInsets.only(top: 10, right: 10, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + room.categories[index].icon, + fit: BoxFit.contain, + ), + CustomSwitch( + category: room.categories[index], + ), + ], + ), + Expanded( + child: FittedBox( + fit: BoxFit.scaleDown, + child: BodyLarge( + text: room.categories[index].name, + style: context.bodyLarge.copyWith( + fontWeight: FontWeight.bold, + height: 0, + fontSize: 24, + color: Colors.grey, + ), + ), + ), + ), + ], + ), + ), + ), + ); + }, + ); + }, + ), + ), + ); + } +} diff --git a/lib/features/devices/view/widgets/rooms_slider.dart b/lib/features/devices/view/widgets/rooms_slider.dart new file mode 100644 index 0000000..c606fa9 --- /dev/null +++ b/lib/features/devices/view/widgets/rooms_slider.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart'; +import 'package:syncrow_app/utils/context_extension.dart'; +import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; +import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; + +class RoomsSlider extends StatelessWidget { + const RoomsSlider({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return BlocBuilder( + builder: (context, state) { + return SingleChildScrollView( + controller: SpacesCubit.get(context).roomsScrollController, + scrollDirection: Axis.horizontal, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 15), + child: InkWell( + onTap: () { + SpacesCubit.get(context).unselectRoom(); + }, + child: TitleMedium( + text: StringsManager.wizard, + style: context.titleMedium.copyWith( + fontSize: 25, + color: SpacesCubit.get(context).selectedRoom == null + ? ColorsManager.textPrimaryColor + : ColorsManager.textPrimaryColor.withOpacity(.2), + ), + ), + ), + ), + ...SpacesCubit.get(context).selectedSpace.rooms.map( + (room) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 15), + child: InkWell( + onTap: () { + SpacesCubit.get(context).selectRoom(room); + }, + child: TitleMedium( + text: room.name, + style: context.titleMedium.copyWith( + fontSize: 25, + color: SpacesCubit.get(context).selectedRoomIndex == + SpacesCubit.get(context) + .selectedSpace + .rooms + .indexOf(room) + + 1 + ? ColorsManager.textPrimaryColor + : ColorsManager.textPrimaryColor + .withOpacity(.2), + ), + ), + ), + ), + ) + ], + ), + ); + }, + ); + } +} diff --git a/lib/features/devices/view/widgets/wizard_page.dart b/lib/features/devices/view/widgets/wizard_page.dart index 61b8c66..eb37796 100644 --- a/lib/features/devices/view/widgets/wizard_page.dart +++ b/lib/features/devices/view/widgets/wizard_page.dart @@ -1,11 +1,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; -import 'package:syncrow_app/features/devices/view/widgets/devices_mode_tab.dart'; -import 'package:syncrow_app/features/devices/view/widgets/switches.dart'; -import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart'; +import 'package:syncrow_app/features/devices/view/widgets/wizard_switches.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart'; -import 'package:syncrow_app/utils/resource_manager/strings_manager.dart'; class WizardPage extends StatelessWidget { const WizardPage({ @@ -16,43 +13,8 @@ class WizardPage extends StatelessWidget { Widget build(BuildContext context) { return const Padding( padding: EdgeInsets.symmetric(horizontal: Constants.defaultPadding), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 3, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TitleMedium( - text: StringsManager.devices, - style: TextStyle( - fontSize: 32, - fontWeight: FontWeight.bold, - ), - ), - DevicesModeTab(), - ], - ), - ), - Expanded( - flex: 11, - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TitleMedium( - text: StringsManager.wizard, - style: TextStyle( - fontSize: 28, - ), - ), - Switches(), - ], - ), - ), - ) - ], + child: SingleChildScrollView( + child: WizartSwitches(), ), ); } diff --git a/lib/features/devices/view/widgets/switches.dart b/lib/features/devices/view/widgets/wizard_switches.dart similarity index 97% rename from lib/features/devices/view/widgets/switches.dart rename to lib/features/devices/view/widgets/wizard_switches.dart index aac0661..6400625 100644 --- a/lib/features/devices/view/widgets/switches.dart +++ b/lib/features/devices/view/widgets/wizard_switches.dart @@ -9,8 +9,8 @@ import 'package:syncrow_app/utils/helpers/custom_page_route.dart'; import '../../bloc/devices_cubit.dart'; -class Switches extends StatelessWidget { - const Switches({ +class WizartSwitches extends StatelessWidget { + const WizartSwitches({ super.key, }); diff --git a/lib/features/shared_widgets/text_widgets/custom_text_widget.dart b/lib/features/shared_widgets/text_widgets/custom_text_widget.dart index 3871cbd..2feb415 100644 --- a/lib/features/shared_widgets/text_widgets/custom_text_widget.dart +++ b/lib/features/shared_widgets/text_widgets/custom_text_widget.dart @@ -28,12 +28,13 @@ class CustomText extends StatelessWidget { @override Widget build(BuildContext context) { - return SelectableText( + //was SelectableText + return Text( text, style: style, textAlign: textAlign, - onTap: onTap, - minLines: minLines, + // onTap: onTap, + // minLines: minLines, maxLines: maxLines, textDirection: textDirection, ); diff --git a/lib/utils/resource_manager/color_manager.dart b/lib/utils/resource_manager/color_manager.dart index dbd8d53..10022fd 100644 --- a/lib/utils/resource_manager/color_manager.dart +++ b/lib/utils/resource_manager/color_manager.dart @@ -3,14 +3,15 @@ import 'package:flutter/material.dart'; abstract class ColorsManager { static const Color textPrimaryColor = Color(0xFF5D5D5D); static const Color primaryColor = Color(0xFF0030CB); - static Color primaryWithOpacity = const Color(0xFF023DFE).withOpacity(0.6); + static Color primaryColorWithOpacity = + const Color(0xFF023DFE).withOpacity(0.6); static const Color onPrimaryColor = Colors.white; static const Color secondaryColor = Color(0xFF023DFE); static const Color onSecondaryColor = Color(0xFF023DFE); static const Color primaryTextColor = Colors.black; static const Color greyColor = Color(0xFFd5d5d5); - + static const Color backgroundColor = Color(0xFFececec); static const Color dozeColor = Color(0xFFFEC258); static const Color relaxColor = Color(0xFFFBD288);