fix : change app architecture
feat : add some method to local storage
This commit is contained in:
5
packages/auth/lib/auth.dart
Normal file
5
packages/auth/lib/auth.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
/// Support for doing something awesome.
|
||||
///
|
||||
/// More dartdocs go here.
|
||||
library;
|
||||
|
||||
14
packages/auth/lib/data/common/constant.dart
Normal file
14
packages/auth/lib/data/common/constant.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
enum ApiEnvironment {
|
||||
dam(url: 'https://api.dam.rasadyar.net');
|
||||
|
||||
const ApiEnvironment({required this.url});
|
||||
|
||||
final String url;
|
||||
|
||||
String get baseUrl {
|
||||
switch (this) {
|
||||
case ApiEnvironment.dam:
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
42
packages/auth/lib/data/common/dio_manager.dart
Normal file
42
packages/auth/lib/data/common/dio_manager.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:auths/data/repositories/auth_repository_imp.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import '../di/auth_di.dart';
|
||||
import 'constant.dart';
|
||||
|
||||
class DioRemoteManager {
|
||||
DioRemote? _currentClient;
|
||||
ApiEnvironment? _currentEnv;
|
||||
|
||||
DioRemote setEnvironment(ApiEnvironment env) {
|
||||
if (_currentEnv != env) {
|
||||
_currentClient = DioRemote(env.baseUrl);
|
||||
_currentEnv = env;
|
||||
}
|
||||
return _currentClient!;
|
||||
}
|
||||
|
||||
DioRemote get currentClient {
|
||||
if (_currentClient == null) {
|
||||
throw Exception('Call setEnvironment() before accessing DioRemote.');
|
||||
}
|
||||
|
||||
return _currentClient!;
|
||||
}
|
||||
|
||||
ApiEnvironment? get currentEnv => _currentEnv;
|
||||
}
|
||||
|
||||
Future<void> switchAuthEnvironment(ApiEnvironment env) async {
|
||||
final manager = diAuth.get<DioRemoteManager>();
|
||||
|
||||
final dioRemote = manager.setEnvironment(env);
|
||||
|
||||
if (diAuth.isRegistered<AuthRepositoryImpl>()) {
|
||||
await diAuth.unregister<AuthRepositoryImpl>();
|
||||
}
|
||||
|
||||
diAuth.registerLazySingleton<AuthRepositoryImpl>(
|
||||
() => AuthRepositoryImpl(dioRemote),
|
||||
);
|
||||
}
|
||||
23
packages/auth/lib/data/di/auth_di.dart
Normal file
23
packages/auth/lib/data/di/auth_di.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:auths/data/common/constant.dart';
|
||||
import 'package:auths/data/repositories/auth_repository_imp.dart';
|
||||
import 'package:auths/data/services/auth_service.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import '../common/dio_manager.dart';
|
||||
|
||||
GetIt diAuth = GetIt.instance;
|
||||
|
||||
Future<void> setupAuthDI() async {
|
||||
diAuth.registerLazySingleton(() => DioRemoteManager());
|
||||
|
||||
final manager = diAuth.get<DioRemoteManager>();
|
||||
final dioRemote = manager.setEnvironment(ApiEnvironment.dam);
|
||||
|
||||
diAuth.registerLazySingleton<AuthRepositoryImpl>(
|
||||
() => AuthRepositoryImpl(dioRemote),
|
||||
);
|
||||
diAuth.registerLazySingleton(() => AuthService());
|
||||
|
||||
//hive
|
||||
await diAuth.registerCachedFactoryAsync(() async=>await ,)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
part 'user_local_model.g.dart';
|
||||
|
||||
@HiveType(typeId: 0)
|
||||
class UserLocalModel extends HiveObject {
|
||||
@HiveField(0)
|
||||
String? username;
|
||||
@HiveField(1)
|
||||
String? password;
|
||||
@HiveField(2)
|
||||
String? token;
|
||||
@HiveField(3)
|
||||
String? refreshToken;
|
||||
@HiveField(4)
|
||||
String? name;
|
||||
|
||||
UserLocalModel({
|
||||
this.username,
|
||||
this.password,
|
||||
this.token,
|
||||
this.refreshToken,
|
||||
this.name,
|
||||
});
|
||||
|
||||
UserLocalModel copyWith({
|
||||
String? username,
|
||||
String? password,
|
||||
String? token,
|
||||
String? refreshToken,
|
||||
String? name,
|
||||
}) {
|
||||
return UserLocalModel(
|
||||
username: username ?? this.username,
|
||||
password: password ?? this.password,
|
||||
token: token ?? this.token,
|
||||
refreshToken: refreshToken ?? this.refreshToken,
|
||||
name: name ?? this.name,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_local_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class UserLocalModelAdapter extends TypeAdapter<UserLocalModel> {
|
||||
@override
|
||||
final typeId = 0;
|
||||
|
||||
@override
|
||||
UserLocalModel read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return UserLocalModel(
|
||||
username: fields[0] as String?,
|
||||
password: fields[1] as String?,
|
||||
token: fields[2] as String?,
|
||||
refreshToken: fields[3] as String?,
|
||||
name: fields[4] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, UserLocalModel obj) {
|
||||
writer
|
||||
..writeByte(5)
|
||||
..writeByte(0)
|
||||
..write(obj.username)
|
||||
..writeByte(1)
|
||||
..write(obj.password)
|
||||
..writeByte(2)
|
||||
..write(obj.token)
|
||||
..writeByte(3)
|
||||
..write(obj.refreshToken)
|
||||
..writeByte(4)
|
||||
..write(obj.name);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserLocalModelAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
part 'login_request_model.freezed.dart';
|
||||
part 'login_request_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class LoginRequestModel with _$LoginRequestModel {
|
||||
const factory LoginRequestModel({
|
||||
String? username,
|
||||
String? password,
|
||||
String? captchaCode,
|
||||
String? captchaKey,
|
||||
}) = _LoginRequestModel;
|
||||
|
||||
factory LoginRequestModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$LoginRequestModelFromJson(json);
|
||||
|
||||
const LoginRequestModel._();
|
||||
|
||||
String get formattedCaptchaKey => 'rest_captcha_$captchaKey.0';
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'login_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginRequestModel {
|
||||
|
||||
String? get username; String? get password; String? get captchaCode; String? get captchaKey;
|
||||
/// Create a copy of LoginRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LoginRequestModelCopyWith<LoginRequestModel> get copyWith => _$LoginRequestModelCopyWithImpl<LoginRequestModel>(this as LoginRequestModel, _$identity);
|
||||
|
||||
/// Serializes this LoginRequestModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is LoginRequestModel&&(identical(other.username, username) || other.username == username)&&(identical(other.password, password) || other.password == password)&&(identical(other.captchaCode, captchaCode) || other.captchaCode == captchaCode)&&(identical(other.captchaKey, captchaKey) || other.captchaKey == captchaKey));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,username,password,captchaCode,captchaKey);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginRequestModel(username: $username, password: $password, captchaCode: $captchaCode, captchaKey: $captchaKey)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LoginRequestModelCopyWith<$Res> {
|
||||
factory $LoginRequestModelCopyWith(LoginRequestModel value, $Res Function(LoginRequestModel) _then) = _$LoginRequestModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String? username, String? password, String? captchaCode, String? captchaKey
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$LoginRequestModelCopyWithImpl<$Res>
|
||||
implements $LoginRequestModelCopyWith<$Res> {
|
||||
_$LoginRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LoginRequestModel _self;
|
||||
final $Res Function(LoginRequestModel) _then;
|
||||
|
||||
/// Create a copy of LoginRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? username = freezed,Object? password = freezed,Object? captchaCode = freezed,Object? captchaKey = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
|
||||
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String?,captchaCode: freezed == captchaCode ? _self.captchaCode : captchaCode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,captchaKey: freezed == captchaKey ? _self.captchaKey : captchaKey // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _LoginRequestModel extends LoginRequestModel {
|
||||
const _LoginRequestModel({this.username, this.password, this.captchaCode, this.captchaKey}): super._();
|
||||
factory _LoginRequestModel.fromJson(Map<String, dynamic> json) => _$LoginRequestModelFromJson(json);
|
||||
|
||||
@override final String? username;
|
||||
@override final String? password;
|
||||
@override final String? captchaCode;
|
||||
@override final String? captchaKey;
|
||||
|
||||
/// Create a copy of LoginRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LoginRequestModelCopyWith<_LoginRequestModel> get copyWith => __$LoginRequestModelCopyWithImpl<_LoginRequestModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$LoginRequestModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LoginRequestModel&&(identical(other.username, username) || other.username == username)&&(identical(other.password, password) || other.password == password)&&(identical(other.captchaCode, captchaCode) || other.captchaCode == captchaCode)&&(identical(other.captchaKey, captchaKey) || other.captchaKey == captchaKey));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,username,password,captchaCode,captchaKey);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginRequestModel(username: $username, password: $password, captchaCode: $captchaCode, captchaKey: $captchaKey)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LoginRequestModelCopyWith<$Res> implements $LoginRequestModelCopyWith<$Res> {
|
||||
factory _$LoginRequestModelCopyWith(_LoginRequestModel value, $Res Function(_LoginRequestModel) _then) = __$LoginRequestModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String? username, String? password, String? captchaCode, String? captchaKey
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$LoginRequestModelCopyWithImpl<$Res>
|
||||
implements _$LoginRequestModelCopyWith<$Res> {
|
||||
__$LoginRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LoginRequestModel _self;
|
||||
final $Res Function(_LoginRequestModel) _then;
|
||||
|
||||
/// Create a copy of LoginRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? username = freezed,Object? password = freezed,Object? captchaCode = freezed,Object? captchaKey = freezed,}) {
|
||||
return _then(_LoginRequestModel(
|
||||
username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
|
||||
as String?,password: freezed == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
||||
as String?,captchaCode: freezed == captchaCode ? _self.captchaCode : captchaCode // ignore: cast_nullable_to_non_nullable
|
||||
as String?,captchaKey: freezed == captchaKey ? _self.captchaKey : captchaKey // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,23 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'login_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_LoginRequestModel _$LoginRequestModelFromJson(Map<String, dynamic> json) =>
|
||||
_LoginRequestModel(
|
||||
username: json['username'] as String?,
|
||||
password: json['password'] as String?,
|
||||
captchaCode: json['captchaCode'] as String?,
|
||||
captchaKey: json['captchaKey'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LoginRequestModelToJson(_LoginRequestModel instance) =>
|
||||
<String, dynamic>{
|
||||
'username': instance.username,
|
||||
'password': instance.password,
|
||||
'captchaCode': instance.captchaCode,
|
||||
'captchaKey': instance.captchaKey,
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'auth_response_model.freezed.dart';
|
||||
part 'auth_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class AuthResponseModel with _$AuthResponseModel {
|
||||
const factory AuthResponseModel({
|
||||
String? refresh,
|
||||
String? access,
|
||||
@JsonKey(name: 'otp_status') bool? otpStatus,
|
||||
}) = _AuthResponseModel;
|
||||
|
||||
factory AuthResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$AuthResponseModelFromJson(json);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'captcha_response_model.freezed.dart';
|
||||
part 'captcha_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class CaptchaResponseModel with _$CaptchaResponseModel {
|
||||
const factory CaptchaResponseModel({
|
||||
String? captchaKey,
|
||||
String? captchaImage,
|
||||
String? imageType,
|
||||
String? imageDecode,
|
||||
}) = _CaptchaResponseModel;
|
||||
|
||||
factory CaptchaResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$CaptchaResponseModelFromJson(json);
|
||||
}
|
||||
23
packages/auth/lib/data/repositories/auth_repository.dart
Normal file
23
packages/auth/lib/data/repositories/auth_repository.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
import '../models/response/auth/auth_response_model.dart';
|
||||
import '../models/response/captcha/captcha_response_model.dart';
|
||||
|
||||
abstract class AuthRepository {
|
||||
Future<AuthResponseModel?> login({
|
||||
required Map<String, dynamic> authRequest,
|
||||
});
|
||||
|
||||
Future<CaptchaResponseModel?> captcha();
|
||||
|
||||
Future<void> logout();
|
||||
|
||||
Future<bool> hasAuthenticated();
|
||||
|
||||
|
||||
Future<AuthResponseModel?> loginWithRefreshToken({
|
||||
required Map<String, dynamic> authRequest,
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
100
packages/auth/lib/data/repositories/auth_repository_imp.dart
Normal file
100
packages/auth/lib/data/repositories/auth_repository_imp.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import '../models/response/auth/auth_response_model.dart';
|
||||
import '../models/response/captcha/captcha_response_model.dart';
|
||||
import 'auth_repository.dart';
|
||||
|
||||
class AuthRepositoryImpl implements AuthRepository {
|
||||
final DioRemote _httpClient;
|
||||
final String _BASE_URL = 'auth/api/v1/';
|
||||
|
||||
AuthRepositoryImpl(this._httpClient);
|
||||
|
||||
@override
|
||||
Future<AuthResponseModel?> login({
|
||||
required Map<String, dynamic> authRequest,
|
||||
}) async {
|
||||
final response = await safeCall<DioResponse<AuthResponseModel>>(
|
||||
call:
|
||||
() async => await _httpClient.post<AuthResponseModel>(
|
||||
'$_BASE_URL/login/',
|
||||
data: authRequest,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
),
|
||||
onSuccess: (response) {
|
||||
iLog(response);
|
||||
},
|
||||
onError: (error, trace) {
|
||||
throw Exception('Error during sign in: $error');
|
||||
},
|
||||
);
|
||||
|
||||
return response?.data;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CaptchaResponseModel?> captcha() async {
|
||||
final response = await safeCall<DioResponse<CaptchaResponseModel>>(
|
||||
call:
|
||||
() async => await _httpClient.post<CaptchaResponseModel>(
|
||||
'$_BASE_URL/login/',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
),
|
||||
onSuccess: (response) {
|
||||
iLog(response);
|
||||
},
|
||||
onError: (error, trace) {
|
||||
throw Exception('Error during sign in: $error');
|
||||
},
|
||||
);
|
||||
|
||||
return response?.data;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<AuthResponseModel?> loginWithRefreshToken({
|
||||
required Map<String, dynamic> authRequest,
|
||||
}) async {
|
||||
final response = await safeCall<DioResponse<AuthResponseModel>>(
|
||||
call:
|
||||
() async => await _httpClient.post<AuthResponseModel>(
|
||||
'$_BASE_URL/login/',
|
||||
data: authRequest,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
),
|
||||
onSuccess: (response) {
|
||||
iLog(response);
|
||||
},
|
||||
onError: (error, trace) {
|
||||
throw Exception('Error during sign in: $error');
|
||||
},
|
||||
);
|
||||
|
||||
return response?.data;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> logout() {
|
||||
// TODO: implement logout
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> hasAuthenticated() async {
|
||||
final response = await safeCall<DioResponse<bool>>(
|
||||
call:
|
||||
() async => await _httpClient.get<bool>(
|
||||
'$_BASE_URL/login/',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
),
|
||||
onSuccess: (response) {
|
||||
iLog(response);
|
||||
},
|
||||
onError: (error, trace) {
|
||||
throw Exception('Error during sign in: $error');
|
||||
},
|
||||
);
|
||||
|
||||
return response?.data ?? false;
|
||||
}
|
||||
}
|
||||
16
packages/auth/lib/data/services/auth_middelware.dart
Normal file
16
packages/auth/lib/data/services/auth_middelware.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import '../../presentation/routes/pages.dart';
|
||||
|
||||
class AuthMiddleware extends GetMiddleware{
|
||||
@override
|
||||
RouteSettings? redirect(String? route) {
|
||||
if(route == AuthPaths.auth) {
|
||||
return const RouteSettings(name: AuthPaths.moduleList);
|
||||
}
|
||||
return super.redirect(route);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
9
packages/auth/lib/data/services/auth_service.dart
Normal file
9
packages/auth/lib/data/services/auth_service.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class AuthService extends GetxService{
|
||||
|
||||
|
||||
Future<void> initService() async {
|
||||
|
||||
}
|
||||
}
|
||||
59
packages/auth/lib/data/services/token_storage_service.dart
Normal file
59
packages/auth/lib/data/services/token_storage_service.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/injection/di.dart';
|
||||
|
||||
class TokenStorageService extends GetxService {
|
||||
static const String _boxName = 'secureBox';
|
||||
static const String _accessTokenKey = 'accessToken';
|
||||
static const String _refreshTokenKey = 'refreshToken';
|
||||
final FlutterSecureStorage _secureStorage = FlutterSecureStorage();
|
||||
final HiveLocalStorage _localStorage = diCore.get<HiveLocalStorage>();
|
||||
|
||||
Future<void> init() async {
|
||||
final String? encryptedKey = await _secureStorage.read(key: 'hive_enc_key');
|
||||
final encryptionKey =
|
||||
encryptedKey != null
|
||||
? base64Url.decode(encryptedKey)
|
||||
: Hive.generateSecureKey();
|
||||
|
||||
if (encryptedKey == null) {
|
||||
await _secureStorage.write(
|
||||
key: 'hive_enc_key',
|
||||
value: base64UrlEncode(encryptionKey),
|
||||
);
|
||||
}
|
||||
|
||||
await Hive.initFlutter();
|
||||
await Hive.openBox(
|
||||
_boxName,
|
||||
encryptionCipher: HiveAesCipher(encryptionKey),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> saveAccessToken(String token) async {
|
||||
final box = Hive.box(_boxName);
|
||||
await box.put(_accessTokenKey, token);
|
||||
}
|
||||
|
||||
Future<void> saveRefreshToken(String token) async {
|
||||
final box = Hive.box(_boxName);
|
||||
await box.put(_refreshTokenKey, token);
|
||||
}
|
||||
|
||||
Future<String?> getAccessToken() async {
|
||||
final box = Hive.box(_boxName);
|
||||
return box.get(_accessTokenKey);
|
||||
}
|
||||
|
||||
Future<String?> getRefreshToken() async {
|
||||
final box = Hive.box(_boxName);
|
||||
return box.get(_refreshTokenKey);
|
||||
}
|
||||
|
||||
Future<void> deleteTokens() async {
|
||||
final box = Hive.box(_boxName);
|
||||
await box.delete(_accessTokenKey);
|
||||
await box.delete(_refreshTokenKey);
|
||||
}
|
||||
}
|
||||
69
packages/auth/lib/presentation/pages/auth/logic.dart
Normal file
69
packages/auth/lib/presentation/pages/auth/logic.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
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 AuthLogic 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();
|
||||
}
|
||||
}
|
||||
524
packages/auth/lib/presentation/pages/auth/view.dart
Normal file
524
packages/auth/lib/presentation/pages/auth/view.dart
Normal file
@@ -0,0 +1,524 @@
|
||||
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 AuthPage extends GetView<AuthLogic> {
|
||||
const AuthPage({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),
|
||||
);
|
||||
}
|
||||
}
|
||||
16
packages/auth/lib/presentation/pages/modules/logic.dart
Normal file
16
packages/auth/lib/presentation/pages/modules/logic.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class ModulesLogic extends GetxController {
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
15
packages/auth/lib/presentation/pages/modules/view.dart
Normal file
15
packages/auth/lib/presentation/pages/modules/view.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class ModulesPage extends GetView<ModulesLogic> {
|
||||
const ModulesPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ModulesLogic logic = Get.put(ModulesLogic());
|
||||
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
29
packages/auth/lib/presentation/routes/pages.dart
Normal file
29
packages/auth/lib/presentation/routes/pages.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import '../pages/auth/logic.dart';
|
||||
import '../pages/auth/view.dart';
|
||||
|
||||
part 'paths.dart';
|
||||
|
||||
sealed class AuthPages {
|
||||
AuthPages._();
|
||||
|
||||
static List<GetPage> pages = [
|
||||
GetPage(
|
||||
name: AuthPaths.moduleList,
|
||||
page: () => AuthPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => AuthLogic());
|
||||
}),
|
||||
),
|
||||
|
||||
|
||||
GetPage(
|
||||
name: AuthPaths.auth,
|
||||
page: () => AuthPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.lazyPut(() => AuthLogic());
|
||||
}),
|
||||
),
|
||||
];
|
||||
}
|
||||
8
packages/auth/lib/presentation/routes/paths.dart
Normal file
8
packages/auth/lib/presentation/routes/paths.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
part of 'pages.dart';
|
||||
|
||||
sealed class AuthPaths {
|
||||
AuthPaths._();
|
||||
|
||||
static const String moduleList = '/moduleList';
|
||||
static const String auth = '/Auth';
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hive_ce_flutter/hive_flutter.dart';
|
||||
|
||||
import 'i_local_storage.dart';
|
||||
@@ -13,39 +14,40 @@ class HiveLocalStorage implements ILocalStorage {
|
||||
Future init() async => await Hive.initFlutter();
|
||||
|
||||
@override
|
||||
Future<void> openBox<T>(String boxName) async {
|
||||
Future<void> openBox<T>(
|
||||
String boxName, {
|
||||
HiveCipher? encryptionCipher,
|
||||
bool crashRecovery = true,
|
||||
String? path,
|
||||
Uint8List? bytes,
|
||||
String? collection,
|
||||
}) async {
|
||||
if (!_boxes.containsKey(boxName)) {
|
||||
final box = await Hive.openBox<T>(boxName);
|
||||
final box = await Hive.openBox<T>(
|
||||
boxName,
|
||||
encryptionCipher: encryptionCipher,
|
||||
crashRecovery: crashRecovery,
|
||||
);
|
||||
_boxes[boxName] = box;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> delete(String boxName, String key) async {
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.delete(key);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<T?> read<T>(String boxName, String key) async {
|
||||
Future<T?> read<T>({required String boxName,required String key}) async {
|
||||
Box? box = await getBox(boxName);
|
||||
return box.get(key) as T?;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> save(String boxName, String key, value) async {
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.put(key, value);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Future<void> add(String boxName, value) async {
|
||||
Future<void> add({required String boxName,required dynamic value}) async {
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.add(value);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> addAll(String boxName, Iterable values) async {
|
||||
Future<void> addAll({required String boxName,required Iterable values}) async {
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.addAll(values);
|
||||
}
|
||||
@@ -58,4 +60,47 @@ class HiveLocalStorage implements ILocalStorage {
|
||||
throw Exception('Box $boxName is not of expected type $T');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> clear(String boxName) async{
|
||||
await _boxes[boxName]?.clear();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close(String boxName) async => await _boxes[boxName]?.close();
|
||||
|
||||
@override
|
||||
Future<void> deleteValue({
|
||||
required String boxName,
|
||||
required String key,
|
||||
}) async {
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.delete(key);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> save({
|
||||
required String boxName,
|
||||
required String key,
|
||||
required value,
|
||||
}) async{
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.put(key, value);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> saveAll({required String boxName, required Map entries}) async{
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.putAll(entries);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> saveAt({
|
||||
required String boxName,
|
||||
required int index,
|
||||
required value,
|
||||
}) async{
|
||||
Box<dynamic>? box = await getBox(boxName);
|
||||
await box.putAt(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,44 @@
|
||||
abstract class ILocalStorage<E>{
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hive_ce/hive.dart';
|
||||
|
||||
abstract class ILocalStorage<E> {
|
||||
Future<void> init();
|
||||
Future<void> openBox<T>(String boxName);
|
||||
Future<void> save(String boxName, String key, dynamic value);
|
||||
Future<T?> read<T>(String boxName, String key);
|
||||
Future<void> delete(String boxName, String key);
|
||||
|
||||
Future<void> add(String boxName, E value);
|
||||
Future<void> addAll(String boxName, Iterable<E> values);
|
||||
Future<void> openBox<T>(
|
||||
String boxName, {
|
||||
HiveCipher? encryptionCipher,
|
||||
bool crashRecovery = true,
|
||||
String? path,
|
||||
Uint8List? bytes,
|
||||
String? collection,
|
||||
});
|
||||
|
||||
}
|
||||
Future<T?> read<T>({required String boxName, required String key});
|
||||
|
||||
Future<void> deleteValue({required String boxName, required String key});
|
||||
|
||||
Future<void> add({required String boxName, required E value});
|
||||
|
||||
Future<void> addAll({required String boxName, required Iterable<E> values});
|
||||
|
||||
Future<void> clear(String boxName);
|
||||
|
||||
Future<void> close(String boxName);
|
||||
|
||||
Future<void> save({
|
||||
required String boxName,
|
||||
required String key,
|
||||
required dynamic value,
|
||||
});
|
||||
|
||||
Future<void> saveAt({
|
||||
required String boxName,
|
||||
required int index,
|
||||
required dynamic value,
|
||||
});
|
||||
|
||||
Future<void> saveAll({
|
||||
required String boxName,
|
||||
required Map<dynamic, E> entries,
|
||||
});
|
||||
}
|
||||
|
||||
91
packages/inspection/lib/data/utils/marker_generator.dart
Normal file
91
packages/inspection/lib/data/utils/marker_generator.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
|
||||
/*
|
||||
class GridGenParams {
|
||||
final LatLng center;
|
||||
final int count;
|
||||
final double spacingMeters;
|
||||
|
||||
const GridGenParams({
|
||||
required this.center,
|
||||
required this.count,
|
||||
required this.spacingMeters,
|
||||
});
|
||||
}Future<List<LatLng>> generateGridMarkersIsolate(GridGenParams params) async {
|
||||
return compute(_generateGridMarkersOptimized, params);
|
||||
}
|
||||
|
||||
List<LatLng> _generateGridMarkersOptimized(GridGenParams params) {
|
||||
final List<LatLng> result = [];
|
||||
final Distance distance = const Distance();
|
||||
|
||||
// Pre-calculate the grid dimensions
|
||||
final int gridSize = sqrt(params.count).ceil();
|
||||
final double halfWidth = (gridSize * params.spacingMeters) / 2;
|
||||
final double halfHeight = (gridSize * params.spacingMeters) / 2;
|
||||
|
||||
// Calculate top-left corner of the grid
|
||||
final LatLng topLeft = distance.offset(
|
||||
distance.offset(params.center, -halfHeight, 0), // south
|
||||
-halfWidth, 270 // west
|
||||
);
|
||||
|
||||
// Generate grid in batches for better memory management
|
||||
const int batchSize = 10000;
|
||||
for (int batch = 0; batch < (params.count / batchSize).ceil(); batch++) {
|
||||
final int startIdx = batch * batchSize;
|
||||
final int endIdx = min((batch + 1) * batchSize, params.count);
|
||||
|
||||
for (int i = startIdx; i < endIdx; i++) {
|
||||
final int row = i ~/ gridSize;
|
||||
final int col = i % gridSize;
|
||||
|
||||
final double dx = col * params.spacingMeters;
|
||||
final double dy = row * params.spacingMeters;
|
||||
|
||||
final LatLng point = distance.offset(
|
||||
distance.offset(topLeft, dy, 180), // south
|
||||
dx, 90 // east
|
||||
);
|
||||
|
||||
result.add(point);
|
||||
}
|
||||
}
|
||||
|
||||
return result.sublist(0, min(result.length, params.count));
|
||||
}
|
||||
*/
|
||||
class LatLngSimple {
|
||||
final double lat;
|
||||
final double lng;
|
||||
|
||||
LatLngSimple(this.lat, this.lng);
|
||||
|
||||
Map<String, double> toJson() => {'lat': lat, 'lng': lng};
|
||||
}
|
||||
|
||||
|
||||
List<LatLngSimple> generateLatLngInIsolate(int count) {
|
||||
final Random random = Random();
|
||||
const double minLat = 35.610;
|
||||
const double maxLat = 36.120;
|
||||
const double minLng = 50.190;
|
||||
const double maxLng = 51.100;
|
||||
|
||||
return List.generate(count, (_) {
|
||||
double lat = minLat + random.nextDouble() * (maxLat - minLat);
|
||||
double lng = minLng + random.nextDouble() * (maxLng - minLng);
|
||||
return LatLngSimple(lat, lng);
|
||||
});
|
||||
}
|
||||
|
||||
Future<List<LatLng>> generateLocationsUsingCompute(int count) async {
|
||||
final result = await compute(generateLatLngInIsolate, count);
|
||||
return result.map((e) => LatLng(e.lat, e.lng)).toList();
|
||||
}
|
||||
7
packages/inspection/lib/inspection.dart
Normal file
7
packages/inspection/lib/inspection.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
library;
|
||||
|
||||
export 'presentation/filter/logic.dart';
|
||||
export 'presentation/filter/view.dart';
|
||||
export 'presentation/routes/app_pages.dart';
|
||||
export 'presentation/routes/app_routes.dart';
|
||||
|
||||
80
packages/inspection/lib/presentation/action/logic.dart
Normal file
80
packages/inspection/lib/presentation/action/logic.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/data/utils.dart';
|
||||
|
||||
class ActionLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
late Rx<SlidableController> slidController;
|
||||
bool showSlideHint = true;
|
||||
|
||||
RxInt selectedIndex = 0.obs;
|
||||
RxInt previousIndex = 0.obs;
|
||||
|
||||
List<String> headersTitle = [
|
||||
'کاربران',
|
||||
'سوابق بازرسی من',
|
||||
'آمار',
|
||||
'خروج از سامانه',
|
||||
];
|
||||
|
||||
List<String> headersIcons = [
|
||||
Assets.vecProfileUserSvg,
|
||||
Assets.vecCalendarSearchSvg,
|
||||
Assets.vecDiagramSvg,
|
||||
Assets.vecLogoutSvg,
|
||||
];
|
||||
|
||||
RxList<bool> supervisionHistoryList = [false, false, false, false].obs;
|
||||
|
||||
List<String> tmpLs = ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'];
|
||||
|
||||
List<String> hamadanCities = [
|
||||
'همدان',
|
||||
'ملایر',
|
||||
'نهاوند',
|
||||
'تویسرکان',
|
||||
'اسدآباد',
|
||||
'بهار',
|
||||
'رزن',
|
||||
'کبودرآهنگ',
|
||||
'فامنین',
|
||||
'لالجین',
|
||||
];
|
||||
|
||||
RxInt filter1Index = 0.obs;
|
||||
RxInt filter2Index = 0.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
slidController = SlidableController(this).obs;
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
Future<void> triggerSlidableAnimation() async {
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.openEndActionPane();
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.close();
|
||||
showSlideHint = !showSlideHint;
|
||||
}
|
||||
|
||||
|
||||
void updateSelectedIndex(int index) {
|
||||
if(index == selectedIndex.value) {
|
||||
return;
|
||||
}
|
||||
previousIndex.value = selectedIndex.value;
|
||||
selectedIndex.value = index;
|
||||
}
|
||||
}
|
||||
723
packages/inspection/lib/presentation/action/view.dart
Normal file
723
packages/inspection/lib/presentation/action/view.dart
Normal file
@@ -0,0 +1,723 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/buttons/elevated.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class ActionPage extends GetView<ActionLogic> {
|
||||
const ActionPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
ObxValue((data) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: List.generate(4, (index) {
|
||||
return headerWidget(
|
||||
icon: controller.headersIcons[index],
|
||||
title: controller.headersTitle[index],
|
||||
onTap: () {
|
||||
controller.updateSelectedIndex(index);
|
||||
},
|
||||
isSelected: controller.selectedIndex.value == index,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}, controller.selectedIndex),
|
||||
Expanded(
|
||||
child: ObxValue((index) {
|
||||
if (index.value == 3) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(
|
||||
'از سامانه خارج می شوید؟',
|
||||
style: AppFonts.yekan18.copyWith(
|
||||
color: AppColor.lightGreyDarkActive,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: RElevated(
|
||||
text: 'بله',
|
||||
onPressed: () {
|
||||
exit(0);
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ROutlinedElevated(
|
||||
text: 'خیر',
|
||||
onPressed: () {
|
||||
controller.updateSelectedIndex(
|
||||
controller.previousIndex.value,
|
||||
);
|
||||
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return switch (index.value) {
|
||||
0 => profileWidget(),
|
||||
1 => supervisionHistoryWidget(),
|
||||
2 => statisticsWidget(),
|
||||
|
||||
int() => Container(),
|
||||
};
|
||||
}, controller.selectedIndex),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container statisticsWidget() => Container(
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
padding: EdgeInsets.symmetric(vertical: 50),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(30),
|
||||
topRight: Radius.circular(30),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 32,
|
||||
margin: EdgeInsets.symmetric(horizontal: 22,vertical: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ROutlinedElevatedIcon(
|
||||
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||
onPressed: () {},
|
||||
text: 'از تاریخ',
|
||||
textStyle: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ROutlinedElevatedIcon(
|
||||
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||
onPressed: () {},
|
||||
text: 'تا تاریخ',
|
||||
textStyle: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
optionWidget(
|
||||
selected: controller.filter1Index,
|
||||
title: 'فیلترتراکنش ها',
|
||||
options: controller.tmpLs,
|
||||
),
|
||||
optionWidget(
|
||||
selected: controller.filter2Index,
|
||||
title: 'فیلتر شهرستان',
|
||||
options: controller.hamadanCities,
|
||||
),
|
||||
|
||||
SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecPdfDownloadSvg,
|
||||
onTap: () {},
|
||||
width: 64,
|
||||
height: 64,
|
||||
),
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecExcelDownloadSvg,
|
||||
onTap: () {},
|
||||
width: 64,
|
||||
height: 64,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 20,
|
||||
children: [
|
||||
headerInfo(title: 'تعداد تراکنش ها', description: '183 '),
|
||||
headerInfo(
|
||||
title: 'جمع تراکنش ها',
|
||||
description: '183 ریال',
|
||||
background: AppColor.green1Light,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Widget supervisionHistoryWidget() {
|
||||
return ObxValue((data) {
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return historyItem(data[index], () {
|
||||
data[index] = !data[index];
|
||||
});
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemCount: data.length,
|
||||
);
|
||||
}, controller.supervisionHistoryList);
|
||||
}
|
||||
|
||||
Column profileWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
slidableWidgetOne(),
|
||||
slidableWidgetOne(),
|
||||
slidableWidgetOne(),
|
||||
slidableWidgetOne(),
|
||||
slidableWidgetOne(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget headerWidget({
|
||||
required String icon,
|
||||
required String title,
|
||||
required VoidCallback onTap,
|
||||
bool isSelected = false,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: ShapeDecoration(
|
||||
color: isSelected ? AppColor.blueLightActive : AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: vecWidget(
|
||||
icon,
|
||||
width: 40,
|
||||
height: 40,
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color:
|
||||
isSelected ? AppColor.blueNormalActive : AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget slidableWidgetOne() {
|
||||
if (controller.showSlideHint) {
|
||||
controller.triggerSlidableAnimation();
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
||||
child: Slidable(
|
||||
key: Key('selectedLocationWidget'),
|
||||
controller: controller.slidController.value,
|
||||
endActionPane: ActionPane(
|
||||
motion: StretchMotion(),
|
||||
children: [
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {},
|
||||
backgroundColor: AppColor.redNormal,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
autoClose: true,
|
||||
child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
height: 62,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'داود خرم مهری پور',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'03295224154',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'افزودن کاربر',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'ثبت بازرسی',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'همدان',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'همدان',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget slidableWidgetTwo({required VoidCallback onTap}) {
|
||||
return Slidable(
|
||||
key: Key('selectedLocationWidget'),
|
||||
controller: controller.slidController.value,
|
||||
endActionPane: ActionPane(
|
||||
motion: StretchMotion(),
|
||||
children: [
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {},
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(8),
|
||||
bottomRight: Radius.circular(8),
|
||||
),
|
||||
autoClose: true,
|
||||
child: vecWidget(Assets.vecEditSvg, width: 24, height: 24),
|
||||
),
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {},
|
||||
backgroundColor: AppColor.redNormal,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
bottomLeft: Radius.circular(8),
|
||||
),
|
||||
autoClose: true,
|
||||
child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 62,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'داود خرم مهری پور',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'03295224154',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'افزودن کاربر',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'ثبت بازرسی',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'همدان',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'همدان',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget historyItem(bool isExpanded, VoidCallback onTap) {
|
||||
return AnimatedContainer(
|
||||
margin: EdgeInsets.symmetric(horizontal: 30, vertical: 10),
|
||||
curve: Curves.easeInOut,
|
||||
duration: Duration(seconds: 1),
|
||||
height: isExpanded ? 364 : 62,
|
||||
child:
|
||||
isExpanded
|
||||
? markerDetailsWidget(ontap: onTap)
|
||||
: slidableWidgetTwo(onTap: onTap),
|
||||
);
|
||||
}
|
||||
|
||||
Widget markerDetailsWidget({required VoidCallback ontap}) {
|
||||
return GestureDetector(
|
||||
onTap: ontap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 15,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
spacing: 12,
|
||||
children: [
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecEditSvg,
|
||||
onTap: () {},
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
Text(
|
||||
'سوابق بازرسی من',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecTrashSvg,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: AppColor.redNormal,
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 32,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: AppColor.blueLightHover),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'تاریخ بازرسی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'1403/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'شماره همراه',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0326598653',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'آخرین فعالیت',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'1409/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'موجودی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'5کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
...List.generate(
|
||||
5,
|
||||
(index) => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'فروش رفته',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0 کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Column optionWidget({
|
||||
required RxInt selected,
|
||||
required String title,
|
||||
required List<String> options,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 22,vertical: 10),
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Wrap(
|
||||
runSpacing: 8,
|
||||
spacing: 8,
|
||||
children:
|
||||
options
|
||||
.map(
|
||||
(e) => ObxValue((data) {
|
||||
return ChoiceChip(
|
||||
onSelected: (value) {
|
||||
selected.value = options.indexOf(e);
|
||||
},
|
||||
selectedColor: AppColor.blueNormal,
|
||||
labelStyle:
|
||||
data.value == options.indexOf(e)
|
||||
? AppFonts.yekan13.copyWith(
|
||||
color: AppColor.whiteLight,
|
||||
)
|
||||
: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
checkmarkColor: Colors.white,
|
||||
label: Text(e),
|
||||
selected: options.indexOf(e) == data.value,
|
||||
);
|
||||
}, selected),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Container headerInfo({
|
||||
required String title,
|
||||
required String description,
|
||||
Color? background,
|
||||
}) {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: ShapeDecoration(
|
||||
color: background ?? AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: AppColor.blackLightHover),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
alignment: AlignmentDirectional.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(title, style: AppFonts.yekan10),
|
||||
|
||||
Text(description, style: AppFonts.yekan12),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class AddMobileInspectorLogic extends GetxController {
|
||||
RxInt countInspector = 1.obs;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class AddMobileInspectorPage extends GetView<AddMobileInspectorLogic> {
|
||||
const AddMobileInspectorPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
appBar: RAppBar(
|
||||
title: 'افزودن بازرس همراه',
|
||||
leading: vecWidget(
|
||||
Assets.vecMessageAddSvg,
|
||||
color: Colors.white,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
additionalActions: [
|
||||
RFab.smallAdd(onPressed: () => controller.countInspector.value++),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.fromLTRB(25, 10, 25, 0),
|
||||
itemBuilder: (context, index) => mobileInspectorWidget(),
|
||||
separatorBuilder: (context, index) => SizedBox(height: 15),
|
||||
itemCount: data.value,
|
||||
);
|
||||
}, controller.countInspector),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 4, 20, 25),
|
||||
child: RElevated(
|
||||
text: 'مرحله بعد',
|
||||
onPressed: () {
|
||||
Get.toNamed(InspectionRoutes.inspectionRegistrationOfViolation);
|
||||
},
|
||||
height: 40,
|
||||
isFullWidth: true,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Container mobileInspectorWidget() {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.7, color: AppColor.bgDark),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
RTextField(
|
||||
label: 'نام و نام خانوادگی',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
RTextField(
|
||||
label: 'شماره مجوز',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
RTextField(
|
||||
label: 'شماره ثبت',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
RTextField(
|
||||
label: 'کد اقتصادی',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: RElevated(
|
||||
text: 'ثبت',
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ROutlinedElevated(
|
||||
text: 'انصراف',
|
||||
textStyle: AppFonts.yekan16,
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class AddSupervisionLogic extends GetxController {
|
||||
RxInt selectedSegment = 0.obs;
|
||||
RxInt violationSegmentsSelected = 0.obs;
|
||||
RxInt selectedTypeOfOwnership = 0.obs;
|
||||
RxInt selectedUnitType = 0.obs;
|
||||
RxList<int> selectedAccompanyingInspectors = RxList<int>([0]);
|
||||
|
||||
Map<String,List<String>> tmpData = {
|
||||
'نوع مالکیت': ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'],
|
||||
'نوع واحد': ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'],
|
||||
'بازرسان همراه': ['ندارد','دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'],
|
||||
};
|
||||
|
||||
List<String> tmpLs = ['دولتی', 'غیر دولتی', 'استیجاری', 'شخصی', 'سایر'];
|
||||
|
||||
// The data for the segments
|
||||
final Map<int, Widget> segments = {
|
||||
0: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('دائم', style: AppFonts.yekan13),
|
||||
),
|
||||
1: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('موقت', style: AppFonts.yekan13),
|
||||
),
|
||||
};
|
||||
|
||||
// The data for the segments
|
||||
final Map<int, Widget> violationSegments = {
|
||||
0: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('دارد', style: AppFonts.yekan13),
|
||||
),
|
||||
1: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('ندارد', style: AppFonts.yekan13),
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
List<String> routes = [
|
||||
InspectionRoutes.inspectionRegistrationOfViolation,
|
||||
InspectionRoutes.inspectionDisplayInformation
|
||||
];
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
|
||||
super.onReady();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
243
packages/inspection/lib/presentation/add_supervision/view.dart
Normal file
243
packages/inspection/lib/presentation/add_supervision/view.dart
Normal file
@@ -0,0 +1,243 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:inspection/inspection.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class AddSupervisionPage extends GetView<AddSupervisionLogic> {
|
||||
const AddSupervisionPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.lightGreyLight,
|
||||
appBar: RAppBar(
|
||||
title: 'ایجاد بازرسی',
|
||||
leading: vecWidget(
|
||||
Assets.vecMessageAddSvg,
|
||||
color: Colors.white,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'نوع پروانه کسب',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
ObxValue((data) {
|
||||
return NewCupertinoSegmentedControl<int>(
|
||||
padding: EdgeInsets.zero,
|
||||
children: controller.segments,
|
||||
groupValue: data.value,
|
||||
selectedColor: AppColor.blueNormal,
|
||||
unselectedColor: Colors.white,
|
||||
borderColor: Colors.grey.shade300,
|
||||
onValueChanged: (int value) {
|
||||
data.value = value;
|
||||
},
|
||||
);
|
||||
}, controller.selectedSegment),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'تخلف',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
ObxValue((data) {
|
||||
return NewCupertinoSegmentedControl<int>(
|
||||
padding: EdgeInsets.zero,
|
||||
children: controller.violationSegments,
|
||||
groupValue: data.value,
|
||||
selectedColor: AppColor.blueNormal,
|
||||
unselectedColor: Colors.white,
|
||||
borderColor: Colors.grey.shade300,
|
||||
onValueChanged: (int value) {
|
||||
if(value == 0) {
|
||||
controller.routes.ensureContainsAtStart(InspectionRoutes.inspectionRegistrationOfViolation);
|
||||
} else {
|
||||
controller.routes.remove(InspectionRoutes.inspectionRegistrationOfViolation);
|
||||
}
|
||||
data.value = value;
|
||||
},
|
||||
);
|
||||
}, controller.violationSegmentsSelected),
|
||||
SizedBox(height: 8),
|
||||
RTextField(label: 'صادر کننده پروانه'),
|
||||
SizedBox(height: 8),
|
||||
RTextField(label: 'شماره مجوز'),
|
||||
SizedBox(height: 8),
|
||||
RTextField(label: 'شماره ثبت'),
|
||||
SizedBox(height: 8),
|
||||
RTextField(label: 'کد اقتصادی'),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
optionWidget(
|
||||
selected: controller.selectedTypeOfOwnership,
|
||||
options: controller.tmpData.entries.elementAt(0),
|
||||
onSelected:
|
||||
(index) =>
|
||||
controller.selectedTypeOfOwnership.value = index,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
optionWidget(
|
||||
selected: controller.selectedUnitType,
|
||||
options: controller.tmpData.entries.elementAt(1),
|
||||
onSelected:
|
||||
(index) => controller.selectedUnitType.value = index,
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
optionWidget(
|
||||
selectedList: controller.selectedAccompanyingInspectors,
|
||||
options: controller.tmpData.entries.elementAt(2),
|
||||
onSelected: (data) {
|
||||
final selected = controller.selectedAccompanyingInspectors;
|
||||
final route = InspectionRoutes.inspectionAddMobileInspector;
|
||||
|
||||
if (data == 0) {
|
||||
selected.resetWith(0);
|
||||
controller.routes.remove(route);
|
||||
return;
|
||||
}
|
||||
|
||||
controller.routes.ensureContainsAtStart(route);
|
||||
selected.removeIfPresent(0);
|
||||
selected.toggle(data);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 25),
|
||||
child: RElevated(
|
||||
text: 'مرحله بعد',
|
||||
onPressed: () {
|
||||
Get.toNamed(controller.routes.first);
|
||||
|
||||
},
|
||||
height: 40,
|
||||
isFullWidth: true,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Column optionWidget({
|
||||
RxInt? selected,
|
||||
RxList<int>? selectedList,
|
||||
required MapEntry<String, List<String>> options,
|
||||
required void Function(int index) onSelected,
|
||||
}) {
|
||||
assert(
|
||||
(selected != null) != (selectedList != null),
|
||||
'Exactly one of selected or selectedList must be provided',
|
||||
);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Text(
|
||||
options.key,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 50,
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder:
|
||||
(context, index) =>
|
||||
selected != null
|
||||
? ObxValue((data) {
|
||||
return ChoiceChip(
|
||||
onSelected: (_) => onSelected(index),
|
||||
color: WidgetStateProperty.resolveWith<Color?>((data,) {
|
||||
if (selected.value == index) {
|
||||
return AppColor.blueNormal;
|
||||
} else {
|
||||
return Colors.white;
|
||||
}
|
||||
}),
|
||||
labelStyle:
|
||||
data.value == index
|
||||
? AppFonts.yekan13.copyWith(
|
||||
color: AppColor.whiteLight,
|
||||
)
|
||||
: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
checkmarkColor: Colors.white,
|
||||
label: Text(options.value[index]),
|
||||
selected: index == data.value,
|
||||
);
|
||||
}, selected)
|
||||
: ObxValue((data) {
|
||||
return ChoiceChip(
|
||||
onSelected: (value) => onSelected.call(index),
|
||||
color: WidgetStateProperty.resolveWith<Color?>((states,) {
|
||||
if (data.contains(index)) {
|
||||
return AppColor.blueNormal;
|
||||
} else {
|
||||
return Colors.white;
|
||||
}
|
||||
}),
|
||||
labelStyle:
|
||||
data.contains(index)
|
||||
? AppFonts.yekan13.copyWith(
|
||||
color: AppColor.whiteLight,
|
||||
)
|
||||
: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
checkmarkColor: Colors.white,
|
||||
label: Text(options.value[index]),
|
||||
selected: data.contains(index),
|
||||
);
|
||||
}, selectedList!),
|
||||
|
||||
separatorBuilder: (context, index) => SizedBox(width: 8),
|
||||
itemCount: options.value.length,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class DisplayInformationLogic extends GetxController {}
|
||||
@@ -0,0 +1,421 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class DisplayInformationPage extends GetView<DisplayInformationLogic> {
|
||||
const DisplayInformationPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
appBar: RAppBar(
|
||||
title: 'نمایش اطلاعات',
|
||||
leading: vecWidget(
|
||||
Assets.vecMessageAddSvg,
|
||||
color: AppColor.blueNormal,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
),
|
||||
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
spacing: 20,
|
||||
children: [
|
||||
ratingbarWidget(),
|
||||
markerDetailsWidget(),
|
||||
accompanyingInspectorsWidget(),
|
||||
accompanyingInspectorsWidget(),
|
||||
violationWidget(),
|
||||
violationWidget(),
|
||||
SizedBox(height: 30,)
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 4, 20, 25),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: RElevated(height: 40, text: 'ثبت', onPressed: () {}),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: ROutlinedElevated(
|
||||
height: 40,
|
||||
text: 'انصراف',
|
||||
onPressed: () {
|
||||
Get.until((route) => route.isFirst);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget ratingbarWidget() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(35, 35, 35,0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [Text('به این صنف امتیاز دهید', style: AppFonts.yekan12)],
|
||||
),
|
||||
|
||||
SizedBox(height: 12),
|
||||
RatingBar.builder(
|
||||
initialRating: 3,
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
itemCount: 5,
|
||||
wrapAlignment: WrapAlignment.center,
|
||||
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
|
||||
itemBuilder: (context, _) => Icon(Icons.star, color: Colors.amber),
|
||||
onRatingUpdate: (rating) {},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget violationWidget() {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 35),
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.7, color: AppColor.bgDark),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
RTextField(
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
RTextField(
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget markerDetailsWidget() {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.symmetric(horizontal: 35, vertical: 10),
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 15,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'ایجاد بازرسی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 32,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: AppColor.blueLightHover),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'تاریخ بازرسی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'1403/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'شماره همراه',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0326598653',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'آخرین فعالیت',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'1409/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'موجودی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'5کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
...List.generate(
|
||||
5,
|
||||
(index) => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'فروش رفته',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0 کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget accompanyingInspectorsWidget() {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.symmetric(horizontal: 35),
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 15,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'بازرس همراه',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.bgDark),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'نام و نام خانوادگی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'آیدا گل محمدی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'تاریخ بازرسی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'1403/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'شماره همراه',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0326598653',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'آخرین فعالیت',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'1409/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'موجودی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'5کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
144
packages/inspection/lib/presentation/filter/logic.dart
Normal file
144
packages/inspection/lib/presentation/filter/logic.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
import 'dart:async';
|
||||
|
||||
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';
|
||||
|
||||
class InspectorFilterLogic extends GetxController
|
||||
with GetTickerProviderStateMixin {
|
||||
Rx<LatLng> currentLocation = LatLng(35.824891, 50.948025).obs;
|
||||
RxList<LatLng> allMarkers = <LatLng>[].obs;
|
||||
RxList<LatLng> markers = <LatLng>[].obs;
|
||||
Timer? _debounceTimer;
|
||||
RxBool isLoading = false.obs;
|
||||
|
||||
RxInt filterIndex = 0.obs;
|
||||
RxInt showIndex = 0.obs;
|
||||
bool showSlideHint = true;
|
||||
|
||||
late Rx<SlidableController> slidController;
|
||||
|
||||
Rx<MapController> mapController = MapController().obs;
|
||||
late final AnimatedMapController animatedMapController;
|
||||
|
||||
late DraggableBottomSheetController filterBottomSheetController;
|
||||
late DraggableBottomSheetController selectedLocationBottomSheetController;
|
||||
late DraggableBottomSheetController detailsLocationBottomSheetController;
|
||||
late final BottomSheetManager bottomSheetManager;
|
||||
|
||||
Future<void> determineCurrentPosition() async {
|
||||
final position = await Geolocator.getCurrentPosition(
|
||||
locationSettings: AndroidSettings(accuracy: LocationAccuracy.best),
|
||||
);
|
||||
final latLng = LatLng(position.latitude, position.longitude);
|
||||
|
||||
currentLocation.value = latLng;
|
||||
markers.add(latLng);
|
||||
animatedMapController.animateTo(
|
||||
dest: latLng,
|
||||
zoom: 18,
|
||||
curve: Curves.easeInOut,
|
||||
duration: const Duration(seconds: 1),
|
||||
);
|
||||
}
|
||||
|
||||
void debouncedUpdateVisibleMarkers({required LatLng center}) {
|
||||
_debounceTimer?.cancel();
|
||||
_debounceTimer = Timer(const Duration(milliseconds: 300), () {
|
||||
final filtered = filterNearbyMarkers({
|
||||
'markers': allMarkers,
|
||||
'centerLat': center.latitude,
|
||||
'centerLng': center.longitude,
|
||||
'radius': 2000.0,
|
||||
});
|
||||
|
||||
markers.addAll(filtered);
|
||||
});
|
||||
}
|
||||
|
||||
List<LatLng> filterNearbyMarkers(Map<String, dynamic> args) {
|
||||
final List<LatLng> rawMarkers = args['markers'];
|
||||
final double centerLat = args['centerLat'];
|
||||
final double centerLng = args['centerLng'];
|
||||
final double radiusInMeters = args['radius'];
|
||||
final center = LatLng(centerLat, centerLng);
|
||||
final distance = Distance();
|
||||
|
||||
return rawMarkers
|
||||
.where((marker) => distance(center, marker) <= radiusInMeters)
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<void> generatedMarkers() async {
|
||||
final generatedMarkers = await generateLocationsUsingCompute(100000);
|
||||
allMarkers.value = generatedMarkers;
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
animatedMapController = AnimatedMapController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
curve: Curves.easeInOut,
|
||||
cancelPreviousAnimations: true,
|
||||
);
|
||||
|
||||
filterBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: 350,
|
||||
minHeight: 200,
|
||||
maxHeight: Get.height * 0.5,
|
||||
);
|
||||
|
||||
selectedLocationBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: 200,
|
||||
minHeight: 100,
|
||||
maxHeight: 200,
|
||||
);
|
||||
|
||||
|
||||
detailsLocationBottomSheetController = DraggableBottomSheetController(
|
||||
initialHeight: Get.height * 0.5,
|
||||
minHeight: Get.height * 0.37,
|
||||
maxHeight: Get.height * 0.5,
|
||||
);
|
||||
|
||||
slidController = SlidableController(this).obs;
|
||||
bottomSheetManager = BottomSheetManager({
|
||||
filterBottomSheetController:
|
||||
() => filterWidget(filterIndex: filterIndex, showIndex: showIndex),
|
||||
selectedLocationBottomSheetController:
|
||||
() => selectedLocationWidget(
|
||||
showHint:
|
||||
selectedLocationBottomSheetController.isVisible.value &&
|
||||
showSlideHint,
|
||||
sliderController: slidController.value,
|
||||
trigger: triggerSlidableAnimation,
|
||||
toggle: selectedLocationBottomSheetController.toggle,
|
||||
),
|
||||
detailsLocationBottomSheetController: () => markerDetailsWidget(),
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
determineCurrentPosition();
|
||||
generatedMarkers();
|
||||
}
|
||||
|
||||
Future<void> triggerSlidableAnimation() async {
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.openEndActionPane();
|
||||
await Future.delayed(Duration(milliseconds: 200));
|
||||
await slidController.value.close();
|
||||
showSlideHint = false;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
slidController.close();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
609
packages/inspection/lib/presentation/filter/view.dart
Normal file
609
packages/inspection/lib/presentation/filter/view.dart
Normal file
@@ -0,0 +1,609 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/data/utils.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class SupervisionFilterPage extends GetView<InspectorFilterLogic> {
|
||||
const SupervisionFilterPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: PopScope(
|
||||
canPop: !controller.bottomSheetManager.isAnyVisible,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
controller.bottomSheetManager.closeFirstVisible();
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
_buildMap(),
|
||||
_buildGpsButton(),
|
||||
_buildFilterButton(),
|
||||
Obx(() => controller.bottomSheetManager.buildVisibleSheet()),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMap() {
|
||||
return ObxValue((currentLocation) {
|
||||
return FlutterMap(
|
||||
mapController: controller.animatedMapController.mapController,
|
||||
options: MapOptions(
|
||||
initialCenter: currentLocation.value,
|
||||
initialZoom: 18,
|
||||
onPositionChanged: (camera, hasGesture) {
|
||||
controller.debouncedUpdateVisibleMarkers(center: camera.center);
|
||||
},
|
||||
),
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
),
|
||||
ObxValue((markers) {
|
||||
return MarkerLayer(
|
||||
markers:
|
||||
markers
|
||||
.map(
|
||||
(e) => markerWidget(
|
||||
marker: e,
|
||||
onTap: () {
|
||||
controller
|
||||
.selectedLocationBottomSheetController
|
||||
.isVisible
|
||||
.value = true;
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}, controller.markers),
|
||||
],
|
||||
);
|
||||
}, controller.currentLocation);
|
||||
}
|
||||
|
||||
Widget _buildGpsButton() {
|
||||
return Positioned(
|
||||
right: 10,
|
||||
bottom: 83,
|
||||
child: ObxValue((data) {
|
||||
return RFab.small(
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
isLoading: data.value,
|
||||
icon: vecWidget(Assets.vecGpsSvg),
|
||||
onPressed: () async {
|
||||
controller.isLoading.value = true;
|
||||
await controller.determineCurrentPosition();
|
||||
controller.isLoading.value = false;
|
||||
},
|
||||
);
|
||||
}, controller.isLoading),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFilterButton() {
|
||||
return Positioned(
|
||||
right: 10,
|
||||
bottom: 30,
|
||||
child: RFab.small(
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
icon: vecWidget(Assets.vecFilterSvg, width: 24, height: 24),
|
||||
onPressed: () => controller.filterBottomSheetController.toggle(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Marker markerWidget({required LatLng marker, required VoidCallback onTap}) {
|
||||
return Marker(
|
||||
point: marker,
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: SizedBox(
|
||||
width: 36,
|
||||
height: 36,
|
||||
child: vecWidget(Assets.vecMapMarkerSvg,width: 30,height: 30,),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Padding filterWidget({required RxInt filterIndex, required RxInt showIndex}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
spacing: 16,
|
||||
children: [
|
||||
Container(
|
||||
width: 100,
|
||||
height: 64,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.blueLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text('دامداران', style: AppFonts.yekan10),
|
||||
Text('183 عدد', style: AppFonts.yekan13Bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 100,
|
||||
height: 64,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.greenLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text('مرغداران', style: AppFonts.yekan10),
|
||||
Text('183 عدد', style: AppFonts.yekan13Bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 100,
|
||||
height: 64,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.blueLight,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text('اصناف', style: AppFonts.yekan10),
|
||||
Text('183 عدد', style: AppFonts.yekan13Bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'فیلتر نمایش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
ObxValue((data) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
customChip(
|
||||
isSelected: data.value == 0,
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 0,
|
||||
title: 'دامداران',
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 1,
|
||||
title: 'مرغداران',
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 1,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 2,
|
||||
title: 'اصناف',
|
||||
onTap: (data) {
|
||||
filterIndex.value = data;
|
||||
},
|
||||
index: 2,
|
||||
),
|
||||
],
|
||||
);
|
||||
}, filterIndex),
|
||||
],
|
||||
),
|
||||
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'نمایش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
ObxValue((data) {
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 8,
|
||||
children: [
|
||||
customChip(
|
||||
isSelected: data.value == 0,
|
||||
title: 'نمایش همه',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 0,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 1,
|
||||
title: 'دارای تراکنش',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 1,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 2,
|
||||
title: 'بازرسی شده ها',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 2,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 3,
|
||||
title: 'بازرسی نشده ها',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 3,
|
||||
),
|
||||
customChip(
|
||||
isSelected: data.value == 4,
|
||||
title: 'متخلفین',
|
||||
onTap: (data) {
|
||||
showIndex.value = data;
|
||||
},
|
||||
index: 4,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, showIndex),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget markerDetailsWidget() {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.all(35),
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 15,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
spacing: 12,
|
||||
children: [
|
||||
Text(
|
||||
'داود خرم پور',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecMapSvg,
|
||||
onTap: () {
|
||||
Get.toNamed(InspectionRoutes.inspectionLocationDetails);
|
||||
},
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecMessageAddSvg,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: AppColor.greenNormal,
|
||||
onTap: () {
|
||||
Get.toNamed(InspectionRoutes.inspectionAddSupervision);
|
||||
},
|
||||
),
|
||||
|
||||
vecWidgetWithOnTap(
|
||||
assets: Assets.vecSecurityTimeSvg,
|
||||
color: AppColor.warning,
|
||||
height: 24,
|
||||
width: 24,
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 32,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: AppColor.blueLightHover),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'باقی مانده',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0 کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'شماره همراه',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0326598653',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'آخرین فعالیت',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'1409/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'موجودی',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'5کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
...List.generate(
|
||||
5,
|
||||
(index) => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
children: [
|
||||
Text(
|
||||
'فروش رفته',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0 کیلوگرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan14.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget customChip({
|
||||
bool isSelected = false,
|
||||
required String title,
|
||||
required int index,
|
||||
required Function(int) onTap,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
onTap.call(index);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? AppColor.blueNormal : AppColor.whiteGreyNormal,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border:
|
||||
isSelected
|
||||
? Border.fromBorderSide(BorderSide.none)
|
||||
: Border.all(width: 0.25, color: const Color(0xFFB0B0B0)),
|
||||
),
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
isSelected
|
||||
? AppFonts.yekan10.copyWith(color: AppColor.whiteLight)
|
||||
: AppFonts.yekan10,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget selectedLocationWidget({
|
||||
required bool showHint,
|
||||
required SlidableController sliderController,
|
||||
required VoidCallback trigger,
|
||||
required VoidCallback toggle,
|
||||
}) {
|
||||
eLog(showHint);
|
||||
if (showHint) {
|
||||
trigger.call();
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
||||
child: Slidable(
|
||||
key: Key('selectedLocationWidget'),
|
||||
controller: sliderController,
|
||||
endActionPane: ActionPane(
|
||||
motion: StretchMotion(),
|
||||
children: [
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {
|
||||
Get.toNamed(InspectionRoutes.inspectionLocationDetails);
|
||||
},
|
||||
backgroundColor: AppColor.blueNormal,
|
||||
foregroundColor: Colors.white,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomRight: Radius.circular(8),
|
||||
topRight: Radius.circular(8),
|
||||
),
|
||||
child: vecWidget(Assets.vecMapSvg, width: 24, height: 24),
|
||||
),
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {
|
||||
Get.toNamed(InspectionRoutes.inspectionAddSupervision);
|
||||
},
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
padding: EdgeInsets.all(16),
|
||||
child: vecWidget(Assets.vecMessageAddSvg),
|
||||
),
|
||||
CustomSlidableAction(
|
||||
onPressed: (context) {},
|
||||
backgroundColor: AppColor.warning,
|
||||
padding: EdgeInsets.all(16),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(8),
|
||||
topLeft: Radius.circular(8),
|
||||
),
|
||||
child: vecWidget(Assets.vecSecurityTimeSvg),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: toggle,
|
||||
child: Container(
|
||||
height: 58,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.blackLightHover),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'داود خرم مهری پور',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'گوشت و مرغ',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'باقی مانده',
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'0 کیلوگرم',
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyDarkHover,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
vecWidget(Assets.vecScanBarcodeSvg),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class LocationDetailsLogic extends GetxController {
|
||||
RxInt selectedSegment = 0.obs;
|
||||
|
||||
// The data for the segments
|
||||
final Map<int, Widget> segments = {
|
||||
0: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('همه', style: AppFonts.yekan13),
|
||||
),
|
||||
1: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)),
|
||||
child: Text('بر اساس تاریخ', style: AppFonts.yekan13),
|
||||
),
|
||||
};
|
||||
|
||||
RxBool seletected = false.obs;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
254
packages/inspection/lib/presentation/location_details/view.dart
Normal file
254
packages/inspection/lib/presentation/location_details/view.dart
Normal file
@@ -0,0 +1,254 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/presentation/utils/color_utils.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/tabs/new_tab.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class LocationDetailsPage extends GetView<LocationDetailsLogic> {
|
||||
const LocationDetailsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.lightGreyLight,
|
||||
appBar: RAppBar(title: 'جزئیات محل'),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 22),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
headerInfo(description: 'ایداگل محمدی', title: 'نام مالک'),
|
||||
|
||||
headerInfo(
|
||||
description: '09415115545',
|
||||
title: 'شماره همراه',
|
||||
background: AppColor.green1Light,
|
||||
),
|
||||
|
||||
headerInfo(description: '183کیلوگرم', title: 'موجودی'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(22, 13, 22, 4),
|
||||
child: Text(
|
||||
'نوع دریافت',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
),
|
||||
|
||||
ObxValue((data) {
|
||||
return NewCupertinoSegmentedControl<int>(
|
||||
padding: EdgeInsetsDirectional.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 10,
|
||||
),
|
||||
children: controller.segments,
|
||||
groupValue: data.value,
|
||||
selectedColor: AppColor.blueNormal,
|
||||
unselectedColor: Colors.white,
|
||||
borderColor: Colors.grey.shade300,
|
||||
onValueChanged: (int value) {
|
||||
data.value = value;
|
||||
},
|
||||
);
|
||||
}, controller.selectedSegment),
|
||||
Container(
|
||||
height: 32,
|
||||
margin: EdgeInsets.only(top: 10, left: 22, right: 22),
|
||||
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ROutlinedElevatedIcon(
|
||||
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||
onPressed:() async {
|
||||
|
||||
Jalali? picked = await showPersianDatePicker(
|
||||
context: context,
|
||||
initialDate: Jalali.now(),
|
||||
firstDate: Jalali(1385, 8),
|
||||
lastDate: Jalali(1450, 9),
|
||||
|
||||
initialEntryMode:
|
||||
PersianDatePickerEntryMode.calendarOnly,
|
||||
initialDatePickerMode: PersianDatePickerMode.day,
|
||||
);
|
||||
},
|
||||
text: 'از تاریخ',
|
||||
textStyle: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ROutlinedElevatedIcon(
|
||||
icon: FaIcon(FontAwesomeIcons.calendar),
|
||||
onPressed: () async {
|
||||
|
||||
Jalali? picked = await showPersianDatePicker(
|
||||
context: context,
|
||||
initialDate: Jalali.now(),
|
||||
firstDate: Jalali(1385, 8),
|
||||
lastDate: Jalali(1450, 9),
|
||||
|
||||
initialEntryMode:
|
||||
PersianDatePickerEntryMode.calendarOnly,
|
||||
initialDatePickerMode: PersianDatePickerMode.day,
|
||||
);
|
||||
},
|
||||
text: 'تا تاریخ',
|
||||
textStyle: AppFonts.yekan16.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Divider()),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
margin: EdgeInsets.symmetric(horizontal: 2),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: AppColor.blueNormal.disabledColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(60),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'تعداد کل تراکنش ها : 0',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan10,
|
||||
),
|
||||
),
|
||||
Expanded(child: Divider()),
|
||||
],
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
itemCount: 51,
|
||||
physics: BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.fromLTRB(20, 14, 20, 50),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 8,
|
||||
),
|
||||
itemBuilder:
|
||||
(context, index) => Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color: const Color(0xFFEFEFEF),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 22,
|
||||
vertical: 21,
|
||||
),
|
||||
child: Column(
|
||||
spacing: 6,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${index + 1}- تراکنش موفق',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan10,
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
'1403/12/12',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12,
|
||||
),
|
||||
|
||||
Text(
|
||||
'محصول : مرغ',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.lightGreyNormalActive,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'وزن : 5555 گرم',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.lightGreyNormalActive,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'مبلغ : 14،000،000',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.lightGreyNormalActive,
|
||||
),
|
||||
),
|
||||
|
||||
Text(
|
||||
'سرویس سامان کیش',
|
||||
textAlign: TextAlign.center,
|
||||
style: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container headerInfo({
|
||||
required String title,
|
||||
required String description,
|
||||
Color? background,
|
||||
}) {
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: ShapeDecoration(
|
||||
color: background ?? AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(width: 1, color: AppColor.blackLightHover),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
alignment: AlignmentDirectional.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(title, style: AppFonts.yekan10),
|
||||
|
||||
Text(description, style: AppFonts.yekan12),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
33
packages/inspection/lib/presentation/profile/logic.dart
Normal file
33
packages/inspection/lib/presentation/profile/logic.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class ProfileLogic extends GetxController {
|
||||
|
||||
|
||||
List<String> roles = <String>[
|
||||
'کاربر عادی',
|
||||
'کاربر ویژه',
|
||||
'کاربر VIP',
|
||||
'کاربر نقره ای',
|
||||
'کاربر طلایی',
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
RxInt selectedRole = 0.obs;
|
||||
RxInt selectedInformationType = 0.obs;
|
||||
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
260
packages/inspection/lib/presentation/profile/view.dart
Normal file
260
packages/inspection/lib/presentation/profile/view.dart
Normal file
@@ -0,0 +1,260 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class ProfilePage extends GetView<ProfileLogic> {
|
||||
const ProfilePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
spacing: 30,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * 0.3,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
alignment: Alignment.center,
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
vecWidget(Assets.vecBgHeaderUserProfileSvg, fit: BoxFit.cover),
|
||||
|
||||
Positioned(
|
||||
bottom: -20,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
width: 110,
|
||||
height: 110,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: AppColor.blueLightHover,
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.user,
|
||||
size: 45,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 16,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 75,
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.all(16),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder:
|
||||
(context, index) => ObxValue((data) {
|
||||
return ChoiceChip(
|
||||
onSelected: (value) {
|
||||
data.value = index;
|
||||
},
|
||||
selectedColor: AppColor.blueNormal,
|
||||
labelStyle:
|
||||
data.value == index
|
||||
? AppFonts.yekan13.copyWith(
|
||||
color: AppColor.whiteLight,
|
||||
)
|
||||
: AppFonts.yekan12.copyWith(
|
||||
color: AppColor.darkGreyNormalActive,
|
||||
),
|
||||
checkmarkColor: Colors.white,
|
||||
label: Text(controller.roles[index]),
|
||||
selected: index == data.value,
|
||||
);
|
||||
}, controller.selectedRole),
|
||||
|
||||
separatorBuilder: (context, index) => SizedBox(width: 8),
|
||||
itemCount: controller.roles.length,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 30,
|
||||
vertical: 10,
|
||||
),
|
||||
child: ObxValue((data) {
|
||||
return switch (data.value) {
|
||||
0 => userProfileInformation(),
|
||||
1 => bankInformationWidget(),
|
||||
2 => invoiceIssuanceInformation(),
|
||||
int() => Placeholder(),
|
||||
};
|
||||
}, controller.selectedInformationType),
|
||||
),
|
||||
),
|
||||
|
||||
ObxValue((data) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Wrap(
|
||||
spacing: 20,
|
||||
runSpacing: 10,
|
||||
children: [
|
||||
cardActionWidget(
|
||||
title: 'اطلاعات کاربری',
|
||||
onPressed: () {
|
||||
data.value = 0;
|
||||
},
|
||||
icon: Assets.vecProfileUserSvg,
|
||||
selected: data.value == 0,
|
||||
),
|
||||
cardActionWidget(
|
||||
title: 'اطلاعات بانکی',
|
||||
onPressed: () {
|
||||
data.value = 1;
|
||||
},
|
||||
icon: Assets.vecInformationSvg,
|
||||
selected: data.value == 1,
|
||||
),
|
||||
cardActionWidget(
|
||||
title: 'اطلاعات \nصدور فاکتور',
|
||||
onPressed: () {
|
||||
data.value = 2;
|
||||
},
|
||||
icon: Assets.vecReceiptDiscountSvg,
|
||||
selected: data.value == 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.selectedInformationType),
|
||||
|
||||
SizedBox(
|
||||
height: 100,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Container invoiceIssuanceInformation() => Container();
|
||||
|
||||
Widget bankInformationWidget() => Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
itemList(title: 'نام بانک', content: 'سامان'),
|
||||
itemList(title: 'نام صاحب حساب', content: 'رضا رضایی'),
|
||||
itemList(title: 'شماره کارت ', content: '54154545415'),
|
||||
itemList(title: 'شماره حساب', content: '62565263263652'),
|
||||
itemList(title: 'شماره شبا', content: '62565263263652'),
|
||||
],
|
||||
);
|
||||
|
||||
Column userProfileInformation() {
|
||||
return Column(
|
||||
spacing: 10,
|
||||
children: [
|
||||
itemList(
|
||||
title: 'نام و نام خانوادگی',
|
||||
content: 'آیدا گل محمدی',
|
||||
icon: Assets.vecUserSvg,
|
||||
),
|
||||
itemList(
|
||||
title: 'موبایل',
|
||||
content: '09302654896',
|
||||
icon: Assets.vecCallSvg,
|
||||
),
|
||||
itemList(
|
||||
title: 'کدملی',
|
||||
content: 'نا مشخص',
|
||||
icon: Assets.vecTagUserSvg,
|
||||
),
|
||||
itemList(
|
||||
title: 'شماره شناسنامه',
|
||||
content: 'نا مشخص',
|
||||
icon: Assets.vecUserSquareSvg,
|
||||
),
|
||||
itemList(
|
||||
title: 'تاریخ تولد',
|
||||
content: '1404/10/12',
|
||||
icon: Assets.vecCalendarSvg,
|
||||
),
|
||||
itemList(
|
||||
title: 'استان',
|
||||
content: 'لرستان',
|
||||
icon: Assets.vecPictureFrameSvg,
|
||||
),
|
||||
itemList(title: 'شهر', content: 'خرم آباد', icon: Assets.vecMapSvg),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemList({
|
||||
required String title,
|
||||
required String content,
|
||||
String? icon,
|
||||
}) => Row(
|
||||
spacing: 4,
|
||||
children: [
|
||||
if (icon != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: vecWidget(
|
||||
icon,
|
||||
width: 20,
|
||||
height: 20,
|
||||
color: AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)),
|
||||
Spacer(),
|
||||
Text(
|
||||
content,
|
||||
style: AppFonts.yekan13.copyWith(color: AppColor.darkGreyNormalHover),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Widget cardActionWidget({
|
||||
required String title,
|
||||
required VoidCallback onPressed,
|
||||
required String icon,
|
||||
bool selected = false,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: Column(
|
||||
spacing: 4,
|
||||
children: [
|
||||
Container(
|
||||
width: 52,
|
||||
height: 52,
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: ShapeDecoration(
|
||||
color: selected ? AppColor.blueLightActive : AppColor.blueLight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: vecWidget(
|
||||
icon,
|
||||
width: 40,
|
||||
height: 40,
|
||||
color: selected ? AppColor.blueNormalActive : AppColor.blueNormal,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan10.copyWith(
|
||||
color: selected ? AppColor.blueNormal : AppColor.blueLightActive,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class RegistrationOfViolationLogic extends GetxController {
|
||||
RxInt countViolation = 1.obs;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:inspection/presentation/registration_of_violation/logic.dart';
|
||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/presentation/widget/buttons/fab.dart';
|
||||
|
||||
class RegistrationOfViolationPage
|
||||
extends GetView<RegistrationOfViolationLogic> {
|
||||
const RegistrationOfViolationPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.bgLight,
|
||||
appBar: RAppBar(
|
||||
title: 'ثبت تخلف',
|
||||
leading: vecWidget(
|
||||
Assets.vecMessageAddSvg,
|
||||
color: Colors.white,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
additionalActions: [
|
||||
RFab.smallAdd(onPressed: () => controller.countViolation.value++),
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ObxValue((data) {
|
||||
return ListView.separated(
|
||||
itemBuilder: (context, index) => violationWidget(),
|
||||
separatorBuilder: (context, index) => SizedBox(height: 15),
|
||||
itemCount: data.value,
|
||||
);
|
||||
}, controller.countViolation),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 4, 0, 25),
|
||||
child: RElevated(
|
||||
text: 'مرحله بعد',
|
||||
onPressed: () {
|
||||
Get.toNamed(InspectionRoutes.inspectionDisplayInformation);
|
||||
},
|
||||
isFullWidth: true,
|
||||
height: 40,
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
textStyle: AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Container violationWidget() {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 0.7, color: AppColor.bgDark),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 16,
|
||||
children: [
|
||||
RTextField(
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
RTextField(
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
label: 'عنوان تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
),
|
||||
RTextField(
|
||||
label: 'توضیحات تخلف',
|
||||
filled: true,
|
||||
filledColor: AppColor.whiteLight,
|
||||
maxLines: 3,
|
||||
minLines: 3,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
spacing: 16,
|
||||
children: [
|
||||
Expanded(child: RElevated(text: 'ثبت', onPressed: () {})),
|
||||
Expanded(
|
||||
child: ROutlinedElevated(text: 'انصراف', onPressed: () {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
92
packages/inspection/lib/presentation/root/logic.dart
Normal file
92
packages/inspection/lib/presentation/root/logic.dart
Normal file
@@ -0,0 +1,92 @@
|
||||
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/data/utils.dart';
|
||||
|
||||
enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
||||
|
||||
class RootLogic extends GetxController {
|
||||
RxInt currentIndex = 0.obs;
|
||||
List<Widget> pages = [SupervisionFilterPage(), ActionPage(), ProfilePage()];
|
||||
RxList<ErrorLocationType> errorLocationType = RxList();
|
||||
|
||||
Stream<bool> listenToLocationServiceStatus() {
|
||||
return Geolocator.getServiceStatusStream().map((status) {
|
||||
return status == ServiceStatus.enabled;
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool> locationServiceEnabled() async {
|
||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Future<bool> checkPermission({bool request = false}) async {
|
||||
try {
|
||||
final LocationPermission permission = await Geolocator.checkPermission();
|
||||
|
||||
switch (permission) {
|
||||
case LocationPermission.denied:
|
||||
final LocationPermission requestResult = await Geolocator.requestPermission();
|
||||
return requestResult != LocationPermission.denied &&
|
||||
requestResult != LocationPermission.deniedForever;
|
||||
|
||||
case LocationPermission.deniedForever:
|
||||
|
||||
return request ? await Geolocator.openAppSettings() : false;
|
||||
|
||||
case LocationPermission.always:
|
||||
case LocationPermission.whileInUse:
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
eLog(e);
|
||||
return await Geolocator.openLocationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
|
||||
locationServiceEnabled().then((value) {
|
||||
if (!value) {
|
||||
errorLocationType.add(ErrorLocationType.serviceDisabled);
|
||||
}
|
||||
});
|
||||
|
||||
checkPermission().then((value) {
|
||||
if (!value) {
|
||||
errorLocationType.add(ErrorLocationType.permissionDenied);
|
||||
}
|
||||
});
|
||||
|
||||
listenToLocationServiceStatus().listen((event) {
|
||||
if (!event) {
|
||||
errorLocationType.add(ErrorLocationType.serviceDisabled);
|
||||
} else {
|
||||
errorLocationType.remove(ErrorLocationType.serviceDisabled);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void changePage(int index) {
|
||||
currentIndex.value = index;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
152
packages/inspection/lib/presentation/root/view.dart
Normal file
152
packages/inspection/lib/presentation/root/view.dart
Normal file
@@ -0,0 +1,152 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/data/utils.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class RootPage extends GetView<RootLogic> {
|
||||
const RootPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
ObxValue((errorType) {
|
||||
if (errorType.isNotEmpty) {
|
||||
if (errorType.contains(ErrorLocationType.serviceDisabled)) {
|
||||
Future.microtask(() {
|
||||
Get.defaultDialog(
|
||||
title: 'خطا',
|
||||
content: const Text('سرویس مکانیابی غیرفعال است'),
|
||||
cancel: ROutlinedElevated(
|
||||
text: 'بررسی مجدد',
|
||||
width: 120,
|
||||
textStyle: AppFonts.yekan16,
|
||||
onPressed: () async {
|
||||
var service = await controller.locationServiceEnabled();
|
||||
eLog(service);
|
||||
if (service) {
|
||||
controller.errorLocationType.remove(
|
||||
ErrorLocationType.serviceDisabled,
|
||||
);
|
||||
Get.back();
|
||||
}
|
||||
// Don't call Get.back() if service is still disabled
|
||||
},
|
||||
),
|
||||
confirm: RElevated(
|
||||
text: 'روشن کردن',
|
||||
textStyle: AppFonts.yekan16,
|
||||
width: 120,
|
||||
onPressed: () async {
|
||||
var res = await Geolocator.openLocationSettings();
|
||||
if (res) {
|
||||
var service =
|
||||
await controller.locationServiceEnabled();
|
||||
if (service) {
|
||||
controller.errorLocationType.remove(
|
||||
ErrorLocationType.serviceDisabled,
|
||||
);
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
contentPadding: EdgeInsets.all(8),
|
||||
onWillPop: () async {
|
||||
return controller.errorLocationType.isEmpty;
|
||||
},
|
||||
barrierDismissible: false,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
Future.microtask(() {
|
||||
Get.defaultDialog(
|
||||
title: 'خطا',
|
||||
content: const Text(
|
||||
' دسترسی به سرویس مکانیابی غیرفعال است',
|
||||
),
|
||||
cancel: ROutlinedElevated(
|
||||
text: 'بررسی مجدد',
|
||||
width: 120,
|
||||
textStyle: AppFonts.yekan16,
|
||||
onPressed: () async {
|
||||
await controller.checkPermission();
|
||||
},
|
||||
),
|
||||
confirm: RElevated(
|
||||
text: 'اجازه دادن',
|
||||
textStyle: AppFonts.yekan16,
|
||||
width: 120,
|
||||
onPressed: () async {
|
||||
var res = await controller.checkPermission(
|
||||
request: true,
|
||||
);
|
||||
if (res) {
|
||||
controller.errorLocationType.remove(
|
||||
ErrorLocationType.permissionDenied,
|
||||
);
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
contentPadding: EdgeInsets.all(8),
|
||||
onWillPop: () async {
|
||||
return controller.errorLocationType.isEmpty;
|
||||
},
|
||||
barrierDismissible: false,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}, controller.errorLocationType),
|
||||
|
||||
ObxValue(
|
||||
(currentIndex) => IndexedStack(
|
||||
index: currentIndex.value,
|
||||
children: controller.pages,
|
||||
),
|
||||
controller.currentIndex,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: WaveBottomNavigation(
|
||||
items: [
|
||||
WaveBottomNavigationItem(title: 'خانه', icon: Assets.vecMapSvg),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'عملیات',
|
||||
icon: Assets.vecUserSvg,
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'افزودن',
|
||||
icon: Assets.vecAddSvg,
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'آمار',
|
||||
icon: Assets.vecDiagramSvg,
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'تماس',
|
||||
icon: Assets.vecCallSvg,
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'مکان ',
|
||||
icon: Assets.vecGpsSvg,
|
||||
),
|
||||
WaveBottomNavigationItem(
|
||||
title: 'تاریخ',
|
||||
icon: Assets.vecCalendarSvg,
|
||||
),
|
||||
],
|
||||
onPageChanged: (index) {
|
||||
controller.changePage(index);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
69
packages/inspection/lib/presentation/routes/app_pages.dart
Normal file
69
packages/inspection/lib/presentation/routes/app_pages.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:inspection/presentation/action/logic.dart';
|
||||
import 'package:inspection/presentation/add_mobile_inspector/logic.dart';
|
||||
import 'package:inspection/presentation/add_mobile_inspector/view.dart';
|
||||
import 'package:inspection/presentation/add_supervision/logic.dart';
|
||||
import 'package:inspection/presentation/add_supervision/view.dart';
|
||||
import 'package:inspection/presentation/display_information/logic.dart';
|
||||
import 'package:inspection/presentation/display_information/view.dart';
|
||||
import 'package:inspection/presentation/filter/logic.dart';
|
||||
import 'package:inspection/presentation/location_details/logic.dart';
|
||||
import 'package:inspection/presentation/location_details/view.dart';
|
||||
import 'package:inspection/presentation/profile/logic.dart';
|
||||
import 'package:inspection/presentation/profile/view.dart';
|
||||
import 'package:inspection/presentation/registration_of_violation/logic.dart';
|
||||
import 'package:inspection/presentation/registration_of_violation/view.dart';
|
||||
import 'package:inspection/presentation/root/logic.dart';
|
||||
import 'package:inspection/presentation/root/view.dart';
|
||||
import 'package:inspection/presentation/routes/app_routes.dart';
|
||||
|
||||
sealed class InspectionPages {
|
||||
InspectionPages._();
|
||||
|
||||
static final pages = [
|
||||
GetPage(
|
||||
name: InspectionRoutes.inspection,
|
||||
page: () => RootPage(),
|
||||
binding: BindingsBuilder(() {
|
||||
Get.put(RootLogic());
|
||||
Get.put(InspectorFilterLogic());
|
||||
Get.lazyPut(() => LocationDetailsLogic(), fenix: true);
|
||||
Get.lazyPut(() => ActionLogic(), fenix: true);
|
||||
Get.lazyPut(() => ProfileLogic(), fenix: true);
|
||||
}),
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: InspectionRoutes.inspectionLocationDetails,
|
||||
page: () => LocationDetailsPage(),
|
||||
bindings: [BindingsBuilder.put(() => LocationDetailsLogic())],
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: InspectionRoutes.inspectionAddSupervision,
|
||||
page: () => AddSupervisionPage(),
|
||||
binding: BindingsBuilder.put(() => AddSupervisionLogic()),
|
||||
),
|
||||
GetPage(
|
||||
name: InspectionRoutes.inspectionRegistrationOfViolation,
|
||||
page: () => RegistrationOfViolationPage(),
|
||||
binding: BindingsBuilder.put(() => RegistrationOfViolationLogic()),
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: InspectionRoutes.inspectionDisplayInformation,
|
||||
page: () => DisplayInformationPage(),
|
||||
binding: BindingsBuilder.put(() => DisplayInformationLogic()),
|
||||
),
|
||||
GetPage(
|
||||
name: InspectionRoutes.inspectionUserProfile,
|
||||
page: () => ProfilePage(),
|
||||
binding: BindingsBuilder.put(() => ProfileLogic()),
|
||||
),
|
||||
GetPage(
|
||||
name: InspectionRoutes.inspectionAddMobileInspector,
|
||||
page: () => AddMobileInspectorPage(),
|
||||
binding: BindingsBuilder.put(() => AddMobileInspectorLogic()),
|
||||
),
|
||||
];
|
||||
}
|
||||
12
packages/inspection/lib/presentation/routes/app_routes.dart
Normal file
12
packages/inspection/lib/presentation/routes/app_routes.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
sealed class InspectionRoutes {
|
||||
InspectionRoutes._();
|
||||
|
||||
static const inspection = '/supervision';
|
||||
static const inspectionAction = '$inspection/action';
|
||||
static const inspectionUserProfile = '$inspection/userSettings';
|
||||
static const inspectionLocationDetails = '$inspection/locationDetails';
|
||||
static const inspectionAddSupervision = '$inspectionLocationDetails/addSupervision';
|
||||
static const inspectionAddMobileInspector = '$inspectionLocationDetails/addMobileInspector';
|
||||
static const inspectionRegistrationOfViolation = '$inspectionAddSupervision/RegistrationOfViolation';
|
||||
static const inspectionDisplayInformation = '$inspectionRegistrationOfViolation/DisplayInformation';
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AnimatedClusterMarker extends StatefulWidget {
|
||||
final int count;
|
||||
|
||||
const AnimatedClusterMarker({super.key, required this.count});
|
||||
|
||||
@override
|
||||
State<AnimatedClusterMarker> createState() => _AnimatedClusterMarkerState();
|
||||
}
|
||||
|
||||
class _AnimatedClusterMarkerState extends State<AnimatedClusterMarker>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
)..forward(); // start animation
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ScaleTransition(
|
||||
scale: CurvedAnimation(parent: _controller, curve: Curves.easeOutBack),
|
||||
child: Opacity(
|
||||
opacity: _controller.value,
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blueAccent,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white, width: 2),
|
||||
),
|
||||
child: Text(
|
||||
widget.count.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
673
packages/inspection/pubspec.lock
Normal file
673
packages/inspection/pubspec.lock
Normal file
@@ -0,0 +1,673 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.13.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.6"
|
||||
cupertino_icons:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cupertino_icons
|
||||
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.8"
|
||||
dart_earcut:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_earcut
|
||||
sha256: e485001bfc05dcbc437d7bfb666316182e3522d4c3f9668048e004d0eb2ce43b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
dartx:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dartx
|
||||
sha256: "8b25435617027257d43e6508b5fe061012880ddfdaa75a71d607c3de2a13d244"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
dio:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio
|
||||
sha256: "253a18bbd4851fecba42f7343a1df3a9a4c1d31a2c1b37e221086b4fa8c8dbc9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.8.0+1"
|
||||
dio_web_adapter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio_web_adapter
|
||||
sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_localizations:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_map:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_map
|
||||
sha256: f7d0379477274f323c3f3bc12d369a2b42eb86d1e7bd2970ae1ea3cff782449a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.1"
|
||||
flutter_map_animations:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_map_animations
|
||||
sha256: bf583863561861aaaf4854ae7ed8940d79bea7d32918bf7a85d309b25235a09e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.0"
|
||||
flutter_rating_bar:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_rating_bar
|
||||
sha256: d2af03469eac832c591a1eba47c91ecc871fe5708e69967073c043b2d775ed93
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.1"
|
||||
flutter_slidable:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_slidable
|
||||
sha256: ab7dbb16f783307c9d7762ede2593ce32c220ba2ba0fd540a3db8e9a3acba71a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
flutter_svg:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_svg
|
||||
sha256: d44bf546b13025ec7353091516f6881f1d4c633993cb109c3916c3a0159dadf1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
font_awesome_flutter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: font_awesome_flutter
|
||||
sha256: d3a89184101baec7f4600d58840a764d2ef760fe1c5a20ef9e6b0e9b24a07a3a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.8.0"
|
||||
freezed_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: freezed_annotation
|
||||
sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
geolocator:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator
|
||||
sha256: e7ebfa04ce451daf39b5499108c973189a71a919aa53c1204effda1c5b93b822
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.0.0"
|
||||
geolocator_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_android
|
||||
sha256: "114072db5d1dce0ec0b36af2697f55c133bc89a2c8dd513e137c0afe59696ed4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.1+1"
|
||||
geolocator_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_apple
|
||||
sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.13"
|
||||
geolocator_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_platform_interface
|
||||
sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.6"
|
||||
geolocator_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_web
|
||||
sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.3"
|
||||
geolocator_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_windows
|
||||
sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.5"
|
||||
get:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: get
|
||||
sha256: c79eeb4339f1f3deffd9ec912f8a923834bec55f7b49c9e882b8fef2c139d425
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.7.2"
|
||||
get_it:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: get_it
|
||||
sha256: f126a3e286b7f5b578bf436d5592968706c4c1de28a228b870ce375d9f743103
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.0.3"
|
||||
hive_ce:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hive_ce
|
||||
sha256: fdc19336f03ecd01dbc1d1afe69d87ed9336bdf996c5374a25f9c21ef5f2989e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.11.1"
|
||||
hive_ce_flutter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hive_ce_flutter
|
||||
sha256: "5eaf57a5af980eda63ddaa8c34d618dc446f76fe79410f2a283522744291c05c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.19.0"
|
||||
isolate_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: isolate_channel
|
||||
sha256: bafedfbcc1e9796ada179b5dac7043b33eb85d35204b089ca37d480d9c0068df
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.2"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
latlong2:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: latlong2
|
||||
sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.1"
|
||||
lists:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lists
|
||||
sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
logger:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logger
|
||||
sha256: be4b23575aac7ebf01f225a241eb7f6b5641eeaf43c6a8613510fc2f8cf187d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.11.1"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.16.0"
|
||||
mgrs_dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: mgrs_dart
|
||||
sha256: fb89ae62f05fa0bb90f70c31fc870bcbcfd516c843fb554452ab3396f78586f7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
path_parsing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_parsing
|
||||
sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.17"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
permission_handler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler
|
||||
sha256: "2d070d8684b68efb580a5997eb62f675e8a885ef0be6e754fb9ef489c177470f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "12.0.0+1"
|
||||
permission_handler_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_android
|
||||
sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.0.1"
|
||||
permission_handler_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_apple
|
||||
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.4.7"
|
||||
permission_handler_html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_html
|
||||
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3+5"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_platform_interface
|
||||
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.3.0"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_windows
|
||||
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.1"
|
||||
persian_datetime_picker:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: persian_datetime_picker
|
||||
sha256: "7ccbfd3a68dc89d405550f624e9fa590c914fed2aa2d48973c4f4400baab2e06"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
polylabel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: polylabel
|
||||
sha256: "41b9099afb2aa6c1730bdd8a0fab1400d287694ec7615dd8516935fa3144214b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
pretty_dio_logger:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pretty_dio_logger
|
||||
sha256: "36f2101299786d567869493e2f5731de61ce130faa14679473b26905a92b6407"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
proj4dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: proj4dart
|
||||
sha256: c8a659ac9b6864aa47c171e78d41bbe6f5e1d7bd790a5814249e6b68bc44324e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
rasadyar_core:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../core"
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.0.0+1"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: rxdart
|
||||
sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.28.0"
|
||||
shamsi_date:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shamsi_date
|
||||
sha256: b6c79ff34ddfb1e9e4761347f18e30afdd7d16cc3db77defd5a40e2d93894c51
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.1"
|
||||
sprintf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sprintf
|
||||
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.2"
|
||||
time:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: time
|
||||
sha256: "370572cf5d1e58adcb3e354c47515da3f7469dac3a95b447117e728e7be6f461"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
unicode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: unicode
|
||||
sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.1"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: uuid
|
||||
sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.5.1"
|
||||
vector_graphics:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics
|
||||
sha256: "44cc7104ff32563122a929e4620cf3efd584194eec6d1d913eb5ba593dbcf6de"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.18"
|
||||
vector_graphics_codec:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_codec
|
||||
sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.13"
|
||||
vector_graphics_compiler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_compiler
|
||||
sha256: "1b4b9e706a10294258727674a340ae0d6e64a7231980f9f9a3d12e4b42407aad"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.16"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
wkt_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: wkt_parser
|
||||
sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
sdks:
|
||||
dart: ">=3.7.2 <4.0.0"
|
||||
flutter: ">=3.27.0"
|
||||
13
packages/inspection/pubspec.yaml
Normal file
13
packages/inspection/pubspec.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
name: inspection
|
||||
description: "inspection module for rasadyar"
|
||||
publish_to: 'none'
|
||||
version: 1.0.1
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.2
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
rasadyar_core:
|
||||
path: ../core
|
||||
Reference in New Issue
Block a user