mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
password_changes&_routine_changes
This commit is contained in:
@ -237,22 +237,26 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendOtp() async {
|
sendOtp({bool? isforget}) async {
|
||||||
try {
|
try {
|
||||||
emit(AuthLoading());
|
emit(AuthLoading());
|
||||||
await AuthenticationAPI.sendOtp(
|
await AuthenticationAPI.sendOtp(body: {
|
||||||
body: {'email': email, 'type': 'VERIFICATION'});
|
'email': email,
|
||||||
|
'type': isforget == true ? 'PASSWORD' : 'VERIFICATION'
|
||||||
|
});
|
||||||
emit(AuthSignUpSuccess());
|
emit(AuthSignUpSuccess());
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
emit(AuthLoginError(message: 'Something went wrong'));
|
emit(AuthLoginError(message: 'Something went wrong'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> reSendOtp() async {
|
Future<bool> reSendOtp({bool? forget}) async {
|
||||||
try {
|
try {
|
||||||
emit(AuthLoading());
|
emit(AuthLoading());
|
||||||
await AuthenticationAPI.sendOtp(
|
await AuthenticationAPI.sendOtp(body: {
|
||||||
body: {'email': email, 'type': 'VERIFICATION'});
|
'email': email,
|
||||||
|
'type': forget == true ? 'PASSWORD' : 'VERIFICATION'
|
||||||
|
});
|
||||||
emit(ResendOtpSuccess());
|
emit(ResendOtpSuccess());
|
||||||
return true;
|
return true;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
@ -264,8 +268,11 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
verifyOtp(bool isForgotPass) async {
|
verifyOtp(bool isForgotPass) async {
|
||||||
emit(AuthLoginLoading());
|
emit(AuthLoginLoading());
|
||||||
try {
|
try {
|
||||||
final response = await AuthenticationAPI.verifyPassCode(
|
final response = await AuthenticationAPI.verifyPassCode(body: {
|
||||||
body: {'email': email, 'type': 'VERIFICATION', 'otpCode': otpCode});
|
'email': email,
|
||||||
|
'type': isForgotPass == true ? 'PASSWORD' : 'VERIFICATION',
|
||||||
|
'otpCode': otpCode
|
||||||
|
});
|
||||||
if (response['statusCode'] == 200) {
|
if (response['statusCode'] == 200) {
|
||||||
if (!isForgotPass) {
|
if (!isForgotPass) {
|
||||||
emailController.text = email;
|
emailController.text = email;
|
||||||
@ -340,7 +347,9 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
sendToForgetPassword({required String password}) async {
|
sendToForgetPassword({required String password}) async {
|
||||||
try {
|
try {
|
||||||
emit(AuthForgetPassLoading());
|
emit(AuthForgetPassLoading());
|
||||||
await AuthenticationAPI.forgetPassword(email: email, password: password);
|
|
||||||
|
await AuthenticationAPI.forgetPassword(
|
||||||
|
email: email, password: password, otpCode: otpCode);
|
||||||
emit(AuthForgetPassSuccess());
|
emit(AuthForgetPassSuccess());
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
emit(AuthForgetPassError(message: 'Something went wrong'));
|
emit(AuthForgetPassError(message: 'Something went wrong'));
|
||||||
|
@ -15,13 +15,15 @@ import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
|||||||
import 'package:syncrow_app/utils/resource_manager/styles_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/styles_manager.dart';
|
||||||
|
|
||||||
class checkEmailPage extends StatelessWidget {
|
class checkEmailPage extends StatelessWidget {
|
||||||
const checkEmailPage({super.key});
|
bool? forget;
|
||||||
|
checkEmailPage({super.key, this.forget});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final formKey = AuthCubit.get(context).checkEmailFormKey;
|
final formKey = AuthCubit.get(context).checkEmailFormKey;
|
||||||
|
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
statusBarBrightness: Brightness.light, statusBarIconBrightness: Brightness.light));
|
statusBarBrightness: Brightness.light,
|
||||||
|
statusBarIconBrightness: Brightness.light));
|
||||||
return BlocConsumer<AuthCubit, AuthState>(
|
return BlocConsumer<AuthCubit, AuthState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is AuthError) {
|
if (state is AuthError) {
|
||||||
@ -34,8 +36,8 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const OtpView(
|
builder: (context) => OtpView(
|
||||||
isForgetPage: true,
|
isForgetPage: forget!,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -91,7 +93,9 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.sizeOf(context).height / 5.5,
|
height:
|
||||||
|
MediaQuery.sizeOf(context).height /
|
||||||
|
5.5,
|
||||||
),
|
),
|
||||||
TitleMedium(
|
TitleMedium(
|
||||||
text: 'Forgot password?',
|
text: 'Forgot password?',
|
||||||
@ -113,32 +117,39 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
scrollPadding: EdgeInsets.zero,
|
scrollPadding: EdgeInsets.zero,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
autofillHints: const [AutofillHints.email],
|
autofillHints: const [
|
||||||
validator: AuthCubit.get(context).emailAddressValidator,
|
AutofillHints.email
|
||||||
|
],
|
||||||
|
validator: AuthCubit.get(context)
|
||||||
|
.emailAddressValidator,
|
||||||
onTapOutside: (event) {
|
onTapOutside: (event) {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
AuthCubit.get(context).email = value;
|
AuthCubit.get(context).email = value;
|
||||||
},
|
},
|
||||||
decoration: defaultInputDecoration(context,
|
decoration: defaultInputDecoration(
|
||||||
|
context,
|
||||||
hint: "Example@email.com"),
|
hint: "Example@email.com"),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
isDone: state is AuthLoginSuccess,
|
isDone: state is AuthLoginSuccess,
|
||||||
isLoading: state is AuthLoading,
|
isLoading: state is AuthLoading,
|
||||||
customButtonStyle: ButtonStyle(
|
customButtonStyle: ButtonStyle(
|
||||||
backgroundColor: MaterialStateProperty.all(
|
backgroundColor:
|
||||||
|
MaterialStateProperty.all(
|
||||||
Colors.black.withOpacity(.25),
|
Colors.black.withOpacity(.25),
|
||||||
),
|
),
|
||||||
foregroundColor: MaterialStateProperty.all(
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(
|
||||||
Colors.white,
|
Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -146,11 +157,16 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
'Send Code',
|
'Send Code',
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
AuthCubit.get(context).showValidationMessage = true;
|
AuthCubit.get(context)
|
||||||
if (formKey.currentState!.validate()) {
|
.showValidationMessage = true;
|
||||||
|
if (formKey.currentState!
|
||||||
|
.validate()) {
|
||||||
if ((state is! AuthLoading)) {
|
if ((state is! AuthLoading)) {
|
||||||
AuthCubit.get(context).sendOtp();
|
AuthCubit.get(context)
|
||||||
FocusScope.of(context).unfocus();
|
.sendOtp(
|
||||||
|
isforget: forget);
|
||||||
|
FocusScope.of(context)
|
||||||
|
.unfocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -160,14 +176,17 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: MediaQuery.sizeOf(context).height / 5.5),
|
top: MediaQuery.sizeOf(context)
|
||||||
|
.height /
|
||||||
|
5.5),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
BodyLarge(
|
BodyLarge(
|
||||||
text: "Do you have an account? ",
|
text: "Do you have an account? ",
|
||||||
style:
|
style: context.displaySmall
|
||||||
context.displaySmall.copyWith(color: Colors.white),
|
.copyWith(color: Colors.white),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -175,7 +194,8 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: BodyLarge(
|
child: BodyLarge(
|
||||||
text: "Sign in",
|
text: "Sign in",
|
||||||
style: context.displaySmall.copyWith(
|
style:
|
||||||
|
context.displaySmall.copyWith(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontsManager.bold,
|
fontWeight: FontsManager.bold,
|
||||||
),
|
),
|
||||||
|
@ -12,6 +12,7 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|||||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/styles_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/styles_manager.dart';
|
||||||
|
|
||||||
|
|
||||||
class CreateNewPasswordPage extends StatelessWidget {
|
class CreateNewPasswordPage extends StatelessWidget {
|
||||||
const CreateNewPasswordPage({super.key,});
|
const CreateNewPasswordPage({super.key,});
|
||||||
|
|
||||||
|
@ -374,15 +374,20 @@ class _OtpViewState extends State<OtpView> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((state is! AuthLoading)) {
|
if ((state is! AuthLoading)) {
|
||||||
bool success = await AuthCubit.get(context)
|
bool success =
|
||||||
.reSendOtp();
|
await AuthCubit.get(context)
|
||||||
|
.reSendOtp(
|
||||||
|
forget:
|
||||||
|
widget.isForgetPage);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
if (success) {
|
if (success) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => SuccessDialog(
|
builder: (_) => SuccessDialog(
|
||||||
key: ValueKey('SuccessDialog'),
|
key: ValueKey(
|
||||||
message: 'New OTP sent!',));
|
'SuccessDialog'),
|
||||||
|
message: 'New OTP sent!',
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Future.delayed(Duration(seconds: 2),
|
Future.delayed(Duration(seconds: 2),
|
||||||
() {
|
() {
|
||||||
|
@ -10,12 +10,17 @@ class ForgetPassword extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
bool isforget = true;
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const checkEmailPage(),));
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => checkEmailPage(forget: isforget),
|
||||||
|
));
|
||||||
},
|
},
|
||||||
child: BodyMedium(
|
child: BodyMedium(
|
||||||
text: "Forgot Password?",
|
text: "Forgot Password?",
|
||||||
|
@ -83,7 +83,8 @@ class _RoomPageState extends State<RoomPage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const Expanded(
|
: widget.room.devices!.isNotEmpty
|
||||||
|
? const Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -98,7 +99,8 @@ class _RoomPageState extends State<RoomPage> {
|
|||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
|
: const SizedBox(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||||
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||||
import 'package:syncrow_app/features/scene/view/scene_tasks_view.dart';
|
|
||||||
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/icons_dialog.dart';
|
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/icons_dialog.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/widgets/delete_routine_b.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/effective_period_setting/effective_period_bottom_sheet.dart';
|
import 'package:syncrow_app/features/scene/widgets/effective_period_setting/effective_period_bottom_sheet.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
@ -18,10 +18,12 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final sceneSettings = ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>? ?? {};
|
final sceneSettings =
|
||||||
|
ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>? ??
|
||||||
|
{};
|
||||||
final sceneId = sceneSettings['sceneId'] as String? ?? '';
|
final sceneId = sceneSettings['sceneId'] as String? ?? '';
|
||||||
final isAutomation =
|
final isAutomation = context.read<CreateSceneBloc>().sceneType ==
|
||||||
context.read<CreateSceneBloc>().sceneType == CreateSceneEnum.deviceStatusChanges;
|
CreateSceneEnum.deviceStatusChanges;
|
||||||
final sceneName = sceneSettings['sceneName'] as String? ?? '';
|
final sceneName = sceneSettings['sceneName'] as String? ?? '';
|
||||||
bool showInDevice = context.read<CreateSceneBloc>().showInDeviceScreen;
|
bool showInDevice = context.read<CreateSceneBloc>().showInDeviceScreen;
|
||||||
String selectedIcon = '';
|
String selectedIcon = '';
|
||||||
@ -35,7 +37,8 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.arrow_back_ios,
|
Icons.arrow_back_ios,
|
||||||
)),
|
)),
|
||||||
child: BlocBuilder<CreateSceneBloc, CreateSceneState>(builder: (context, state) {
|
child: BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
||||||
|
builder: (context, state) {
|
||||||
if (state is AddSceneTask) {
|
if (state is AddSceneTask) {
|
||||||
showInDevice = state.showInDevice ?? false;
|
showInDevice = state.showInDevice ?? false;
|
||||||
}
|
}
|
||||||
@ -47,7 +50,8 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
if (!isAutomation)
|
if (!isAutomation)
|
||||||
DefaultContainer(
|
DefaultContainer(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(top: 10, left: 10, right: 10, bottom: 10),
|
padding: const EdgeInsets.only(
|
||||||
|
top: 10, left: 10, right: 10, bottom: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
@ -55,20 +59,24 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
BlocProvider.of<CreateSceneBloc>(context).add(SceneIconEvent());
|
BlocProvider.of<CreateSceneBloc>(context)
|
||||||
|
.add(SceneIconEvent());
|
||||||
return IconsDialog(
|
return IconsDialog(
|
||||||
widgetList: Container(
|
widgetList: Container(
|
||||||
height: MediaQuery.sizeOf(context).height * 0.4,
|
height:
|
||||||
|
MediaQuery.sizeOf(context).height * 0.4,
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
child: BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
child: BlocBuilder<CreateSceneBloc,
|
||||||
|
CreateSceneState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is CreateSceneLoading) {
|
if (state is CreateSceneLoading) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 50,
|
height: 50,
|
||||||
width: 50,
|
width: 50,
|
||||||
child: CircularProgressIndicator()),
|
child:
|
||||||
|
CircularProgressIndicator()),
|
||||||
);
|
);
|
||||||
} else if (state is AddSceneTask) {
|
} else if (state is AddSceneTask) {
|
||||||
return GridView.builder(
|
return GridView.builder(
|
||||||
@ -78,25 +86,35 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
crossAxisSpacing: 12,
|
crossAxisSpacing: 12,
|
||||||
mainAxisSpacing: 12,
|
mainAxisSpacing: 12,
|
||||||
),
|
),
|
||||||
itemCount: state.iconModels?.length ?? 0,
|
itemCount:
|
||||||
|
state.iconModels?.length ?? 0,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final iconModel = state.iconModels![index];
|
final iconModel =
|
||||||
|
state.iconModels![index];
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
BlocProvider.of<CreateSceneBloc>(context).add(
|
BlocProvider.of<
|
||||||
IconSelected(
|
CreateSceneBloc>(
|
||||||
iconId: iconModel.uuid,
|
context)
|
||||||
confirmSelection: false));
|
.add(IconSelected(
|
||||||
|
iconId:
|
||||||
|
iconModel.uuid,
|
||||||
|
confirmSelection:
|
||||||
|
false));
|
||||||
selectedIcon = iconModel.uuid;
|
selectedIcon = iconModel.uuid;
|
||||||
},
|
},
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(1),
|
padding:
|
||||||
|
const EdgeInsets.all(1),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: state.selectedIcon == iconModel.uuid
|
color: state.selectedIcon ==
|
||||||
? ColorsManager.primaryColorWithOpacity
|
iconModel.uuid
|
||||||
: Colors.transparent,
|
? ColorsManager
|
||||||
|
.primaryColorWithOpacity
|
||||||
|
: Colors
|
||||||
|
.transparent,
|
||||||
width: 2,
|
width: 2,
|
||||||
),
|
),
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
@ -123,8 +141,10 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
confirmTab: () {
|
confirmTab: () {
|
||||||
BlocProvider.of<CreateSceneBloc>(context).add(
|
BlocProvider.of<CreateSceneBloc>(context)
|
||||||
IconSelected(iconId: selectedIcon, confirmSelection: true));
|
.add(IconSelected(
|
||||||
|
iconId: selectedIcon,
|
||||||
|
confirmSelection: true));
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
title: 'Icons',
|
title: 'Icons',
|
||||||
@ -171,7 +191,8 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
value: showInDevice,
|
value: showInDevice,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
BlocProvider.of<CreateSceneBloc>(context)
|
BlocProvider.of<CreateSceneBloc>(context)
|
||||||
.add(ShowOnDeviceClicked(value: value));
|
.add(ShowOnDeviceClicked(
|
||||||
|
value: value));
|
||||||
},
|
},
|
||||||
applyTheme: true,
|
applyTheme: true,
|
||||||
),
|
),
|
||||||
@ -219,7 +240,8 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
visible: isAutomation,
|
visible: isAutomation,
|
||||||
child: SceneListTile(
|
child: SceneListTile(
|
||||||
titleString: "Effective Period",
|
titleString: "Effective Period",
|
||||||
trailingWidget: const Icon(Icons.arrow_forward_ios_rounded),
|
trailingWidget:
|
||||||
|
const Icon(Icons.arrow_forward_ios_rounded),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.customBottomSheet(
|
context.customBottomSheet(
|
||||||
child: const EffectPeriodBottomSheetContent(),
|
child: const EffectPeriodBottomSheetContent(),
|
||||||
@ -236,19 +258,29 @@ class SceneAutoSettings extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
child: Center(
|
||||||
|
child: Visibility(
|
||||||
visible: sceneName.isNotEmpty,
|
visible: sceneName.isNotEmpty,
|
||||||
child: DeleteBottomSheetContent(
|
child: DeleteRoutineButton(
|
||||||
isAutomation: isAutomation,
|
isAutomation: isAutomation,
|
||||||
sceneId: sceneId,
|
sceneId: sceneId,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 16,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -7,10 +7,10 @@ import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart';
|
|||||||
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
|
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
|
||||||
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||||
import 'package:syncrow_app/features/scene/model/scene_settings_route_arguments.dart';
|
import 'package:syncrow_app/features/scene/model/scene_settings_route_arguments.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/delete_routine_dialog.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/create_scene_save_button.dart';
|
import 'package:syncrow_app/features/scene/widgets/create_scene_save_button.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/if_then_containers/if_container.dart';
|
import 'package:syncrow_app/features/scene/widgets/if_then_containers/if_container.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/if_then_containers/then_container.dart';
|
import 'package:syncrow_app/features/scene/widgets/if_then_containers/then_container.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/navigation/navigate_to_route.dart';
|
import 'package:syncrow_app/navigation/navigate_to_route.dart';
|
||||||
@ -117,49 +117,3 @@ class SceneTasksView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeleteBottomSheetContent extends StatelessWidget {
|
|
||||||
const DeleteBottomSheetContent(
|
|
||||||
{super.key, required this.sceneId, required this.isAutomation});
|
|
||||||
|
|
||||||
final String sceneId;
|
|
||||||
final bool isAutomation;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BlocConsumer<CreateSceneBloc, CreateSceneState>(
|
|
||||||
listener: (context, state) {
|
|
||||||
if (state is DeleteSceneSuccess) {
|
|
||||||
if (state.success) {
|
|
||||||
navigateToRoute(context, Routes.homeRoute);
|
|
||||||
BlocProvider.of<SceneBloc>(context)
|
|
||||||
.add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!));
|
|
||||||
BlocProvider.of<SceneBloc>(context).add(
|
|
||||||
LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
builder: (context, state) {
|
|
||||||
return SceneListTile(
|
|
||||||
onPressed: () {
|
|
||||||
context.read<CreateSceneBloc>().add(DeleteSceneEvent(
|
|
||||||
sceneId: sceneId,
|
|
||||||
unitUuid: HomeCubit.getInstance().selectedSpace!.id!,
|
|
||||||
));
|
|
||||||
},
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
titleString: isAutomation
|
|
||||||
? StringsManager.deleteAutomation
|
|
||||||
: StringsManager.deleteScene,
|
|
||||||
leadingWidget: (state is DeleteSceneLoading)
|
|
||||||
? const SizedBox(
|
|
||||||
height: 24, width: 24, child: CircularProgressIndicator())
|
|
||||||
: SvgPicture.asset(
|
|
||||||
Assets.assetsDeleteIcon,
|
|
||||||
color: ColorsManager.red,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -0,0 +1,114 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
|
class DeleteRoutineDialog extends StatelessWidget {
|
||||||
|
final Function()? cancelTab;
|
||||||
|
final Function()? confirmTab;
|
||||||
|
|
||||||
|
const DeleteRoutineDialog({
|
||||||
|
super.key,
|
||||||
|
required this.cancelTab,
|
||||||
|
required this.confirmTab,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
const BodyLarge(
|
||||||
|
text: 'Delete Routine',
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontColor: ColorsManager.red,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(left: 15, right: 15),
|
||||||
|
child: Divider(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 20),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Center(child: const Text('Are you sure you want to ')),
|
||||||
|
Center(child: const Text('delete the routine?'))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
right: BorderSide(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
top: BorderSide(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
child: SizedBox(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: cancelTab,
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(15),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Cancel',
|
||||||
|
style: TextStyle(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
left: BorderSide(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
top: BorderSide(
|
||||||
|
color: ColorsManager.textGray,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: confirmTab,
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(15),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Confirm',
|
||||||
|
style: TextStyle(
|
||||||
|
color: ColorsManager.red,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
81
lib/features/scene/widgets/delete_routine_b.dart
Normal file
81
lib/features/scene/widgets/delete_routine_b.dart
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/delete_routine_dialog.dart';
|
||||||
|
import 'package:syncrow_app/navigation/navigate_to_route.dart';
|
||||||
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
|
class DeleteRoutineButton extends StatelessWidget {
|
||||||
|
const DeleteRoutineButton(
|
||||||
|
{super.key, required this.sceneId, required this.isAutomation});
|
||||||
|
|
||||||
|
final String sceneId;
|
||||||
|
final bool isAutomation;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BlocConsumer<CreateSceneBloc, CreateSceneState>(
|
||||||
|
listener: (context, state) {
|
||||||
|
if (state is DeleteSceneSuccess) {
|
||||||
|
if (state.success) {
|
||||||
|
navigateToRoute(context, Routes.homeRoute);
|
||||||
|
BlocProvider.of<SceneBloc>(context)
|
||||||
|
.add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!));
|
||||||
|
BlocProvider.of<SceneBloc>(context).add(
|
||||||
|
LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return DeleteRoutineDialog(
|
||||||
|
cancelTab: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
confirmTab: () {
|
||||||
|
context.read<CreateSceneBloc>().add(DeleteSceneEvent(
|
||||||
|
sceneId: sceneId,
|
||||||
|
unitUuid:
|
||||||
|
HomeCubit.getInstance().selectedSpace!.id!,
|
||||||
|
));
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: const Center(
|
||||||
|
child: Text(
|
||||||
|
'Remove Routine',
|
||||||
|
style: TextStyle(color: ColorsManager.red),
|
||||||
|
))
|
||||||
|
// : SceneListTile(
|
||||||
|
// onPressed: () {
|
||||||
|
|
||||||
|
// },
|
||||||
|
// padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
// titleString: isAutomation
|
||||||
|
// ? StringsManager.deleteAutomation
|
||||||
|
// : StringsManager.deleteScene,
|
||||||
|
// leadingWidget: (state is DeleteSceneLoading)
|
||||||
|
// ? const SizedBox(
|
||||||
|
// height: 24,
|
||||||
|
// width: 24,
|
||||||
|
// child: CircularProgressIndicator())
|
||||||
|
// : SvgPicture.asset(
|
||||||
|
// Assets.assetsDeleteIcon,
|
||||||
|
// color: ColorsManager.red,
|
||||||
|
// ),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,8 @@ import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
|||||||
import 'package:syncrow_app/services/api/http_service.dart';
|
import 'package:syncrow_app/services/api/http_service.dart';
|
||||||
|
|
||||||
class AuthenticationAPI {
|
class AuthenticationAPI {
|
||||||
static Future<Map<String, dynamic>> verifyPassCode({required Map<String, dynamic> body}) async {
|
static Future<Map<String, dynamic>> verifyPassCode(
|
||||||
|
{required Map<String, dynamic> body}) async {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.verifyOtp,
|
path: ApiEndpoints.verifyOtp,
|
||||||
body: body,
|
body: body,
|
||||||
@ -14,7 +15,8 @@ class AuthenticationAPI {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Token> loginWithEmail({required LoginWithEmailModel model}) async {
|
static Future<Token> loginWithEmail(
|
||||||
|
{required LoginWithEmailModel model}) async {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.login,
|
path: ApiEndpoints.login,
|
||||||
body: model.toJson(),
|
body: model.toJson(),
|
||||||
@ -32,7 +34,8 @@ class AuthenticationAPI {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> sendOtp({required Map<String, dynamic> body}) async {
|
static Future<Map<String, dynamic>> sendOtp(
|
||||||
|
{required Map<String, dynamic> body}) async {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.sendOtp,
|
path: ApiEndpoints.sendOtp,
|
||||||
body: body,
|
body: body,
|
||||||
@ -41,8 +44,16 @@ class AuthenticationAPI {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> forgetPassword({required String email,required String password ,}) async {
|
static Future<Map<String, dynamic>> forgetPassword({
|
||||||
Map<String, dynamic> params = {"email": email, "password": password,};
|
required String otpCode,
|
||||||
|
required String email,
|
||||||
|
required String password,
|
||||||
|
}) async {
|
||||||
|
Map<String, dynamic> params = {
|
||||||
|
"email": email,
|
||||||
|
"password": password,
|
||||||
|
"otpCode": otpCode
|
||||||
|
};
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.forgetPassword,
|
path: ApiEndpoints.forgetPassword,
|
||||||
body: params,
|
body: params,
|
||||||
|
@ -39,6 +39,6 @@ class StringsManager {
|
|||||||
'Example: when an unusual activity is detected.';
|
'Example: when an unusual activity is detected.';
|
||||||
static const String functions = "Functions";
|
static const String functions = "Functions";
|
||||||
static const String firstLaunch = "firstLaunch";
|
static const String firstLaunch = "firstLaunch";
|
||||||
static const String deleteScene = 'Delete Scene';
|
static const String deleteScene = 'Remove Routine';
|
||||||
static const String deleteAutomation = 'Delete Automation';
|
static const String deleteAutomation = 'Delete Automation';
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ description: This is the mobile application project, developed with Flutter for
|
|||||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
# 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
|
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 1.0.5+34
|
version: 1.0.5+35
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.6 <4.0.0"
|
sdk: ">=3.0.6 <4.0.0"
|
||||||
|
Reference in New Issue
Block a user