diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fadcbcd..c859ce0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -177,6 +177,8 @@ PODS: - PromisesObjC (2.3.1) - PromisesSwift (2.3.1): - PromisesObjC (= 2.3.1) + - share_plus (0.0.1): + - Flutter - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS @@ -196,6 +198,7 @@ DEPENDENCIES: - onesignal_flutter (from `.symlinks/plugins/onesignal_flutter/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite (from `.symlinks/plugins/sqflite/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) @@ -237,6 +240,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/path_provider_foundation/darwin" permission_handler_apple: :path: ".symlinks/plugins/permission_handler_apple/ios" + share_plus: + :path: ".symlinks/plugins/share_plus/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" sqflite: @@ -269,6 +274,7 @@ SPEC CHECKSUMS: permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 PromisesSwift: 28dca69a9c40779916ac2d6985a0192a5cb4a265 + share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 diff --git a/lib/features/auth/bloc/auth_cubit.dart b/lib/features/auth/bloc/auth_cubit.dart index 2d3f9b1..db02c8a 100644 --- a/lib/features/auth/bloc/auth_cubit.dart +++ b/lib/features/auth/bloc/auth_cubit.dart @@ -208,6 +208,7 @@ class AuthCubit extends Cubit { sendOtp() async { try { + emit(AuthLoading()); await AuthenticationAPI.sendOtp(body: {'email': email, 'type': 'VERIFICATION'}); emit(AuthSignUpSuccess()); } catch (_) { @@ -217,6 +218,7 @@ class AuthCubit extends Cubit { reSendOtp() async { try { + emit(AuthLoading()); await AuthenticationAPI.sendOtp(body: {'email': email, 'type': 'VERIFICATION'}); emit(ResendOtpSuccess()); } catch (_) { diff --git a/lib/features/auth/view/login_view.dart b/lib/features/auth/view/login_view.dart index 7864972..9c9820d 100644 --- a/lib/features/auth/view/login_view.dart +++ b/lib/features/auth/view/login_view.dart @@ -1,5 +1,7 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart'; @@ -35,33 +37,33 @@ class LoginView extends StatelessWidget { }, builder: (context, state) { return Scaffold( - body: SafeArea( - child: Stack( - children: [ - Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, - ), - fit: BoxFit.cover, + body: Stack( + children: [ + Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.assetsImagesBackground, ), + fit: BoxFit.cover, ), ), - Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage(Assets.assetsImagesVector), - fit: BoxFit.cover, - opacity: 0.9, - ), + ), + Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage(Assets.assetsImagesVector), + fit: BoxFit.cover, + opacity: 0.9, ), ), - Padding( + ), + SafeArea( + child: Padding( padding: const EdgeInsets.only( right: Constants.defaultPadding, left: Constants.defaultPadding, @@ -100,9 +102,9 @@ class LoginView extends StatelessWidget { ), ), ), - ) - ], - ), + ), + ) + ], ), ); }, diff --git a/lib/features/auth/view/otp_view.dart b/lib/features/auth/view/otp_view.dart index 19b4486..6975309 100644 --- a/lib/features/auth/view/otp_view.dart +++ b/lib/features/auth/view/otp_view.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -116,7 +117,9 @@ class _OtpViewState extends State { return BlocConsumer( listener: (context, state) { if (state is AuthOtpSuccess) { - Navigator.pushNamedAndRemoveUntil(context, Routes.homeRoute, (value) => false); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + Navigator.popAndPushNamed(context, Routes.homeRoute); } if (state is ResendOtpSuccess) { startTimer(30); @@ -124,33 +127,33 @@ class _OtpViewState extends State { }, builder: (context, state) { return Scaffold( - body: SafeArea( - child: Stack( - children: [ - Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, - ), - fit: BoxFit.cover, + body: Stack( + children: [ + Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.assetsImagesBackground, ), + fit: BoxFit.cover, ), ), - Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage(Assets.assetsImagesVector), - fit: BoxFit.cover, - opacity: 0.9, - ), + ), + Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage(Assets.assetsImagesVector), + fit: BoxFit.cover, + opacity: 0.9, ), ), - Padding( + ), + SafeArea( + child: Padding( padding: const EdgeInsets.only( right: Constants.defaultPadding, left: Constants.defaultPadding, @@ -181,33 +184,38 @@ class _OtpViewState extends State { const SizedBox( height: 20, ), - RichText( - text: TextSpan( - text: - 'We have sent the verification codeWe have sent the verification code to', - style: Theme.of(context).textTheme.titleSmall!.copyWith( - color: Colors.white, - fontWeight: FontsManager.regular, - fontSize: 14, + GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: RichText( + text: TextSpan( + text: + 'We have sent the verification codeWe have sent the verification code to', + style: Theme.of(context).textTheme.titleSmall!.copyWith( + color: Colors.white, + fontWeight: FontsManager.regular, + fontSize: 14, + ), + children: [ + TextSpan( + text: ' $maskedEmail', + style: Theme.of(context).textTheme.titleSmall!.copyWith( + color: Colors.black, + fontWeight: FontsManager.bold, + fontSize: 14, + ), ), - children: [ - TextSpan( - text: ' $maskedEmail', - style: Theme.of(context).textTheme.titleSmall!.copyWith( - color: Colors.black, - fontWeight: FontsManager.bold, - fontSize: 14, - ), - ), - TextSpan( - text: ' change email?', - style: Theme.of(context).textTheme.titleSmall!.copyWith( - color: const Color(0xFF87C7FF), - fontWeight: FontsManager.regular, - fontSize: 14, - ), - ), - ]), + TextSpan( + text: ' change email?', + style: Theme.of(context).textTheme.titleSmall!.copyWith( + color: const Color(0xFF87C7FF), + fontWeight: FontsManager.regular, + fontSize: 14, + ), + ), + ]), + ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -326,7 +334,7 @@ class _OtpViewState extends State { return; } if ((state is! AuthLoading)) { - await AuthCubit.get(context).sendOtp(); + await AuthCubit.get(context).reSendOtp(); FocusScope.of(context).unfocus(); } }, @@ -340,9 +348,9 @@ class _OtpViewState extends State { ), ), ), - ) - ], - ), + ), + ) + ], ), ); }, diff --git a/lib/features/auth/view/sign_up_view.dart b/lib/features/auth/view/sign_up_view.dart index aa5d71e..e2ba925 100644 --- a/lib/features/auth/view/sign_up_view.dart +++ b/lib/features/auth/view/sign_up_view.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart'; @@ -21,39 +22,40 @@ class SignUpView extends StatelessWidget { return BlocConsumer( listener: (context, state) { if (state is AuthSignUpSuccess) { - Navigator.popAndPushNamed(context, Routes.otpRoute); + Navigator.pushNamed(context, Routes.otpRoute); + // Navigator.popAndPushNamed(context, Routes.otpRoute); } }, builder: (context, state) { return Scaffold( - body: SafeArea( - child: Stack( - children: [ - Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - padding: const EdgeInsets.symmetric(vertical: 24), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, - ), - fit: BoxFit.cover, + body: Stack( + children: [ + Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + padding: const EdgeInsets.symmetric(vertical: 24), + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.assetsImagesBackground, ), + fit: BoxFit.cover, ), ), - Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage(Assets.assetsImagesVector), - fit: BoxFit.cover, - opacity: 0.9, - ), + ), + Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage(Assets.assetsImagesVector), + fit: BoxFit.cover, + opacity: 0.9, ), ), - Padding( + ), + SafeArea( + child: Padding( padding: const EdgeInsets.only( right: Constants.defaultPadding, left: Constants.defaultPadding, @@ -125,6 +127,7 @@ class SignUpView extends StatelessWidget { keyboardType: TextInputType.text, scrollPadding: EdgeInsets.zero, autocorrect: false, + enableSuggestions: false, autofillHints: const [AutofillHints.email], validator: AuthCubit.get(context).emailAddressValidator, onTapOutside: (event) { @@ -170,6 +173,7 @@ class SignUpView extends StatelessWidget { keyboardType: TextInputType.text, scrollPadding: EdgeInsets.zero, autocorrect: false, + enableSuggestions: false, autofillHints: const [AutofillHints.password], onChanged: (value) {}, validator: AuthCubit.get(context).reEnterPasswordCheck, @@ -220,9 +224,9 @@ class SignUpView extends StatelessWidget { ), ), ), - ) - ], - ), + ), + ) + ], ), ); }, diff --git a/lib/features/devices/bloc/devices_cubit.dart b/lib/features/devices/bloc/devices_cubit.dart index 096320a..48341df 100644 --- a/lib/features/devices/bloc/devices_cubit.dart +++ b/lib/features/devices/bloc/devices_cubit.dart @@ -23,7 +23,8 @@ part 'devices_state.dart'; class DevicesCubit extends Cubit { DevicesCubit._() : super(DevicesInitial()) { - if (HomeCubit.getInstance().selectedSpace != null) { + if (HomeCubit.getInstance().selectedSpace != null && + HomeCubit.getInstance().spaces!.isNotEmpty) { // fetchGroups(HomeCubit.getInstance().selectedSpace!.id!); for (var room in HomeCubit.getInstance().selectedSpace!.rooms!) { fetchDevicesByRoomId(room.id!); diff --git a/lib/features/devices/view/widgets/ACs/ac_interface.dart b/lib/features/devices/view/widgets/ACs/ac_interface.dart index e08daaa..5a7ebd2 100644 --- a/lib/features/devices/view/widgets/ACs/ac_interface.dart +++ b/lib/features/devices/view/widgets/ACs/ac_interface.dart @@ -5,7 +5,6 @@ import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface_controls.dart'; import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface_temp_unit.dart'; -import 'package:syncrow_app/generated/assets.dart'; class AcInterface extends StatelessWidget { const AcInterface({super.key, required this.ac}); @@ -31,43 +30,30 @@ class AcInterface extends StatelessWidget { // extendBodyBehindAppBar: true, // extendBody: true, // body: - Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, + SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ConstrainedBox( + constraints: const BoxConstraints( + maxHeight: 380, + ), + child: AcInterfaceTempUnit( + acDevice: ac, + ), ), - fit: BoxFit.cover, - opacity: 0.4, - ), - ), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ConstrainedBox( - constraints: const BoxConstraints( - maxHeight: 380, - ), - child: AcInterfaceTempUnit( - acDevice: ac, - ), + const SizedBox( + height: 10, + ), + ConstrainedBox( + constraints: const BoxConstraints( + maxHeight: 130, ), - const SizedBox( - height: 10, + child: AcInterfaceControls( + deviceModel: ac, ), - ConstrainedBox( - constraints: const BoxConstraints( - maxHeight: 130, - ), - child: AcInterfaceControls( - deviceModel: ac, - ), - ), - ], - ), + ), + ], ), ); // ); diff --git a/lib/features/devices/view/widgets/ACs/acs_view.dart b/lib/features/devices/view/widgets/ACs/acs_view.dart index 63cafde..95f05c1 100644 --- a/lib/features/devices/view/widgets/ACs/acs_view.dart +++ b/lib/features/devices/view/widgets/ACs/acs_view.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart'; import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart'; @@ -8,9 +9,11 @@ import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart' import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_list.dart'; import 'package:syncrow_app/features/devices/view/widgets/ACs/category_view_app_bar.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/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/generated/assets.dart'; +import 'package:syncrow_app/utils/resource_manager/font_manager.dart'; class ACsView extends StatelessWidget { final DeviceModel? deviceModel; @@ -27,17 +30,28 @@ class ACsView extends StatelessWidget { // if (DevicesCubit.getInstance().getSelectedDevice() is DeviceModel) { // selectedAC = DevicesCubit.getInstance().getSelectedDevice() as DeviceModel; // } - return Scaffold( - backgroundColor: ColorsManager.backgroundColor, - // extendBodyBehindAppBar: true, - // extendBody: true, - appBar: CategoryViewAppBar( - title: deviceModel?.name ?? '', + return AnnotatedRegion( + value: SystemUiOverlayStyle( + statusBarColor: ColorsManager.primaryColor.withOpacity(0.5), + statusBarIconBrightness: Brightness.light, ), - body: SafeArea( - child: Container( + child: Scaffold( + backgroundColor: ColorsManager.backgroundColor, + extendBodyBehindAppBar: true, + extendBody: true, + appBar: AppBar( + backgroundColor: Colors.transparent, + centerTitle: true, + title: BodyLarge( + text: deviceModel?.name ?? "", + fontColor: ColorsManager.primaryColor, + fontWeight: FontsManager.bold, + ), + ), + body: Container( width: MediaQuery.sizeOf(context).width, height: MediaQuery.sizeOf(context).height, + padding: const EdgeInsets.all(Constants.defaultPadding), decoration: const BoxDecoration( image: DecorationImage( image: AssetImage( @@ -47,21 +61,16 @@ class ACsView extends StatelessWidget { opacity: 0.4, ), ), - child: Padding( - padding: const EdgeInsets.only( - top: Constants.defaultPadding, - left: Constants.defaultPadding, - right: Constants.defaultPadding, - ), - child: state is AcsLoadingState - ? const Center( - child: DefaultContainer( - width: 50, height: 50, child: CircularProgressIndicator()), - ) - : SizedBox.expand( - child: deviceModel != null ? AcInterface(ac: deviceModel!) : ACsList(), - ), - ), + child: state is AcsLoadingState + ? const Center( + child: DefaultContainer( + width: 50, height: 50, child: CircularProgressIndicator()), + ) + : Container( + padding: const EdgeInsets.only(top: 25), + alignment: AlignmentDirectional.center, + child: deviceModel != null ? AcInterface(ac: deviceModel!) : ACsList(), + ), ), ), ); diff --git a/lib/features/devices/view/widgets/ACs/universal_ac_temp.dart b/lib/features/devices/view/widgets/ACs/universal_ac_temp.dart index da6e021..f6fd355 100644 --- a/lib/features/devices/view/widgets/ACs/universal_ac_temp.dart +++ b/lib/features/devices/view/widgets/ACs/universal_ac_temp.dart @@ -3,7 +3,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart'; import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart'; -import 'package:syncrow_app/features/devices/bloc/devices_cubit.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'; diff --git a/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart b/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart index 201ea4a..8f494c3 100644 --- a/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart +++ b/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart @@ -20,8 +20,6 @@ import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/utils/resource_manager/font_manager.dart'; -import '../wall_sensor/wall_sensor_interface.dart'; - class CeilingSensorInterface extends StatelessWidget { const CeilingSensorInterface({super.key, required this.ceilingSensor}); final DeviceModel ceilingSensor; @@ -47,83 +45,86 @@ class CeilingSensorInterface extends StatelessWidget { statusBarColor: ColorsManager.primaryColor.withOpacity(0.5), statusBarIconBrightness: Brightness.light, ), - child: SafeArea( - child: Scaffold( - backgroundColor: ColorsManager.backgroundColor, - extendBodyBehindAppBar: true, - extendBody: true, - appBar: AppBar( - backgroundColor: Colors.transparent, - centerTitle: true, - title: BodyLarge( - text: ceilingSensor.name ?? "", - fontColor: ColorsManager.primaryColor, - fontWeight: FontsManager.bold, - ), + child: Scaffold( + backgroundColor: ColorsManager.backgroundColor, + extendBodyBehindAppBar: true, + extendBody: true, + appBar: AppBar( + backgroundColor: Colors.transparent, + centerTitle: true, + title: BodyLarge( + text: ceilingSensor.name ?? "", + fontColor: ColorsManager.primaryColor, + fontWeight: FontsManager.bold, ), - body: state is LoadingInitialState - ? const Center( - child: RefreshProgressIndicator(), - ) - : Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - padding: const EdgeInsets.all(Constants.defaultPadding), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, - ), - fit: BoxFit.cover, - opacity: 0.4, - ), - ), - child: Column( - children: [ - const Spacer(), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () { - if ((ceilingSensor.isOnline ?? false) == false) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - 'Device is offline', - ), - backgroundColor: Colors.red, - ), - ); - return; - } - String controlCode = 'sensitivity'; - showDialog( - context: context, - builder: (context) => ParameterControlDialog( - title: 'Sensitivity', - sensor: ceilingSensor, - controlCode: controlCode, - value: ceilingSensor.status - .firstWhere((element) => element.code == controlCode) - .value as int, - min: ceilingSensor.functions - .firstWhere((element) => element.code == controlCode) - .values - ?.min ?? - 0, - max: ceilingSensor.functions - .firstWhere((element) => element.code == controlCode) - .values - ?.max ?? - 0, - ), - ); - }, - child: SvgPicture.asset( - state == 'presence' - ? Assets.assetsIconsPresenceSensorAssetsPresence - : Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion, + ), + body: Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + padding: const EdgeInsets.all(Constants.defaultPadding), + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.assetsImagesBackground, + ), + fit: BoxFit.cover, + opacity: 0.4, + ), + ), + child: state is LoadingInitialState + ? const Center( + child: RefreshProgressIndicator(), + ) + : SafeArea( + child: Column( + children: [ + const Spacer(), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // InkWell( + // onTap: () { + // if ((ceilingSensor.isOnline ?? false) == false) { + // ScaffoldMessenger.of(context).showSnackBar( + // const SnackBar( + // content: Text( + // 'Device is offline', + // ), + // backgroundColor: Colors.red, + // ), + // ); + // return; + // } + // String controlCode = 'sensitivity'; + // showDialog( + // context: context, + // builder: (context) => ParameterControlDialog( + // title: 'Sensitivity', + // sensor: ceilingSensor, + // controlCode: controlCode, + // value: ceilingSensor.status + // .firstWhere((element) => element.code == controlCode) + // .value as int, + // min: ceilingSensor.functions + // .firstWhere((element) => element.code == controlCode) + // .values + // ?.min ?? + // 0, + // max: ceilingSensor.functions + // .firstWhere((element) => element.code == controlCode) + // .values + // ?.max ?? + // 0, + // ), + // ); + // }, + // child: + // ), + + SvgPicture.asset( + ceilingSensorModel.presenceState.toLowerCase() == 'motion' + ? Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion + : Assets.assetsIconsPresenceSensorAssetsPresence, width: 100, height: 100, // colorFilter: ColorFilter.mode( @@ -133,154 +134,153 @@ class CeilingSensorInterface extends StatelessWidget { // BlendMode.srcIn, // ), ), - ), - const SizedBox( - height: 10, - ), - BodyMedium( - text: StringHelpers.toTitleCase(ceilingSensorModel.presenceState), - // (ceilingSensor.isOnline ?? false) - // ? StringHelpers.toTitleCase(ceilingSensor.status - // .firstWhere((element) => - // element.code == 'presence_state') - // .value - // .toString()) - // : "Offline", - style: context.bodyMedium.copyWith( - fontWeight: FontsManager.bold, - ), - ), - ], - ), - const Spacer(), - SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.min, - children: [ - DefaultContainer( - padding: const EdgeInsets.symmetric( - vertical: 20, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - mainAxisSize: MainAxisSize.min, - children: [ - const Flexible(child: BodySmall(text: 'Sports Para')), - Flexible( - child: BodyLarge( - text: '0', - style: context.bodyLarge.copyWith( - fontWeight: FontsManager.bold, - ), - ), - ), - ], - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Container( - width: 1, - height: 45, - color: ColorsManager.greyColor, - ), - ), - Column( - mainAxisSize: MainAxisSize.min, - children: [ - const Flexible( - child: BodySmall( - text: 'Detection Range', - textOverflow: TextOverflow.ellipsis, - )), - Flexible( - child: BodyLarge( - text: '0.0M', - textOverflow: TextOverflow.ellipsis, - style: context.bodyLarge.copyWith( - fontWeight: FontsManager.bold, - ), - ), - ), - ], - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Container( - width: 1, - height: 45, - color: ColorsManager.greyColor, - ), - ), - Column( - mainAxisSize: MainAxisSize.min, - children: [ - const Flexible( - child: BodySmall( - text: 'Movement', - textOverflow: TextOverflow.ellipsis, - )), - Flexible( - child: BodyLarge( - text: 'none', - textOverflow: TextOverflow.ellipsis, - style: context.bodyLarge.copyWith( - fontWeight: FontsManager.bold, - ), - ), - ), - ], - ), - ], - )), const SizedBox( - height: 15, + height: 10, ), - ...List.generate( - ceilingSensorButtons.length, - (index) => DefaultContainer( - margin: const EdgeInsets.only(bottom: 5), - padding: - const EdgeInsets.symmetric(vertical: 12, horizontal: 20), - onTap: () { - if (ceilingSensorButtons[index]['page'] != null) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - ceilingSensorButtons[index]['page'] as Widget, - ), - ); - } - }, - child: Row( - children: [ - SvgPicture.asset( - ceilingSensorButtons[index]['icon'] as String, - // width: 30, - // height: 50, - ), - const SizedBox( - width: 25, - ), - BodyMedium( - text: ceilingSensorButtons[index]['title'] as String, - style: context.bodyMedium.copyWith( - fontWeight: FontsManager.bold, - ), - ), - ], - ), + BodyMedium( + text: StringHelpers.toTitleCase(ceilingSensorModel.presenceState), + // (ceilingSensor.isOnline ?? false) + // ? StringHelpers.toTitleCase(ceilingSensor.status + // .firstWhere((element) => + // element.code == 'presence_state') + // .value + // .toString()) + // : "Offline", + style: context.bodyMedium.copyWith( + fontWeight: FontsManager.bold, ), ), ], ), - ), - ], + const Spacer(), + SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ + DefaultContainer( + padding: const EdgeInsets.symmetric( + vertical: 20, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Flexible(child: BodySmall(text: 'Sports Para')), + Flexible( + child: BodyLarge( + text: '0', + style: context.bodyLarge.copyWith( + fontWeight: FontsManager.bold, + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Container( + width: 1, + height: 45, + color: ColorsManager.greyColor, + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Flexible( + child: BodySmall( + text: 'Detection Range', + textOverflow: TextOverflow.ellipsis, + )), + Flexible( + child: BodyLarge( + text: '0.0M', + textOverflow: TextOverflow.ellipsis, + style: context.bodyLarge.copyWith( + fontWeight: FontsManager.bold, + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Container( + width: 1, + height: 45, + color: ColorsManager.greyColor, + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Flexible( + child: BodySmall( + text: 'Movement', + textOverflow: TextOverflow.ellipsis, + )), + Flexible( + child: BodyLarge( + text: 'none', + textOverflow: TextOverflow.ellipsis, + style: context.bodyLarge.copyWith( + fontWeight: FontsManager.bold, + ), + ), + ), + ], + ), + ], + )), + const SizedBox( + height: 15, + ), + ...List.generate( + ceilingSensorButtons.length, + (index) => DefaultContainer( + margin: const EdgeInsets.only(bottom: 5), + padding: + const EdgeInsets.symmetric(vertical: 12, horizontal: 20), + onTap: () { + if (ceilingSensorButtons[index]['page'] != null) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + ceilingSensorButtons[index]['page'] as Widget, + ), + ); + } + }, + child: Row( + children: [ + SvgPicture.asset( + ceilingSensorButtons[index]['icon'] as String, + // width: 30, + // height: 50, + ), + const SizedBox( + width: 25, + ), + BodyMedium( + text: ceilingSensorButtons[index]['title'] as String, + style: context.bodyMedium.copyWith( + fontWeight: FontsManager.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ), + ], + ), )), - ), ), ); }), diff --git a/lib/features/devices/view/widgets/smart_door/door_grid.dart b/lib/features/devices/view/widgets/smart_door/door_grid.dart index 311b25f..fc33595 100644 --- a/lib/features/devices/view/widgets/smart_door/door_grid.dart +++ b/lib/features/devices/view/widgets/smart_door/door_grid.dart @@ -15,53 +15,50 @@ class DoorLockGrid extends StatelessWidget { @override Widget build(BuildContext context) { - return ConstrainedBox( - constraints: const BoxConstraints(maxHeight: 270), - child: GridView.builder( - // shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - mainAxisSpacing: 10, - crossAxisSpacing: 10, - childAspectRatio: 1.75 / 1, - ), - itemCount: 4, - itemBuilder: (context, index) => DefaultContainer( - onTap: () { - //TODO: remove checking after adding the pages - doorLockButtons[index]['page'] != null - ? Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => doorLockButtons[index]['page'] as Widget, - ), - ) - : null; - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ConstrainedBox( - constraints: const BoxConstraints(maxHeight: 46, maxWidth: 50), - child: SvgPicture.asset( - doorLockButtons[index]['image'] as String, - ), - ), - const SizedBox( - height: 15, - ), - Flexible( - child: FittedBox( - child: BodySmall( - text: doorLockButtons[index]['title'] as String, - // doorLockButtons.keys.elementAt(index), - textAlign: TextAlign.center, + return GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + mainAxisSpacing: 10, + crossAxisSpacing: 10, + childAspectRatio: 1.75 / 1, + ), + itemCount: 4, + itemBuilder: (context, index) => DefaultContainer( + onTap: () { + //TODO: remove checking after adding the pages + doorLockButtons[index]['page'] != null + ? Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => doorLockButtons[index]['page'] as Widget, ), + ) + : null; + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ConstrainedBox( + constraints: const BoxConstraints(maxHeight: 46, maxWidth: 50), + child: SvgPicture.asset( + doorLockButtons[index]['image'] as String, + ), + ), + const SizedBox( + height: 15, + ), + Flexible( + child: FittedBox( + child: BodySmall( + text: doorLockButtons[index]['title'] as String, + // doorLockButtons.keys.elementAt(index), + textAlign: TextAlign.center, ), ), - ], - ), + ), + ], ), ), ); diff --git a/lib/features/devices/view/widgets/smart_door/door_interface.dart b/lib/features/devices/view/widgets/smart_door/door_interface.dart index d9585f3..d6fea49 100644 --- a/lib/features/devices/view/widgets/smart_door/door_interface.dart +++ b/lib/features/devices/view/widgets/smart_door/door_interface.dart @@ -9,7 +9,6 @@ import 'package:syncrow_app/features/devices/model/smart_door_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_button.dart'; import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_grid.dart'; import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_status_bar.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/generated/assets.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; @@ -65,44 +64,43 @@ class DoorInterface extends StatelessWidget { statusBarColor: ColorsManager.primaryColor.withOpacity(0.5), statusBarIconBrightness: Brightness.light, ), - child: SafeArea( - child: Scaffold( - backgroundColor: ColorsManager.backgroundColor, - extendBodyBehindAppBar: true, - extendBody: true, - appBar: AppBar( - backgroundColor: Colors.transparent, - centerTitle: true, - title: BodyLarge( - text: doorLock.name ?? "", - fontColor: ColorsManager.primaryColor, - fontWeight: FontsManager.bold, + child: Scaffold( + backgroundColor: ColorsManager.backgroundColor, + extendBodyBehindAppBar: true, + extendBody: true, + appBar: AppBar( + backgroundColor: Colors.transparent, + centerTitle: true, + title: BodyLarge( + text: doorLock.name ?? "", + fontColor: ColorsManager.primaryColor, + fontWeight: FontsManager.bold, + ), + ), + body: Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.assetsImagesBackground, + ), + fit: BoxFit.cover, + opacity: 0.4, ), ), - body: state is LoadingInitialState - ? const Center( - child: DefaultContainer( - width: 50, height: 50, child: CircularProgressIndicator()), - ) - : Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, - ), - fit: BoxFit.cover, - opacity: 0.4, - ), - ), - child: Padding( - padding: EdgeInsets.only( - top: Constants.appBarHeight, - left: Constants.defaultPadding, - right: Constants.defaultPadding, - ), - child: Column( + child: SafeArea( + child: Padding( + padding: EdgeInsets.only( + top: Constants.appBarHeight, + left: Constants.defaultPadding, + right: Constants.defaultPadding, + ), + child: state is LoadingInitialState + ? const Center( + child: RefreshProgressIndicator(), + ) + : Column( children: [ DoorLockStatusBar( smartDoorModel: smartDoorModel, @@ -120,7 +118,7 @@ class DoorInterface extends StatelessWidget { ) ], )), - ), + ), ), ), ); diff --git a/lib/features/devices/view/widgets/three_gang/three_gang_interface.dart b/lib/features/devices/view/widgets/three_gang/three_gang_interface.dart index dd37fd2..8507d6e 100644 --- a/lib/features/devices/view/widgets/three_gang/three_gang_interface.dart +++ b/lib/features/devices/view/widgets/three_gang/three_gang_interface.dart @@ -20,32 +20,32 @@ class ThreeGangInterface extends StatelessWidget { statusBarColor: ColorsManager.primaryColor.withOpacity(0.5), statusBarIconBrightness: Brightness.light, ), - child: SafeArea( - child: Scaffold( - backgroundColor: ColorsManager.backgroundColor, - extendBodyBehindAppBar: true, - extendBody: true, - appBar: AppBar( - backgroundColor: Colors.transparent, - centerTitle: true, - title: BodyLarge( - text: gangSwitch.name ?? "", - fontColor: ColorsManager.primaryColor, - fontWeight: FontsManager.bold, + child: Scaffold( + backgroundColor: ColorsManager.backgroundColor, + extendBodyBehindAppBar: true, + extendBody: true, + appBar: AppBar( + backgroundColor: Colors.transparent, + centerTitle: true, + title: BodyLarge( + text: gangSwitch.name ?? "", + fontColor: ColorsManager.primaryColor, + fontWeight: FontsManager.bold, + ), + ), + body: Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.assetsImagesBackground, + ), + fit: BoxFit.cover, + opacity: 0.4, ), ), - body: Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, - ), - fit: BoxFit.cover, - opacity: 0.4, - ), - ), + child: SafeArea( child: Padding( padding: EdgeInsets.only( top: Constants.appBarHeight, diff --git a/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart b/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart index ca6dc19..36e02c5 100644 --- a/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart +++ b/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart @@ -15,9 +15,9 @@ class PresenceIndicator extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( - state == 'presence' - ? Assets.assetsIconsPresenceSensorAssetsPresence - : Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion, + state.toLowerCase() == 'motion' + ? Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion + : Assets.assetsIconsPresenceSensorAssetsPresence, width: 100, height: 100, ), diff --git a/lib/features/devices/view/widgets/wall_sensor/wall_sensor_interface.dart b/lib/features/devices/view/widgets/wall_sensor/wall_sensor_interface.dart index 6101569..2cf555e 100644 --- a/lib/features/devices/view/widgets/wall_sensor/wall_sensor_interface.dart +++ b/lib/features/devices/view/widgets/wall_sensor/wall_sensor_interface.dart @@ -52,38 +52,38 @@ class WallMountedInterface extends StatelessWidget { statusBarColor: ColorsManager.primaryColor.withOpacity(0.5), statusBarIconBrightness: Brightness.light, ), - child: SafeArea( - child: Scaffold( - backgroundColor: ColorsManager.backgroundColor, - extendBodyBehindAppBar: true, - extendBody: true, - appBar: AppBar( - backgroundColor: Colors.transparent, - centerTitle: true, - title: BodyLarge( - text: deviceModel.name ?? "", - fontColor: ColorsManager.primaryColor, - fontWeight: FontsManager.bold, + child: Scaffold( + backgroundColor: ColorsManager.backgroundColor, + extendBodyBehindAppBar: true, + extendBody: true, + appBar: AppBar( + backgroundColor: Colors.transparent, + centerTitle: true, + title: BodyLarge( + text: deviceModel.name ?? "", + fontColor: ColorsManager.primaryColor, + fontWeight: FontsManager.bold, + ), + ), + body: Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height, + padding: const EdgeInsets.all(Constants.defaultPadding), + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.assetsImagesBackground, + ), + fit: BoxFit.cover, + opacity: 0.4, ), ), - body: Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - padding: const EdgeInsets.all(Constants.defaultPadding), - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - Assets.assetsImagesBackground, - ), - fit: BoxFit.cover, - opacity: 0.4, - ), - ), - child: state is LoadingInitialState - ? const Center( - child: RefreshProgressIndicator(), - ) - : Column( + child: state is LoadingInitialState + ? const Center( + child: RefreshProgressIndicator(), + ) + : SafeArea( + child: Column( children: [ PresenceIndicator( state: wallSensorModel.presenceState, @@ -94,7 +94,7 @@ class WallMountedInterface extends StatelessWidget { ), ], ), - ), + ), ), ), ); diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart index bc85498..46a0c8a 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart @@ -1,4 +1,5 @@ import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart'; import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart'; @@ -101,6 +102,7 @@ class ManageUnitBloc extends Bloc { final roomsList = await SpacesAPI.getRoomsBySpaceId(event.unitId); allDevices = await HomeManagementAPI.fetchDevicesByUserId(); emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList)); + await HomeCubit.getInstance().fetchUnitsByUserId(); } else { emit(const ErrorState(message: 'Something went wrong')); } diff --git a/lib/features/menu/view/widgets/manage_home/home_settings.dart b/lib/features/menu/view/widgets/manage_home/home_settings.dart index 5b4ce6a..751c04b 100644 --- a/lib/features/menu/view/widgets/manage_home/home_settings.dart +++ b/lib/features/menu/view/widgets/manage_home/home_settings.dart @@ -40,8 +40,9 @@ class HomeSettingsView extends StatelessWidget { Flexible( child: TextField( textAlign: TextAlign.end, + readOnly: true, decoration: InputDecoration( - hintText: 'Enter Name', + hintText: space?.name ?? 'Enter Name', hintStyle: context.bodyMedium.copyWith(color: Colors.grey), border: InputBorder.none, ), @@ -55,15 +56,16 @@ class HomeSettingsView extends StatelessWidget { height: 1, color: ColorsManager.greyColor, ), - Container( - width: MediaQuery.sizeOf(context).width, - child: GestureDetector( - onTap: () { - Navigator.of(context).push(CustomPageRoute( - builder: (context) => RoomsView( - unitId: space?.id ?? '', - ))); - }, + GestureDetector( + onTap: () { + Navigator.of(context).push(CustomPageRoute( + builder: (context) => RoomsView( + unitId: space?.id ?? '', + ))); + }, + child: Container( + width: MediaQuery.sizeOf(context).width, + padding: const EdgeInsets.all(4), child: const Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/services/api/http_interceptor.dart b/lib/services/api/http_interceptor.dart index 411732d..f153686 100644 --- a/lib/services/api/http_interceptor.dart +++ b/lib/services/api/http_interceptor.dart @@ -21,19 +21,16 @@ class HTTPInterceptor extends InterceptorsWrapper { if (await validateResponse(response)) { super.onResponse(response, handler); } else { - handler.reject(DioException( - requestOptions: response.requestOptions, response: response)); + handler.reject(DioException(requestOptions: response.requestOptions, response: response)); } } @override - void onRequest( - RequestOptions options, RequestInterceptorHandler handler) async { + void onRequest(RequestOptions options, RequestInterceptorHandler handler) async { var storage = const FlutterSecureStorage(); var token = await storage.read(key: Token.loginAccessTokenKey); if (checkHeaderExclusionListOfAddedParameters(options.path)) { - options.headers - .putIfAbsent(HttpHeaders.authorizationHeader, () => "Bearer $token"); + options.headers.putIfAbsent(HttpHeaders.authorizationHeader, () => "Bearer $token"); } // options.headers['Authorization'] = 'Bearer ${'${token!}123'}'; super.onRequest(options, handler); @@ -42,12 +39,13 @@ class HTTPInterceptor extends InterceptorsWrapper { @override void onError(DioException err, ErrorInterceptorHandler handler) async { ServerFailure failure = ServerFailure.fromDioError(err); - CustomSnackBar.displaySnackBar(failure.toString()); + if (failure.toString().isNotEmpty) { + CustomSnackBar.displaySnackBar(failure.toString()); + } var storage = const FlutterSecureStorage(); var token = await storage.read(key: Token.loginAccessTokenKey); if (err.response?.statusCode == 401 && token != null) { - await AuthCubit.get(NavigationService.navigatorKey.currentContext!) - .logout(); + await AuthCubit.get(NavigationService.navigatorKey.currentContext!).logout(); } super.onError(err, handler); } diff --git a/lib/services/api/network_exception.dart b/lib/services/api/network_exception.dart index d8f8d23..f6fb88c 100644 --- a/lib/services/api/network_exception.dart +++ b/lib/services/api/network_exception.dart @@ -31,8 +31,8 @@ class ServerFailure extends Failure { { // var document = parser.parse(dioError.response!.data.toString()); // var message = document.body!.text; - return ServerFailure.fromResponse(dioError.response!.statusCode!, - dioError.response?.data['message'] ?? "Error"); + return ServerFailure.fromResponse( + dioError.response!.statusCode!, dioError.response?.data['message'] ?? "Error"); } case DioExceptionType.cancel: return ServerFailure("The request to ApiServer was canceled"); @@ -64,7 +64,7 @@ class ServerFailure extends Failure { } return ServerFailure(errors.join('\n')); case 404: - return ServerFailure("Your request not found, Please try later!"); + return ServerFailure(""); case 500: return ServerFailure(responseMessage); default: diff --git a/pubspec.yaml b/pubspec.yaml index c60bd0c..1c147c0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: This is the mobile application project, developed with Flutter for # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: "none" # Remove this line if you wish to publish to pub.dev -version: 1.0.2+4 +version: 1.0.4+6 environment: sdk: ">=3.0.6 <4.0.0"