fix : auth middleware
This commit is contained in:
@@ -1,37 +1,13 @@
|
|||||||
/*
|
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:rasadyar_auth/auth.dart';
|
||||||
import 'package:hive_ce_flutter/hive_flutter.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:logger/logger.dart';
|
|
||||||
import 'package:rasadyar_app/data/data_provider/local_storage/hive/hive_provider.dart';
|
|
||||||
import 'package:rasadyar_app/data/data_source/local_storage/user/user_local_storage.dart';
|
|
||||||
import 'package:rasadyar_app/data/model/user/user_model.dart';
|
|
||||||
import 'package:rasadyar_app/domain/repository/user/user_repository.dart';
|
|
||||||
|
|
||||||
final di = GetIt.instance;
|
final di = GetIt.instance;
|
||||||
|
|
||||||
void setupInjection() {
|
Future<void> setupInjection() async{
|
||||||
di.registerLazySingleton(() => HiveProvider(), instanceName: 'HiveProvider');
|
await setupAuthDI();
|
||||||
di.registerSingleton<Logger>( Logger());
|
await setupAllProvider();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setupAllProvider() async {
|
|
||||||
await _setupLocalStorage();
|
|
||||||
await di.allReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _setupLocalStorage() async {
|
|
||||||
final hiveProvider = di.get<HiveProvider>(instanceName: 'HiveProvider');
|
|
||||||
await hiveProvider.init();
|
|
||||||
Hive.registerAdapter(UserModelAdapter());
|
|
||||||
|
|
||||||
await Hive.openBox<UserModel>(HiveBoxNames.user.name);
|
|
||||||
|
|
||||||
//user
|
|
||||||
di.registerLazySingleton<IUserLocalStorage>(() => UserLocalStorage());
|
|
||||||
di.registerLazySingleton<IUserRepository>(
|
|
||||||
() => UserRepository(di.get<IUserLocalStorage>()),
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
void main() async {
|
import 'infrastructure/di/di.dart';
|
||||||
|
|
||||||
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
await setupInjection();
|
||||||
|
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
// runApp(DevicePreview(builder: (context) => ForDevicePreview(),));
|
// runApp(DevicePreview(builder: (context) => ForDevicePreview(),));
|
||||||
@@ -41,12 +44,9 @@ class MyApp extends StatelessWidget {
|
|||||||
colorScheme: ColorScheme.fromSeed(seedColor: AppColor.blueNormal),
|
colorScheme: ColorScheme.fromSeed(seedColor: AppColor.blueNormal),
|
||||||
),
|
),
|
||||||
initialRoute: AppPages.initRoutes,
|
initialRoute: AppPages.initRoutes,
|
||||||
// initialBinding: BindingsBuilder.put(() => UserService()),
|
|
||||||
getPages: AppPages.pages,
|
getPages: AppPages.pages,
|
||||||
locale: const Locale("fa", "IR"),
|
locale: const Locale("fa", "IR"),
|
||||||
supportedLocales: const [
|
supportedLocales: const [Locale("fa", "IR")],
|
||||||
Locale("fa", "IR"),
|
|
||||||
],
|
|
||||||
localizationsDelegates: [
|
localizationsDelegates: [
|
||||||
PersianMaterialLocalizations.delegate,
|
PersianMaterialLocalizations.delegate,
|
||||||
PersianCupertinoLocalizations.delegate,
|
PersianCupertinoLocalizations.delegate,
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
enum AuthType { useAndPass, otp }
|
|
||||||
|
|
||||||
enum AuthStatus { init }
|
|
||||||
|
|
||||||
enum OtpStatus { init, sent, verified, reSend }
|
|
||||||
|
|
||||||
class AuthWithUseAndPassLogic extends GetxController {
|
|
||||||
Rx<GlobalKey<FormState>> formKey = GlobalKey<FormState>().obs;
|
|
||||||
Rx<GlobalKey<FormState>> formKeyOtp = GlobalKey<FormState>().obs;
|
|
||||||
Rx<GlobalKey<FormState>> formKeySentOtp = GlobalKey<FormState>().obs;
|
|
||||||
Rx<TextEditingController> phoneNumberController = TextEditingController().obs;
|
|
||||||
Rx<TextEditingController> passwordController = TextEditingController().obs;
|
|
||||||
Rx<TextEditingController> phoneOtpNumberController =
|
|
||||||
TextEditingController().obs;
|
|
||||||
Rx<TextEditingController> otpCodeController = TextEditingController().obs;
|
|
||||||
CaptchaController captchaController = CaptchaController();
|
|
||||||
CaptchaController captchaOtpController = CaptchaController();
|
|
||||||
|
|
||||||
RxnString phoneNumber = RxnString(null);
|
|
||||||
RxnString password = RxnString(null);
|
|
||||||
RxBool isOnError = false.obs;
|
|
||||||
RxBool hidePassword = true.obs;
|
|
||||||
Rx<AuthType> authType = AuthType.useAndPass.obs;
|
|
||||||
Rx<AuthStatus> authStatus = AuthStatus.init.obs;
|
|
||||||
Rx<OtpStatus> otpStatus = OtpStatus.init.obs;
|
|
||||||
|
|
||||||
RxInt secondsRemaining = 120.obs;
|
|
||||||
Timer? _timer;
|
|
||||||
|
|
||||||
void startTimer() {
|
|
||||||
_timer?.cancel();
|
|
||||||
secondsRemaining.value = 120;
|
|
||||||
|
|
||||||
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
|
||||||
if (secondsRemaining.value > 0) {
|
|
||||||
secondsRemaining.value--;
|
|
||||||
} else {
|
|
||||||
timer.cancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void stopTimer() {
|
|
||||||
_timer?.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
String get timeFormatted {
|
|
||||||
final minutes = secondsRemaining.value ~/ 60;
|
|
||||||
final seconds = secondsRemaining.value % 60;
|
|
||||||
return '${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
_timer?.cancel();
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,522 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/gestures.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class AuthWithUseAndPassPage extends GetView<AuthWithUseAndPassLogic> {
|
|
||||||
const AuthWithUseAndPassPage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
body: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 80),
|
|
||||||
logoWidget(),
|
|
||||||
ObxValue((types) {
|
|
||||||
switch (types.value) {
|
|
||||||
case AuthType.otp:
|
|
||||||
return otpForm();
|
|
||||||
case AuthType.useAndPass:
|
|
||||||
return useAndPassFrom();
|
|
||||||
}
|
|
||||||
}, controller.authType),
|
|
||||||
|
|
||||||
SizedBox(height: 50),
|
|
||||||
RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: 'مطالعه بیانیه ',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.darkGreyDark,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
recognizer: TapGestureRecognizer()..onTap = () {},
|
|
||||||
text: 'حریم خصوصی',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 18),
|
|
||||||
|
|
||||||
ObxValue((types) {
|
|
||||||
return RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
recognizer:
|
|
||||||
TapGestureRecognizer()
|
|
||||||
..onTap = () {
|
|
||||||
if (controller.authType.value == AuthType.otp) {
|
|
||||||
controller.authType.value = AuthType.useAndPass;
|
|
||||||
if (controller.otpStatus.value !=
|
|
||||||
OtpStatus.init) {
|
|
||||||
controller.otpStatus.value = OtpStatus.init;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
controller.authType.value = AuthType.otp;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
text:
|
|
||||||
controller.authType.value == AuthType.otp
|
|
||||||
? 'ورود با رمز ثابت'
|
|
||||||
: 'ورود با رمز یکبار مصرف',
|
|
||||||
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.authType),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget useAndPassFrom() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 30, vertical: 50),
|
|
||||||
child: Form(
|
|
||||||
key: data.value,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
ObxValue((phoneController) {
|
|
||||||
return TextFormField(
|
|
||||||
controller: controller.phoneNumberController.value,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
gapPadding: 11,
|
|
||||||
),
|
|
||||||
labelText: 'شماره موبایل',
|
|
||||||
labelStyle: AppFonts.yekan13,
|
|
||||||
errorStyle: AppFonts.yekan13.copyWith(
|
|
||||||
color: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
|
|
||||||
prefixIconConstraints: BoxConstraints(
|
|
||||||
maxHeight: 40,
|
|
||||||
minHeight: 40,
|
|
||||||
maxWidth: 40,
|
|
||||||
minWidth: 40,
|
|
||||||
),
|
|
||||||
prefixIcon: Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 6, 8),
|
|
||||||
child: vecWidget(Assets.vecCallSvg),
|
|
||||||
),
|
|
||||||
suffix:
|
|
||||||
phoneController.value.text.trim().isNotEmpty
|
|
||||||
? clearButton(() {
|
|
||||||
phoneController.value.clear();
|
|
||||||
phoneController.refresh();
|
|
||||||
})
|
|
||||||
: null,
|
|
||||||
counterText: '',
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
|
||||||
decimal: false,
|
|
||||||
signed: false,
|
|
||||||
),
|
|
||||||
|
|
||||||
maxLines: 1,
|
|
||||||
maxLength: 11,
|
|
||||||
onChanged: (value) {
|
|
||||||
if (controller.isOnError.value) {
|
|
||||||
controller.isOnError.value = !controller.isOnError.value;
|
|
||||||
data.value.currentState?.reset();
|
|
||||||
|
|
||||||
data.refresh();
|
|
||||||
phoneController.value.text = value;
|
|
||||||
}
|
|
||||||
phoneController.refresh();
|
|
||||||
},
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null) {
|
|
||||||
return '⚠️ شماره موبایل را وارد کنید';
|
|
||||||
} else if (value.length < 11) {
|
|
||||||
return '⚠️ شماره موبایل باید 11 رقم باشد';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
style: AppFonts.yekan13,
|
|
||||||
);
|
|
||||||
}, controller.phoneNumberController),
|
|
||||||
|
|
||||||
SizedBox(height: 26),
|
|
||||||
|
|
||||||
ObxValue((passwordController) {
|
|
||||||
return TextFormField(
|
|
||||||
controller: passwordController.value,
|
|
||||||
obscureText: controller.hidePassword.value,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
gapPadding: 11,
|
|
||||||
),
|
|
||||||
labelText: 'رمز عبور',
|
|
||||||
labelStyle: AppFonts.yekan13,
|
|
||||||
errorStyle: AppFonts.yekan13.copyWith(
|
|
||||||
color: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
|
|
||||||
prefixIconConstraints: BoxConstraints(
|
|
||||||
maxHeight: 34,
|
|
||||||
minHeight: 34,
|
|
||||||
maxWidth: 34,
|
|
||||||
minWidth: 34,
|
|
||||||
),
|
|
||||||
prefixIcon: Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 8, 8),
|
|
||||||
child: vecWidget(Assets.vecKeySvg),
|
|
||||||
),
|
|
||||||
suffix:
|
|
||||||
passwordController.value.text.trim().isNotEmpty
|
|
||||||
? GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
controller.hidePassword.value =
|
|
||||||
!controller.hidePassword.value;
|
|
||||||
},
|
|
||||||
child: Icon(
|
|
||||||
controller.hidePassword.value
|
|
||||||
? CupertinoIcons.eye
|
|
||||||
: CupertinoIcons.eye_slash,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
counterText: '',
|
|
||||||
),
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
keyboardType: TextInputType.visiblePassword,
|
|
||||||
maxLines: 1,
|
|
||||||
onChanged: (value) {
|
|
||||||
if (controller.isOnError.value) {
|
|
||||||
controller.isOnError.value = !controller.isOnError.value;
|
|
||||||
data.value.currentState?.reset();
|
|
||||||
passwordController.value.text = value;
|
|
||||||
}
|
|
||||||
passwordController.refresh();
|
|
||||||
},
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return '⚠️ رمز عبور را وارد کنید'; // "Please enter the password"
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
style: AppFonts.yekan13,
|
|
||||||
);
|
|
||||||
}, controller.passwordController),
|
|
||||||
SizedBox(height: 26),
|
|
||||||
|
|
||||||
CaptchaWidget(controller: controller.captchaController),
|
|
||||||
|
|
||||||
SizedBox(height: 23),
|
|
||||||
RElevated(
|
|
||||||
text: 'ورود',
|
|
||||||
onPressed: () async {
|
|
||||||
Jalali? picked = await showPersianDatePicker(
|
|
||||||
context: Get.context!,
|
|
||||||
|
|
||||||
initialDate: Jalali.now(),
|
|
||||||
firstDate: Jalali(1385, 8),
|
|
||||||
lastDate: Jalali(1450, 9),
|
|
||||||
initialEntryMode: PersianDatePickerEntryMode.calendarOnly,
|
|
||||||
initialDatePickerMode: PersianDatePickerMode.year,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data.value.currentState?.validate() == true &&
|
|
||||||
controller.captchaController.validate()) {}
|
|
||||||
},
|
|
||||||
width: Get.width,
|
|
||||||
height: 48,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.formKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget otpForm() {
|
|
||||||
return ObxValue((status) {
|
|
||||||
switch (status.value) {
|
|
||||||
case OtpStatus.init:
|
|
||||||
return sendCodeForm();
|
|
||||||
case OtpStatus.sent:
|
|
||||||
case OtpStatus.verified:
|
|
||||||
case OtpStatus.reSend:
|
|
||||||
return confirmCodeForm();
|
|
||||||
}
|
|
||||||
}, controller.otpStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget sendCodeForm() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return Form(
|
|
||||||
key: data.value,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 30, vertical: 50),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 26),
|
|
||||||
ObxValue((phoneController) {
|
|
||||||
return TextFormField(
|
|
||||||
controller: phoneController.value,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
gapPadding: 11,
|
|
||||||
),
|
|
||||||
labelText: 'شماره موبایل',
|
|
||||||
labelStyle: AppFonts.yekan13,
|
|
||||||
errorStyle: AppFonts.yekan13.copyWith(
|
|
||||||
color: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
prefixIconConstraints: BoxConstraints(
|
|
||||||
maxHeight: 40,
|
|
||||||
minHeight: 40,
|
|
||||||
maxWidth: 40,
|
|
||||||
minWidth: 40,
|
|
||||||
),
|
|
||||||
prefixIcon: Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 6, 8),
|
|
||||||
child: vecWidget(Assets.vecCallSvg),
|
|
||||||
),
|
|
||||||
suffix:
|
|
||||||
phoneController.value.text.trim().isNotEmpty
|
|
||||||
? clearButton(() {
|
|
||||||
phoneController.value.clear();
|
|
||||||
phoneController.refresh();
|
|
||||||
})
|
|
||||||
: null,
|
|
||||||
counterText: '',
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
|
||||||
decimal: false,
|
|
||||||
signed: false,
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
maxLength: 11,
|
|
||||||
onChanged: (value) {
|
|
||||||
if (controller.isOnError.value) {
|
|
||||||
controller.isOnError.value = !controller.isOnError.value;
|
|
||||||
data.value.currentState?.reset();
|
|
||||||
data.refresh();
|
|
||||||
phoneController.value.text = value;
|
|
||||||
}
|
|
||||||
phoneController.refresh();
|
|
||||||
},
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null) {
|
|
||||||
return '⚠️ شماره موبایل را وارد کنید';
|
|
||||||
} else if (value.length < 11) {
|
|
||||||
return '⚠️ شماره موبایل باید 11 رقم باشد';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
style: AppFonts.yekan13,
|
|
||||||
);
|
|
||||||
}, controller.phoneOtpNumberController),
|
|
||||||
|
|
||||||
SizedBox(height: 26),
|
|
||||||
|
|
||||||
CaptchaWidget(controller: controller.captchaOtpController),
|
|
||||||
|
|
||||||
SizedBox(height: 23),
|
|
||||||
RElevated(
|
|
||||||
text: 'ارسال رمز یکبار مصرف',
|
|
||||||
onPressed: () {
|
|
||||||
if (data.value.currentState?.validate() == true &&
|
|
||||||
controller.captchaOtpController.validate()) {
|
|
||||||
controller.otpStatus.value = OtpStatus.sent;
|
|
||||||
controller.startTimer();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
width: Get.width,
|
|
||||||
height: 48,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.formKeyOtp);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget confirmCodeForm() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
return Form(
|
|
||||||
key: data.value,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 30, vertical: 50),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 26),
|
|
||||||
|
|
||||||
ObxValue((passwordController) {
|
|
||||||
return TextFormField(
|
|
||||||
controller: passwordController.value,
|
|
||||||
obscureText: controller.hidePassword.value,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
gapPadding: 11,
|
|
||||||
),
|
|
||||||
labelText: 'رمز عبور',
|
|
||||||
labelStyle: AppFonts.yekan13,
|
|
||||||
errorStyle: AppFonts.yekan13.copyWith(
|
|
||||||
color: AppColor.redNormal,
|
|
||||||
),
|
|
||||||
|
|
||||||
prefixIconConstraints: BoxConstraints(
|
|
||||||
maxHeight: 34,
|
|
||||||
minHeight: 34,
|
|
||||||
maxWidth: 34,
|
|
||||||
minWidth: 34,
|
|
||||||
),
|
|
||||||
prefixIcon: Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(0, 8, 8, 8),
|
|
||||||
child: vecWidget(Assets.vecKeySvg),
|
|
||||||
),
|
|
||||||
suffix:
|
|
||||||
passwordController.value.text.trim().isNotEmpty
|
|
||||||
? GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
controller.hidePassword.value =
|
|
||||||
!controller.hidePassword.value;
|
|
||||||
},
|
|
||||||
child: Icon(
|
|
||||||
controller.hidePassword.value
|
|
||||||
? CupertinoIcons.eye
|
|
||||||
: CupertinoIcons.eye_slash,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
counterText: '',
|
|
||||||
),
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
keyboardType: TextInputType.visiblePassword,
|
|
||||||
maxLines: 1,
|
|
||||||
onChanged: (value) {
|
|
||||||
if (controller.isOnError.value) {
|
|
||||||
controller.isOnError.value = !controller.isOnError.value;
|
|
||||||
data.value.currentState?.reset();
|
|
||||||
passwordController.value.text = value;
|
|
||||||
}
|
|
||||||
passwordController.refresh();
|
|
||||||
},
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return '⚠️ رمز عبور را وارد کنید'; // "Please enter the password"
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
style: AppFonts.yekan13,
|
|
||||||
);
|
|
||||||
}, controller.passwordController),
|
|
||||||
|
|
||||||
SizedBox(height: 23),
|
|
||||||
|
|
||||||
ObxValue((timer) {
|
|
||||||
if (timer.value == 0) {
|
|
||||||
return TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
controller.otpStatus.value = OtpStatus.reSend;
|
|
||||||
controller.startTimer();
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
style: AppFonts.yekan13.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
'ارسال مجدد کد یکبار مصرف',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Text(
|
|
||||||
'اعتبار رمز ارسال شده ${controller.timeFormatted}',
|
|
||||||
style: AppFonts.yekan13,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, controller.secondsRemaining),
|
|
||||||
|
|
||||||
RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: ' کد ارسال شده به شماره ',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.darkGreyDark,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: controller.phoneOtpNumberController.value.text,
|
|
||||||
style: AppFonts.yekan13Bold.copyWith(
|
|
||||||
color: AppColor.darkGreyDark,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
recognizer:
|
|
||||||
TapGestureRecognizer()
|
|
||||||
..onTap = () {
|
|
||||||
controller.otpStatus.value = OtpStatus.init;
|
|
||||||
controller.captchaOtpController.clear();
|
|
||||||
},
|
|
||||||
text: ' ویرایش',
|
|
||||||
style: AppFonts.yekan14.copyWith(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 23),
|
|
||||||
RElevated(
|
|
||||||
text: 'ورود',
|
|
||||||
onPressed: () {
|
|
||||||
if (controller.formKeyOtp.value.currentState?.validate() ==
|
|
||||||
true &&
|
|
||||||
controller.captchaOtpController.validate()) {}
|
|
||||||
},
|
|
||||||
width: Get.width,
|
|
||||||
height: 48,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.formKeySentOtp);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget logoWidget() {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Row(),
|
|
||||||
Image.asset(Assets.imagesInnerSplash, width: 120, height: 120),
|
|
||||||
Text(
|
|
||||||
'سامانه رصدیار',
|
|
||||||
style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyNormal),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget clearButton(VoidCallback onTap) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: onTap,
|
|
||||||
child: Icon(CupertinoIcons.multiply_circle, size: 24),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/animation.dart';
|
import 'package:flutter/animation.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
import 'package:rasadyar_inspection/inspection.dart';
|
||||||
import '';
|
|
||||||
|
|
||||||
class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||||
late final AnimationController scaleController;
|
late final AnimationController scaleController;
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import 'package:rasadyar_app/presentation/pages/auth/auth_with_use_and_pass/logic.dart';
|
|
||||||
import 'package:rasadyar_app/presentation/pages/auth/auth_with_use_and_pass/view.dart';
|
|
||||||
import 'package:rasadyar_app/presentation/pages/splash/logic.dart';
|
import 'package:rasadyar_app/presentation/pages/splash/logic.dart';
|
||||||
import 'package:rasadyar_app/presentation/pages/splash/view.dart';
|
import 'package:rasadyar_app/presentation/pages/splash/view.dart';
|
||||||
import 'package:rasadyar_app/presentation/pages/system_design/system_design.dart';
|
import 'package:rasadyar_app/presentation/pages/system_design/system_design.dart';
|
||||||
|
import 'package:rasadyar_auth/presentation/routes/pages.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
import 'package:rasadyar_inspection/inspection.dart';
|
||||||
|
|
||||||
part 'app_paths.dart';
|
part 'app_paths.dart';
|
||||||
|
|
||||||
@@ -21,12 +20,9 @@ sealed class AppPages {
|
|||||||
page: () => SplashPage(),
|
page: () => SplashPage(),
|
||||||
binding: BindingsBuilder.put(() => SplashLogic()),
|
binding: BindingsBuilder.put(() => SplashLogic()),
|
||||||
),
|
),
|
||||||
GetPage(
|
|
||||||
name: AppPaths.authWithUserAndPass,
|
|
||||||
page: () => AuthWithUseAndPassPage(),
|
|
||||||
binding: BindingsBuilder.put(() => AuthWithUseAndPassLogic()),
|
|
||||||
),
|
|
||||||
|
|
||||||
...InspectionPages.pages,
|
...InspectionPages.pages,
|
||||||
|
...AuthPages.pages,
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,5 @@ sealed class AppPaths {
|
|||||||
AppPaths._();
|
AppPaths._();
|
||||||
|
|
||||||
static const String splash = '/splash';
|
static const String splash = '/splash';
|
||||||
static const String authWithUserAndPass = '/authWithUserAndPass';
|
|
||||||
static const String authWithOtp = '/authWithOtp';
|
|
||||||
static const String systemDesignPage = '/systemDesignPage';
|
static const String systemDesignPage = '/systemDesignPage';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,3 +3,6 @@
|
|||||||
/// More dartdocs go here.
|
/// More dartdocs go here.
|
||||||
library;
|
library;
|
||||||
|
|
||||||
|
export 'data/services/auth_middelware.dart';
|
||||||
|
export 'data/services/auth_service.dart';
|
||||||
|
export 'data/di/auth_di.dart';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:auths/data/repositories/auth_repository_imp.dart';
|
import 'package:rasadyar_auth/data/repositories/auth_repository_imp.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import '../di/auth_di.dart';
|
import '../di/auth_di.dart';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:auths/data/common/constant.dart';
|
import 'package:rasadyar_auth/data/common/constant.dart';
|
||||||
import 'package:auths/data/repositories/auth_repository_imp.dart';
|
import 'package:rasadyar_auth/data/repositories/auth_repository_imp.dart';
|
||||||
import 'package:auths/data/services/auth_service.dart';
|
import 'package:rasadyar_auth/data/services/auth_service.dart';
|
||||||
|
import 'package:rasadyar_auth/data/services/token_storage_service.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import '../common/dio_manager.dart';
|
import '../common/dio_manager.dart';
|
||||||
@@ -17,7 +18,8 @@ Future<void> setupAuthDI() async {
|
|||||||
() => AuthRepositoryImpl(dioRemote),
|
() => AuthRepositoryImpl(dioRemote),
|
||||||
);
|
);
|
||||||
diAuth.registerLazySingleton(() => AuthService());
|
diAuth.registerLazySingleton(() => AuthService());
|
||||||
|
diAuth.registerLazySingleton(() => TokenStorageService());
|
||||||
|
|
||||||
//hive
|
//hive
|
||||||
//await diAuth.registerCachedFactoryAsync(() async=>await ,)
|
//await diAuth.registerCachedFactoryAsync(() async=>await ,)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_auth/data/di/auth_di.dart';
|
||||||
|
import 'package:rasadyar_auth/data/services/token_storage_service.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import '../../presentation/routes/pages.dart';
|
import '../../presentation/routes/pages.dart';
|
||||||
|
|
||||||
class AuthMiddleware extends GetMiddleware{
|
class AuthMiddleware extends GetMiddleware {
|
||||||
|
var tokenService = diAuth.get<TokenStorageService>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RouteSettings? redirect(String? route) {
|
RouteSettings? redirect(String? route) {
|
||||||
if(route == AuthPaths.auth) {
|
eLog('redirect');
|
||||||
return const RouteSettings(name: AuthPaths.moduleList);
|
final refreshToken = tokenService.getRefreshToken();
|
||||||
|
final accessToken = tokenService.getAccessToken();
|
||||||
|
|
||||||
|
if (refreshToken == null || accessToken == null) {
|
||||||
|
return RouteSettings(name: AuthPaths.moduleList);
|
||||||
}
|
}
|
||||||
return super.redirect(route);
|
return super.redirect(route);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,11 +43,10 @@ class TokenStorageService extends GetxService {
|
|||||||
value: token,
|
value: token,
|
||||||
);
|
);
|
||||||
|
|
||||||
Future<String?> getAccessToken() async =>
|
String? getAccessToken() =>
|
||||||
await _localStorage.read(boxName: _boxName, key: _accessTokenKey);
|
_localStorage.read<String?>(boxName: _boxName, key: _accessTokenKey);
|
||||||
|
String? getRefreshToken() =>
|
||||||
Future<String?> getRefreshToken() async =>
|
_localStorage.read<String?>(boxName: _boxName, key: _refreshTokenKey);
|
||||||
await _localStorage.read(boxName: _boxName, key: _refreshTokenKey);
|
|
||||||
|
|
||||||
Future<void> deleteTokens() async => await _localStorage.clear(_boxName);
|
Future<void> deleteTokens() async => await _localStorage.clear(_boxName);
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
// Do not modify
|
// Do not modify
|
||||||
// Check in to version control
|
// Check in to version control
|
||||||
|
|
||||||
import 'package:hive_ce/hive.dart';
|
import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart';
|
||||||
import 'package:auths/data/models/local/user_local/user_local_model.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
extension HiveRegistrar on HiveInterface {
|
extension HiveRegistrar on HiveInterface {
|
||||||
void registerAdapters() {
|
void registerAdapters() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: auths
|
name: rasadyar_auth
|
||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
version: 0.0.1
|
version: 0.0.1
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export 'package:geolocator/geolocator.dart';
|
|||||||
export 'package:get/get.dart';
|
export 'package:get/get.dart';
|
||||||
//di
|
//di
|
||||||
export 'package:get_it/get_it.dart';
|
export 'package:get_it/get_it.dart';
|
||||||
|
export 'injection/di.dart';
|
||||||
|
|
||||||
//local storage
|
//local storage
|
||||||
export 'package:hive_ce_flutter/hive_flutter.dart';
|
export 'package:hive_ce_flutter/hive_flutter.dart';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:hive_ce_flutter/hive_flutter.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import 'i_local_storage.dart';
|
import 'i_local_storage.dart';
|
||||||
|
|
||||||
@@ -33,36 +33,42 @@ class HiveLocalStorage implements ILocalStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<T?> read<T>({required String boxName,required String key}) async {
|
T? read<T>({required String boxName, required String key}) {
|
||||||
Box? box = await getBox(boxName);
|
try {
|
||||||
return box.get(key) as T?;
|
Box? box = getBox(boxName);
|
||||||
}
|
return box?.get(key) as T?;
|
||||||
|
} on Exception catch (e) {
|
||||||
|
eLog(e);
|
||||||
|
return null;
|
||||||
@override
|
|
||||||
Future<void> add({required String boxName,required dynamic value}) async {
|
|
||||||
Box<dynamic>? box = await getBox(boxName);
|
|
||||||
await box.add(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> addAll({required String boxName,required Iterable values}) async {
|
|
||||||
Box<dynamic>? box = await getBox(boxName);
|
|
||||||
await box.addAll(values);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Box<T>> getBox<T>(String boxName) async {
|
|
||||||
final box = _boxes[boxName];
|
|
||||||
if (box is Box<T>) {
|
|
||||||
return box;
|
|
||||||
} else {
|
|
||||||
throw Exception('Box $boxName is not of expected type $T');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> clear(String boxName) async{
|
Future<void> add({required String boxName, required dynamic value}) async {
|
||||||
|
Box<dynamic>? box = getBox(boxName);
|
||||||
|
await box?.add(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> addAll({
|
||||||
|
required String boxName,
|
||||||
|
required Iterable values,
|
||||||
|
}) async {
|
||||||
|
Box<dynamic>? box = getBox(boxName);
|
||||||
|
await box?.addAll(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
Box<T>? getBox<T>(String boxName) {
|
||||||
|
final box = _boxes[boxName];
|
||||||
|
if (box is Box<T>) {
|
||||||
|
return box;
|
||||||
|
} else {
|
||||||
|
throw Exception('Box $boxName is not of exist');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> clear(String boxName) async {
|
||||||
await _boxes[boxName]?.clear();
|
await _boxes[boxName]?.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +80,8 @@ class HiveLocalStorage implements ILocalStorage {
|
|||||||
required String boxName,
|
required String boxName,
|
||||||
required String key,
|
required String key,
|
||||||
}) async {
|
}) async {
|
||||||
Box<dynamic>? box = await getBox(boxName);
|
Box<dynamic>? box = getBox(boxName);
|
||||||
await box.delete(key);
|
await box?.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -83,15 +89,15 @@ class HiveLocalStorage implements ILocalStorage {
|
|||||||
required String boxName,
|
required String boxName,
|
||||||
required String key,
|
required String key,
|
||||||
required value,
|
required value,
|
||||||
}) async{
|
}) async {
|
||||||
Box<dynamic>? box = await getBox(boxName);
|
Box<dynamic>? box = getBox(boxName);
|
||||||
await box.put(key, value);
|
await box?.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> saveAll({required String boxName, required Map entries}) async{
|
Future<void> saveAll({required String boxName, required Map entries}) async {
|
||||||
Box<dynamic>? box = await getBox(boxName);
|
Box<dynamic>? box = getBox(boxName);
|
||||||
await box.putAll(entries);
|
await box?.putAll(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -99,8 +105,8 @@ class HiveLocalStorage implements ILocalStorage {
|
|||||||
required String boxName,
|
required String boxName,
|
||||||
required int index,
|
required int index,
|
||||||
required value,
|
required value,
|
||||||
}) async{
|
}) async {
|
||||||
Box<dynamic>? box = await getBox(boxName);
|
Box<dynamic>? box = getBox(boxName);
|
||||||
await box.putAt(index, value);
|
await box?.putAt(index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ abstract class ILocalStorage<E> {
|
|||||||
String? collection,
|
String? collection,
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<T?> read<T>({required String boxName, required String key});
|
T? read<T>({required String boxName, required String key});
|
||||||
|
|
||||||
Future<void> deleteValue({required String boxName, required String key});
|
Future<void> deleteValue({required String boxName, required String key});
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ final diCore = GetIt.instance;
|
|||||||
Future<void> setupAllProvider() async {
|
Future<void> setupAllProvider() async {
|
||||||
await _setUpLogger();
|
await _setUpLogger();
|
||||||
await _setupLocalStorage();
|
await _setupLocalStorage();
|
||||||
|
await _setupRemote();
|
||||||
await diCore.allReady();
|
await diCore.allReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,5 +22,5 @@ Future<void> _setupLocalStorage() async {
|
|||||||
|
|
||||||
|
|
||||||
Future<void> _setupRemote() async {
|
Future<void> _setupRemote() async {
|
||||||
diCore.registerSingleton<HiveLocalStorage>(HiveLocalStorage());
|
// diCore.registerSingleton<HiveLocalStorage>(HiveLocalStorage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||||
|
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
class AddSupervisionLogic extends GetxController {
|
class AddSupervisionLogic extends GetxController {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:inspection/inspection.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:inspection/data/utils/marker_generator.dart';
|
|
||||||
import 'package:inspection/presentation/filter/view.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
import 'package:rasadyar_inspection/data/utils/marker_generator.dart';
|
||||||
|
import 'package:rasadyar_inspection/presentation/filter/view.dart';
|
||||||
|
|
||||||
class InspectorFilterLogic extends GetxController
|
class InspectorFilterLogic extends GetxController
|
||||||
with GetTickerProviderStateMixin {
|
with GetTickerProviderStateMixin {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:inspection/presentation/registration_of_violation/logic.dart';
|
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||||
|
|
||||||
|
import 'logic.dart';
|
||||||
|
|
||||||
class RegistrationOfViolationPage
|
class RegistrationOfViolationPage
|
||||||
extends GetView<RegistrationOfViolationLogic> {
|
extends GetView<RegistrationOfViolationLogic> {
|
||||||
const RegistrationOfViolationPage({super.key});
|
const RegistrationOfViolationPage({super.key});
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:inspection/presentation/action/view.dart';
|
|
||||||
import 'package:inspection/presentation/filter/view.dart';
|
|
||||||
import 'package:inspection/presentation/profile/view.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
import 'package:rasadyar_inspection/presentation/action/view.dart';
|
||||||
|
import 'package:rasadyar_inspection/presentation/filter/view.dart';
|
||||||
|
import 'package:rasadyar_inspection/presentation/profile/view.dart';
|
||||||
|
|
||||||
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
|
import 'package:rasadyar_auth/auth.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:inspection/presentation/action/logic.dart';
|
import 'package:rasadyar_inspection/presentation/action/logic.dart';
|
||||||
import 'package:inspection/presentation/add_mobile_inspector/logic.dart';
|
import 'package:rasadyar_inspection/presentation/add_mobile_inspector/logic.dart';
|
||||||
import 'package:inspection/presentation/add_mobile_inspector/view.dart';
|
import 'package:rasadyar_inspection/presentation/add_mobile_inspector/view.dart';
|
||||||
import 'package:inspection/presentation/add_supervision/logic.dart';
|
import 'package:rasadyar_inspection/presentation/add_supervision/logic.dart';
|
||||||
import 'package:inspection/presentation/add_supervision/view.dart';
|
import 'package:rasadyar_inspection/presentation/add_supervision/view.dart';
|
||||||
import 'package:inspection/presentation/display_information/logic.dart';
|
import 'package:rasadyar_inspection/presentation/display_information/logic.dart';
|
||||||
import 'package:inspection/presentation/display_information/view.dart';
|
import 'package:rasadyar_inspection/presentation/display_information/view.dart';
|
||||||
import 'package:inspection/presentation/filter/logic.dart';
|
import 'package:rasadyar_inspection/presentation/filter/logic.dart';
|
||||||
import 'package:inspection/presentation/location_details/logic.dart';
|
import 'package:rasadyar_inspection/presentation/location_details/logic.dart';
|
||||||
import 'package:inspection/presentation/location_details/view.dart';
|
import 'package:rasadyar_inspection/presentation/location_details/view.dart';
|
||||||
import 'package:inspection/presentation/profile/logic.dart';
|
import 'package:rasadyar_inspection/presentation/profile/logic.dart';
|
||||||
import 'package:inspection/presentation/profile/view.dart';
|
import 'package:rasadyar_inspection/presentation/profile/view.dart';
|
||||||
import 'package:inspection/presentation/registration_of_violation/logic.dart';
|
import 'package:rasadyar_inspection/presentation/registration_of_violation/logic.dart';
|
||||||
import 'package:inspection/presentation/registration_of_violation/view.dart';
|
import 'package:rasadyar_inspection/presentation/registration_of_violation/view.dart';
|
||||||
import 'package:inspection/presentation/root/logic.dart';
|
import 'package:rasadyar_inspection/presentation/root/logic.dart';
|
||||||
import 'package:inspection/presentation/root/view.dart';
|
import 'package:rasadyar_inspection/presentation/root/view.dart';
|
||||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
import 'package:rasadyar_inspection/presentation/routes/app_routes.dart';
|
||||||
|
|
||||||
sealed class InspectionPages {
|
sealed class InspectionPages {
|
||||||
InspectionPages._();
|
InspectionPages._();
|
||||||
@@ -24,6 +25,7 @@ sealed class InspectionPages {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: InspectionRoutes.inspection,
|
name: InspectionRoutes.inspection,
|
||||||
page: () => RootPage(),
|
page: () => RootPage(),
|
||||||
|
middlewares: [AuthMiddleware()],
|
||||||
binding: BindingsBuilder(() {
|
binding: BindingsBuilder(() {
|
||||||
Get.put(RootLogic());
|
Get.put(RootLogic());
|
||||||
Get.put(InspectorFilterLogic());
|
Get.put(InspectorFilterLogic());
|
||||||
|
|||||||
@@ -600,6 +600,13 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.0"
|
||||||
|
rasadyar_auth:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "../auth"
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "0.0.1"
|
||||||
rasadyar_core:
|
rasadyar_core:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: inspection
|
name: rasadyar_inspection
|
||||||
description: "inspection module for rasadyar"
|
description: "inspection module for rasadyar"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
@@ -10,4 +10,6 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
rasadyar_core:
|
rasadyar_core:
|
||||||
path: ../core
|
path: ../core
|
||||||
|
rasadyar_auth:
|
||||||
|
path: ../auth
|
||||||
14
pubspec.lock
14
pubspec.lock
@@ -917,6 +917,13 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.0"
|
version: "1.5.0"
|
||||||
|
rasadyar_auth:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "packages/auth"
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "0.0.1"
|
||||||
rasadyar_core:
|
rasadyar_core:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -924,6 +931,13 @@ packages:
|
|||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "1.0.0+1"
|
version: "1.0.0+1"
|
||||||
|
rasadyar_inspection:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "packages/inspection"
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "1.0.1"
|
||||||
rxdart:
|
rxdart:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -14,9 +14,17 @@ dependencies:
|
|||||||
cupertino_icons: ^1.0.8
|
cupertino_icons: ^1.0.8
|
||||||
|
|
||||||
|
|
||||||
|
#rasadyar packages
|
||||||
rasadyar_core:
|
rasadyar_core:
|
||||||
path: ./packages/core
|
path: ./packages/core
|
||||||
|
|
||||||
|
rasadyar_inspection:
|
||||||
|
path: ./packages/inspection
|
||||||
|
|
||||||
|
rasadyar_auth:
|
||||||
|
path: ./packages/auth
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##code generation
|
##code generation
|
||||||
freezed_annotation: ^3.0.0
|
freezed_annotation: ^3.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user