From 905e407ccdefb926b0e86c5ca21a0bc62b06e78f Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Mon, 19 May 2025 16:16:33 +0330 Subject: [PATCH] fix : 1 - multi module in Auth select save selected module 2 - add flutter gen for assets builder --- assets/icons/inspection.svg | 1 + assets/icons/liveStock.svg | 1 + assets/vec/inspection.svg.vec | Bin 0 -> 4224 bytes assets/vec/liveStock.svg.vec | Bin 0 -> 5948 bytes lib/infrastructure/service/auth_service.dart | 16 +- lib/presentation/pages/splash/logic.dart | 10 +- lib/presentation/pages/splash/view.dart | 7 +- lib/presentation/routes/app_pages.dart | 17 +- packages/auth/lib/auth.dart | 1 + packages/auth/lib/data/di/auth_di.dart | 1 + .../models/local/module/module_model.dart | 16 + .../local/module/module_model.freezed.dart | 148 ++++++ .../local/user_local/user_local_model.dart | 15 + .../local/user_local/user_local_model.g.dart | 44 +- .../data/services/token_storage_service.dart | 22 +- packages/auth/lib/hive_registrar.g.dart | 2 + .../lib/presentation/pages/auth/logic.dart | 15 +- .../lib/presentation/pages/auth/view.dart | 10 +- .../lib/presentation/pages/modules/logic.dart | 12 + .../lib/presentation/pages/modules/view.dart | 36 +- .../auth/lib/presentation/routes/pages.dart | 7 +- .../lib/presentation/widget/logo_widget.dart | 5 +- packages/core/lib/core.dart | 2 + .../core/lib/presentation/common/assets.dart | 72 --- .../lib/presentation/common/assets.gen.dart | 451 ++++++++++++++++++ .../core/lib/presentation/common/common.dart | 2 +- .../lib/presentation/common/fonts.gen.dart | 15 + .../wave_bottom_navigation.dart | 9 +- .../lib/presentation/widget/buttons/fab.dart | 83 +++- .../widget/buttons/fab_outlined.dart | 426 +++++++++-------- .../card/card_with_icon_with_border.dart | 46 ++ .../lib/presentation/widget/vec_widget.dart | 11 +- .../core/lib/presentation/widget/widget.dart | 1 + packages/core/pubspec.lock | 56 +++ packages/core/pubspec.yaml | 10 + .../lib/presentation/action/view.dart | 37 +- .../add_mobile_inspector/view.dart | 8 +- .../presentation/add_supervision/view.dart | 8 +- .../display_information/view.dart | 8 +- .../lib/presentation/filter/view.dart | 25 +- .../lib/presentation/profile/view.dart | 44 +- .../registration_of_violation/view.dart | 8 +- .../lib/presentation/root/view.dart | 38 +- .../lib/presentation/page/root/logic.dart | 17 + .../lib/presentation/page/root/view.dart | 12 + pubspec.lock | 63 +++ 46 files changed, 1431 insertions(+), 407 deletions(-) create mode 100644 assets/icons/inspection.svg create mode 100644 assets/icons/liveStock.svg create mode 100644 assets/vec/inspection.svg.vec create mode 100644 assets/vec/liveStock.svg.vec create mode 100644 packages/auth/lib/data/models/local/module/module_model.dart create mode 100644 packages/auth/lib/data/models/local/module/module_model.freezed.dart delete mode 100644 packages/core/lib/presentation/common/assets.dart create mode 100644 packages/core/lib/presentation/common/assets.gen.dart create mode 100644 packages/core/lib/presentation/common/fonts.gen.dart create mode 100644 packages/core/lib/presentation/widget/card/card_with_icon_with_border.dart create mode 100644 packages/livestock/lib/presentation/page/root/logic.dart create mode 100644 packages/livestock/lib/presentation/page/root/view.dart diff --git a/assets/icons/inspection.svg b/assets/icons/inspection.svg new file mode 100644 index 0000000..3e49ae8 --- /dev/null +++ b/assets/icons/inspection.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/liveStock.svg b/assets/icons/liveStock.svg new file mode 100644 index 0000000..24b6c5e --- /dev/null +++ b/assets/icons/liveStock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/vec/inspection.svg.vec b/assets/vec/inspection.svg.vec new file mode 100644 index 0000000000000000000000000000000000000000..ed9d937f9d3ac204d8e1be8c8e8792016d9641c9 GIT binary patch literal 4224 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 Y5EbD}DbA}3dnM=*LP?U5P|AjX1JC_?(f|Me literal 0 HcmV?d00001 diff --git a/assets/vec/liveStock.svg.vec b/assets/vec/liveStock.svg.vec new file mode 100644 index 0000000000000000000000000000000000000000..469f5a140fc70f19d9f9a5abd2b8361412bc51a3 GIT binary patch literal 5948 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 @@ -13,25 +15,19 @@ class AuthService extends GetxService { super.onInit(); ever(tokenService.accessToken, (callback) { - iLog('Access token callback: $callback, value: ${tokenService.accessToken.value}'); accessRes.value = (callback != null); }); ever(tokenService.refreshToken, (callback) { - fLog('Refresh token callback: $callback, value: ${tokenService.refreshToken.value}'); refAccessRes.value = (callback != null); }); - everAll([accessRes, refAccessRes], (_) { if (accessRes.value && refAccessRes.value) { - - Get.offAndToNamed(InspectionRoutes.inspection); - fLog('Both accessToken and refreshToken are available: accessToken=${tokenService.accessToken.value}, refreshToken=${tokenService.refreshToken.value}'); - } else { - fLog('One or both tokens are missing: accessToken=${tokenService.accessToken.value}, refreshToken=${tokenService.refreshToken.value}'); + var targetPage = getTargetPage(tokenService.appModule.value); + Get.offAndToNamed(targetPage); } }); - } + } diff --git a/lib/presentation/pages/splash/logic.dart b/lib/presentation/pages/splash/logic.dart index 4dd4a4e..8f26018 100644 --- a/lib/presentation/pages/splash/logic.dart +++ b/lib/presentation/pages/splash/logic.dart @@ -1,6 +1,7 @@ import 'package:flutter/animation.dart'; +import 'package:rasadyar_app/presentation/routes/app_pages.dart'; +import 'package:rasadyar_auth/data/services/token_storage_service.dart'; import 'package:rasadyar_core/core.dart'; -import 'package:rasadyar_inspection/inspection.dart'; class SplashLogic extends GetxController with GetTickerProviderStateMixin { late final AnimationController scaleController; @@ -8,6 +9,8 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin { Rxn> scaleAnimation = Rxn(); Rxn> rotationAnimation = Rxn(); + var tokenService = Get.find(); + @override void onInit() { super.onInit(); @@ -53,8 +56,9 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin { @override void onReady() { super.onReady(); - Future.delayed(const Duration(seconds: 1), () { - Get.offAllNamed(InspectionRoutes.inspection); + Future.delayed(const Duration(seconds: 1), () async { + var module = tokenService.appModule.value; + Get.offAndToNamed(getTargetPage(module)); }); } diff --git a/lib/presentation/pages/splash/view.dart b/lib/presentation/pages/splash/view.dart index bffd309..4cd5ce8 100644 --- a/lib/presentation/pages/splash/view.dart +++ b/lib/presentation/pages/splash/view.dart @@ -20,11 +20,10 @@ class SplashPage extends GetView { scale: data.value!, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 1), - child: Image.asset( - Assets.imagesInnerSplash, + child: Assets.images.innerSplash.image( width: 190, height: 190, - ), + ) ), ); }, controller.scaleAnimation), @@ -35,7 +34,7 @@ class SplashPage extends GetView { child: Padding( padding: const EdgeInsets.symmetric(horizontal: 1), - child: Image.asset(Assets.imagesOutterSplash), + child: Assets.images.outterSplash.image() ), ); }, controller.rotationAnimation), diff --git a/lib/presentation/routes/app_pages.dart b/lib/presentation/routes/app_pages.dart index 61effcb..8e5f373 100644 --- a/lib/presentation/routes/app_pages.dart +++ b/lib/presentation/routes/app_pages.dart @@ -1,9 +1,12 @@ import 'package:rasadyar_app/presentation/pages/splash/logic.dart'; import 'package:rasadyar_app/presentation/pages/splash/view.dart'; import 'package:rasadyar_app/presentation/pages/system_design/system_design.dart'; +import 'package:rasadyar_auth/auth.dart'; +import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart'; import 'package:rasadyar_auth/presentation/routes/pages.dart'; import 'package:rasadyar_core/core.dart'; import 'package:rasadyar_inspection/inspection.dart'; +import 'package:rasadyar_livestock/presentation/routes/app_pages.dart'; part 'app_paths.dart'; @@ -23,6 +26,18 @@ sealed class AppPages { ...InspectionPages.pages, ...AuthPages.pages, - + ...LiveStockPages.pages, ]; } + +String getTargetPage(Module? value) { + eLog('getTargetPage: $value'); + switch (value) { + case Module.inspection: + return InspectionRoutes.inspection; + case Module.liveStocks: + return LiveStockRoutes.init; + default: + return InspectionRoutes.inspection; + } +} \ No newline at end of file diff --git a/packages/auth/lib/auth.dart b/packages/auth/lib/auth.dart index 9e7c1c4..30c7f5f 100644 --- a/packages/auth/lib/auth.dart +++ b/packages/auth/lib/auth.dart @@ -5,3 +5,4 @@ library; export 'data/services/auth_middelware.dart'; export 'data/di/auth_di.dart'; +export 'data/models/local/module/module_model.dart'; diff --git a/packages/auth/lib/data/di/auth_di.dart b/packages/auth/lib/data/di/auth_di.dart index 3f4771e..190715f 100644 --- a/packages/auth/lib/data/di/auth_di.dart +++ b/packages/auth/lib/data/di/auth_di.dart @@ -11,6 +11,7 @@ GetIt diAuth = GetIt.instance; Future setupAuthDI() async { diAuth.registerLazySingleton(() => DioRemoteManager()); + final manager = diAuth.get(); final dioRemote = await manager.setEnvironment(ApiEnvironment.dam); diAuth.registerCachedFactory( diff --git a/packages/auth/lib/data/models/local/module/module_model.dart b/packages/auth/lib/data/models/local/module/module_model.dart new file mode 100644 index 0000000..f543681 --- /dev/null +++ b/packages/auth/lib/data/models/local/module/module_model.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart'; +import 'package:rasadyar_core/core.dart'; + +part 'module_model.freezed.dart'; + + +@freezed +abstract class ModuleModel with _$ModuleModel{ + const factory ModuleModel({ + required String title, + required String icon, + required Module module, + }) = _ModuleModel; + +} \ No newline at end of file diff --git a/packages/auth/lib/data/models/local/module/module_model.freezed.dart b/packages/auth/lib/data/models/local/module/module_model.freezed.dart new file mode 100644 index 0000000..48feb37 --- /dev/null +++ b/packages/auth/lib/data/models/local/module/module_model.freezed.dart @@ -0,0 +1,148 @@ +// 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 'module_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ModuleModel { + + String get title; String get icon; Module get module; +/// Create a copy of ModuleModel +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ModuleModelCopyWith get copyWith => _$ModuleModelCopyWithImpl(this as ModuleModel, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.module, module) || other.module == module)); +} + + +@override +int get hashCode => Object.hash(runtimeType,title,icon,module); + +@override +String toString() { + return 'ModuleModel(title: $title, icon: $icon, module: $module)'; +} + + +} + +/// @nodoc +abstract mixin class $ModuleModelCopyWith<$Res> { + factory $ModuleModelCopyWith(ModuleModel value, $Res Function(ModuleModel) _then) = _$ModuleModelCopyWithImpl; +@useResult +$Res call({ + String title, String icon, Module module +}); + + + + +} +/// @nodoc +class _$ModuleModelCopyWithImpl<$Res> + implements $ModuleModelCopyWith<$Res> { + _$ModuleModelCopyWithImpl(this._self, this._then); + + final ModuleModel _self; + final $Res Function(ModuleModel) _then; + +/// Create a copy of ModuleModel +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? icon = null,Object? module = null,}) { + return _then(_self.copyWith( +title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable +as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable +as String,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable +as Module, + )); +} + +} + + +/// @nodoc + + +class _ModuleModel implements ModuleModel { + const _ModuleModel({required this.title, required this.icon, required this.module}); + + +@override final String title; +@override final String icon; +@override final Module module; + +/// Create a copy of ModuleModel +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ModuleModelCopyWith<_ModuleModel> get copyWith => __$ModuleModelCopyWithImpl<_ModuleModel>(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ModuleModel&&(identical(other.title, title) || other.title == title)&&(identical(other.icon, icon) || other.icon == icon)&&(identical(other.module, module) || other.module == module)); +} + + +@override +int get hashCode => Object.hash(runtimeType,title,icon,module); + +@override +String toString() { + return 'ModuleModel(title: $title, icon: $icon, module: $module)'; +} + + +} + +/// @nodoc +abstract mixin class _$ModuleModelCopyWith<$Res> implements $ModuleModelCopyWith<$Res> { + factory _$ModuleModelCopyWith(_ModuleModel value, $Res Function(_ModuleModel) _then) = __$ModuleModelCopyWithImpl; +@override @useResult +$Res call({ + String title, String icon, Module module +}); + + + + +} +/// @nodoc +class __$ModuleModelCopyWithImpl<$Res> + implements _$ModuleModelCopyWith<$Res> { + __$ModuleModelCopyWithImpl(this._self, this._then); + + final _ModuleModel _self; + final $Res Function(_ModuleModel) _then; + +/// Create a copy of ModuleModel +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? icon = null,Object? module = null,}) { + return _then(_ModuleModel( +title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable +as String,icon: null == icon ? _self.icon : icon // ignore: cast_nullable_to_non_nullable +as String,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable +as Module, + )); +} + + +} + +// dart format on diff --git a/packages/auth/lib/data/models/local/user_local/user_local_model.dart b/packages/auth/lib/data/models/local/user_local/user_local_model.dart index 403f762..c14addc 100644 --- a/packages/auth/lib/data/models/local/user_local/user_local_model.dart +++ b/packages/auth/lib/data/models/local/user_local/user_local_model.dart @@ -1,3 +1,4 @@ +import 'package:rasadyar_auth/auth.dart'; import 'package:rasadyar_core/core.dart'; part 'user_local_model.g.dart'; @@ -15,12 +16,16 @@ class UserLocalModel extends HiveObject { @HiveField(4) String? name; + @HiveField(5) + Module? module; + UserLocalModel({ this.username, this.password, this.token, this.refreshToken, this.name, + this.module, }); UserLocalModel copyWith({ @@ -29,6 +34,7 @@ class UserLocalModel extends HiveObject { String? token, String? refreshToken, String? name, + Module? module, }) { return UserLocalModel( username: username ?? this.username, @@ -36,6 +42,15 @@ class UserLocalModel extends HiveObject { token: token ?? this.token, refreshToken: refreshToken ?? this.refreshToken, name: name ?? this.name, + module: module ?? this.module, ); } } + +@HiveType(typeId: 1) +enum Module { + @HiveField(0) + liveStocks, + @HiveField(1) + inspection, +} diff --git a/packages/auth/lib/data/models/local/user_local/user_local_model.g.dart b/packages/auth/lib/data/models/local/user_local/user_local_model.g.dart index 13f86a8..efaac19 100644 --- a/packages/auth/lib/data/models/local/user_local/user_local_model.g.dart +++ b/packages/auth/lib/data/models/local/user_local/user_local_model.g.dart @@ -22,13 +22,14 @@ class UserLocalModelAdapter extends TypeAdapter { token: fields[2] as String?, refreshToken: fields[3] as String?, name: fields[4] as String?, + module: fields[5] as Module?, ); } @override void write(BinaryWriter writer, UserLocalModel obj) { writer - ..writeByte(5) + ..writeByte(6) ..writeByte(0) ..write(obj.username) ..writeByte(1) @@ -38,7 +39,9 @@ class UserLocalModelAdapter extends TypeAdapter { ..writeByte(3) ..write(obj.refreshToken) ..writeByte(4) - ..write(obj.name); + ..write(obj.name) + ..writeByte(5) + ..write(obj.module); } @override @@ -51,3 +54,40 @@ class UserLocalModelAdapter extends TypeAdapter { runtimeType == other.runtimeType && typeId == other.typeId; } + +class ModuleAdapter extends TypeAdapter { + @override + final typeId = 1; + + @override + Module read(BinaryReader reader) { + switch (reader.readByte()) { + case 0: + return Module.liveStocks; + case 1: + return Module.inspection; + default: + return Module.liveStocks; + } + } + + @override + void write(BinaryWriter writer, Module obj) { + switch (obj) { + case Module.liveStocks: + writer.writeByte(0); + case Module.inspection: + writer.writeByte(1); + } + } + + @override + int get hashCode => typeId.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ModuleAdapter && + runtimeType == other.runtimeType && + typeId == other.typeId; +} diff --git a/packages/auth/lib/data/services/token_storage_service.dart b/packages/auth/lib/data/services/token_storage_service.dart index 78fc35b..39d33dd 100644 --- a/packages/auth/lib/data/services/token_storage_service.dart +++ b/packages/auth/lib/data/services/token_storage_service.dart @@ -1,20 +1,26 @@ import 'dart:convert'; +import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart'; +import 'package:rasadyar_auth/hive_registrar.g.dart'; import 'package:rasadyar_core/core.dart'; class TokenStorageService extends GetxService { static const String _boxName = 'secureBox'; static const String _accessTokenKey = 'accessToken'; static const String _refreshTokenKey = 'refreshToken'; + static const String _moduleKey = 'moduleSelected'; final FlutterSecureStorage _secureStorage = FlutterSecureStorage(); final HiveLocalStorage _localStorage = diCore.get(); - RxnString accessToken = RxnString(); - RxnString refreshToken = RxnString(); - RxnString tsss = RxnString(); + RxnString accessToken = RxnString(); + RxnString refreshToken = RxnString(); + Rxn appModule = Rxn(null); Future init() async { + Hive.registerAdapters(); + IsolatedHive.registerAdapters(); + final String? encryptedKey = await _secureStorage.read(key: 'hive_enc_key'); final encryptionKey = encryptedKey != null @@ -42,6 +48,10 @@ class TokenStorageService extends GetxService { boxName: _boxName, key: _refreshTokenKey, ); + appModule.value = _localStorage.read( + boxName: _boxName, + key: _moduleKey, + ); } Future saveAccessToken(String token) async { @@ -64,6 +74,12 @@ class TokenStorageService extends GetxService { refreshToken.refresh(); } + Future saveModule(Module input) async { + await _localStorage.save(boxName: _boxName, key: _moduleKey, value: input); + appModule.value = input; + appModule.refresh(); + } + Future deleteTokens() async { await _localStorage.clear(_boxName); accessToken.value = null; diff --git a/packages/auth/lib/hive_registrar.g.dart b/packages/auth/lib/hive_registrar.g.dart index b4abe2c..166b5cb 100644 --- a/packages/auth/lib/hive_registrar.g.dart +++ b/packages/auth/lib/hive_registrar.g.dart @@ -7,12 +7,14 @@ import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart extension HiveRegistrar on HiveInterface { void registerAdapters() { + registerAdapter(ModuleAdapter()); registerAdapter(UserLocalModelAdapter()); } } extension IsolatedHiveRegistrar on IsolatedHiveInterface { void registerAdapters() { + registerAdapter(ModuleAdapter()); registerAdapter(UserLocalModelAdapter()); } } diff --git a/packages/auth/lib/presentation/pages/auth/logic.dart b/packages/auth/lib/presentation/pages/auth/logic.dart index eacfb7c..59b8167 100644 --- a/packages/auth/lib/presentation/pages/auth/logic.dart +++ b/packages/auth/lib/presentation/pages/auth/logic.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:rasadyar_auth/auth.dart'; import 'package:rasadyar_auth/data/common/dio_error_handler.dart'; +import 'package:rasadyar_auth/data/models/local/module/module_model.dart'; import 'package:rasadyar_auth/data/models/request/login_request/login_request_model.dart'; import 'package:rasadyar_auth/data/models/response/auth/auth_response_model.dart'; import 'package:rasadyar_auth/data/repositories/auth_repository_imp.dart'; @@ -10,6 +11,8 @@ import 'package:rasadyar_auth/data/services/token_storage_service.dart'; import 'package:rasadyar_auth/presentation/widget/captcha/logic.dart'; import 'package:rasadyar_core/core.dart'; +import '../../../data/models/local/user_local/user_local_model.dart'; + enum AuthType { useAndPass, otp } enum AuthStatus { init } @@ -42,6 +45,8 @@ class AuthLogic extends GetxController { AuthRepositoryImpl authRepository = diAuth.get(); + final Module _module = Get.arguments; + void startTimer() { _timer?.cancel(); secondsRemaining.value = 120; @@ -73,8 +78,8 @@ class AuthLogic extends GetxController { @override void onReady() { - // TODO: implement onReady super.onReady(); + iLog('module111 : ${_module.toString()}'); } @override @@ -106,14 +111,16 @@ class AuthLogic extends GetxController { Future submitLoginForm() async { if (!_isFormValid()) return; - + iLog('module222 : ${_module.toString()}'); final loginRequestModel = _buildLoginRequest(); isLoading.value = true; await safeCall( call: () => authRepository.login(authRequest: loginRequestModel.toJson()), onSuccess: (result) async { - await tokenStorageService.saveRefreshToken(result!.refresh!); - await tokenStorageService.saveAccessToken(result!.access!); + await tokenStorageService.saveModule(_module); + await tokenStorageService.saveRefreshToken(result?.refresh ?? ''); + await tokenStorageService.saveAccessToken(result?.access ?? ''); + //Get.offAndToNamed(Routes.home); }, onError: (error, stackTrace) { diff --git a/packages/auth/lib/presentation/pages/auth/view.dart b/packages/auth/lib/presentation/pages/auth/view.dart index 90f764c..343c050 100644 --- a/packages/auth/lib/presentation/pages/auth/view.dart +++ b/packages/auth/lib/presentation/pages/auth/view.dart @@ -109,7 +109,10 @@ class AuthPage extends GetView { }, prefixIcon: Padding( padding: const EdgeInsets.fromLTRB(0, 8, 6, 8), - child: vecWidget(Assets.vecCallSvg), + child: Assets.vec.callSvg.svg( + width: 12, + height: 12, + ), ), suffixIcon: phoneController.value.text @@ -168,7 +171,10 @@ class AuthPage extends GetView { labelStyle: AppFonts.yekan13, prefixIcon: Padding( padding: const EdgeInsets.fromLTRB(0, 8, 8, 8), - child: vecWidget(Assets.vecKeySvg), + child: Assets.vec.keySvg.svg( + width: 12, + height: 12, + ), ), boxConstraints: const BoxConstraints( maxHeight: 34, diff --git a/packages/auth/lib/presentation/pages/modules/logic.dart b/packages/auth/lib/presentation/pages/modules/logic.dart index 87c35ee..bf9692c 100644 --- a/packages/auth/lib/presentation/pages/modules/logic.dart +++ b/packages/auth/lib/presentation/pages/modules/logic.dart @@ -1,7 +1,16 @@ +import 'package:rasadyar_auth/data/models/local/module/module_model.dart'; +import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart'; import 'package:rasadyar_core/core.dart'; class ModulesLogic extends GetxController { + List moduleList=[ + ModuleModel(title: 'بازرسی', icon: Assets.icons.inspection.path, module: Module.inspection), + ModuleModel(title: 'دام', icon: Assets.icons.liveStock.path, module: Module.liveStocks), + ]; + + + RxnInt selectedIndex = RxnInt(null); @override @@ -9,6 +18,9 @@ class ModulesLogic extends GetxController { super.onReady(); } + + + @override void onClose() { super.onClose(); diff --git a/packages/auth/lib/presentation/pages/modules/view.dart b/packages/auth/lib/presentation/pages/modules/view.dart index f1c4a0b..e3ebe32 100644 --- a/packages/auth/lib/presentation/pages/modules/view.dart +++ b/packages/auth/lib/presentation/pages/modules/view.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:get/get.dart'; +import 'package:rasadyar_auth/presentation/routes/pages.dart'; +import 'package:rasadyar_core/core.dart'; import 'logic.dart'; @@ -8,8 +9,37 @@ class ModulesPage extends GetView { @override Widget build(BuildContext context) { - final ModulesLogic logic = Get.put(ModulesLogic()); + return Scaffold( + appBar: AppBar( + title: Text( + 'انتخاب سامانه', + style: AppFonts.yekan18.copyWith(color: Colors.white), + ), + centerTitle: true, + backgroundColor: AppColor.blueNormal, + ), + body: GridView.builder( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 20), - return Container(); + itemBuilder: (context, index) { + final module = controller.moduleList[index]; + return CardIcon( + title: module.title, + icon: module.icon, + onTap: () { + controller.selectedIndex.value = index; + Get.toNamed(AuthPaths.auth, arguments: module.module); + }, + ); + }, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + mainAxisSpacing: 10, + crossAxisSpacing: 10, + ), + physics: BouncingScrollPhysics(), + itemCount: controller.moduleList.length, + ), + ); } } diff --git a/packages/auth/lib/presentation/routes/pages.dart b/packages/auth/lib/presentation/routes/pages.dart index 11b8d56..5248b3d 100644 --- a/packages/auth/lib/presentation/routes/pages.dart +++ b/packages/auth/lib/presentation/routes/pages.dart @@ -1,3 +1,5 @@ +import 'package:rasadyar_auth/presentation/pages/modules/logic.dart'; +import 'package:rasadyar_auth/presentation/pages/modules/view.dart'; import 'package:rasadyar_auth/presentation/widget/captcha/logic.dart'; import 'package:rasadyar_core/core.dart'; @@ -12,10 +14,9 @@ sealed class AuthPages { static List pages = [ GetPage( name: AuthPaths.moduleList, - page: () => AuthPage(), + page: () => ModulesPage(), binding: BindingsBuilder(() { - Get.lazyPut(() => AuthLogic()); - Get.lazyPut(() => CaptchaWidgetLogic()); + Get.lazyPut(() => ModulesLogic()); }), ), diff --git a/packages/auth/lib/presentation/widget/logo_widget.dart b/packages/auth/lib/presentation/widget/logo_widget.dart index ea4a5a9..4cf2a26 100644 --- a/packages/auth/lib/presentation/widget/logo_widget.dart +++ b/packages/auth/lib/presentation/widget/logo_widget.dart @@ -9,7 +9,10 @@ class LogoWidget extends StatelessWidget { return Column( children: [ Row(), - Image.asset(Assets.imagesInnerSplash, width: 120, height: 120), + Assets.images.innerSplash.image( + width: 150, + height: 150, + ), Text( 'سامانه رصدیار', style: AppFonts.yekan16.copyWith(color: AppColor.darkGreyNormal), diff --git a/packages/core/lib/core.dart b/packages/core/lib/core.dart index 6108fd6..f4318ec 100644 --- a/packages/core/lib/core.dart +++ b/packages/core/lib/core.dart @@ -1,5 +1,6 @@ library; + //other packages export 'package:flutter_localizations/flutter_localizations.dart'; export 'package:flutter_map/flutter_map.dart'; @@ -7,6 +8,7 @@ export 'package:flutter_map_animations/flutter_map_animations.dart'; export 'package:flutter_rating_bar/flutter_rating_bar.dart'; export 'package:flutter_slidable/flutter_slidable.dart'; export 'package:font_awesome_flutter/font_awesome_flutter.dart'; +export 'package:hive_ce_flutter/hive_flutter.dart'; //freezed export 'package:freezed_annotation/freezed_annotation.dart'; export 'package:geolocator/geolocator.dart'; diff --git a/packages/core/lib/presentation/common/assets.dart b/packages/core/lib/presentation/common/assets.dart deleted file mode 100644 index 0e70b14..0000000 --- a/packages/core/lib/presentation/common/assets.dart +++ /dev/null @@ -1,72 +0,0 @@ -///This file is automatically generated. DO NOT EDIT, all your changes would be lost. -class Assets { - Assets._(); - - static const String iconsAdd = 'assets/icons/add.svg'; - static const String iconsArrowLeft = 'assets/icons/arrow_left.svg'; - static const String iconsArrowRight = 'assets/icons/arrow_right.svg'; - static const String iconsBgHeaderUserProfile = 'assets/icons/bg_header_user_profile.svg'; - static const String iconsCalendar = 'assets/icons/calendar.svg'; - static const String iconsCalendarSearch = 'assets/icons/calendar_search.svg'; - static const String iconsCall = 'assets/icons/call.svg'; - static const String iconsDiagram = 'assets/icons/diagram.svg'; - static const String iconsDownload = 'assets/icons/download.svg'; - static const String iconsEdit = 'assets/icons/edit.svg'; - static const String iconsExcelDownload = 'assets/icons/excel_download.svg'; - static const String iconsFilter = 'assets/icons/filter.svg'; - static const String iconsGps = 'assets/icons/gps.svg'; - static const String iconsInformation = 'assets/icons/information.svg'; - static const String iconsKey = 'assets/icons/key.svg'; - static const String iconsLogout = 'assets/icons/logout.svg'; - static const String iconsMap = 'assets/icons/map.svg'; - static const String iconsMapMarker = 'assets/icons/map_marker.svg'; - static const String iconsMessageAdd = 'assets/icons/message_add.svg'; - static const String iconsPdfDownload = 'assets/icons/pdf_download.svg'; - static const String iconsPictureFrame = 'assets/icons/picture_frame.svg'; - static const String iconsProfileCircle = 'assets/icons/profile_circle.svg'; - static const String iconsProfileUser = 'assets/icons/profile_user.svg'; - static const String iconsReceiptDiscount = 'assets/icons/receipt_discount.svg'; - static const String iconsScan = 'assets/icons/scan.svg'; - static const String iconsScanBarcode = 'assets/icons/scan_barcode.svg'; - static const String iconsSecurityTime = 'assets/icons/security_time.svg'; - static const String iconsSetting = 'assets/icons/setting.svg'; - static const String iconsTagUser = 'assets/icons/tag_user.svg'; - static const String iconsTrash = 'assets/icons/trash.svg'; - static const String iconsUser = 'assets/icons/user.svg'; - static const String iconsUserSquare = 'assets/icons/user_square.svg'; - static const String imagesInnerSplash = 'assets/images/inner_splash.webp'; - static const String imagesOutterSplash = 'assets/images/outter_splash.webp'; - static const String vecAddSvg = 'assets/vec/add.svg.vec'; - static const String vecArrowLeftSvg = 'assets/vec/arrow_left.svg.vec'; - static const String vecArrowRightSvg = 'assets/vec/arrow_right.svg.vec'; - static const String vecBgHeaderUserProfileSvg = 'assets/vec/bg_header_user_profile.svg.vec'; - static const String vecCalendarSearchSvg = 'assets/vec/calendar_search.svg.vec'; - static const String vecCalendarSvg = 'assets/vec/calendar.svg.vec'; - static const String vecCallSvg = 'assets/vec/call.svg.vec'; - static const String vecDiagramSvg = 'assets/vec/diagram.svg.vec'; - static const String vecDownloadSvg = 'assets/vec/download.svg.vec'; - static const String vecEditSvg = 'assets/vec/edit.svg.vec'; - static const String vecExcelDownloadSvg = 'assets/vec/excel_download.svg.vec'; - static const String vecFilterSvg = 'assets/vec/filter.svg.vec'; - static const String vecGpsSvg = 'assets/vec/gps.svg.vec'; - static const String vecInformationSvg = 'assets/vec/information.svg.vec'; - static const String vecKeySvg = 'assets/vec/key.svg.vec'; - static const String vecLogoutSvg = 'assets/vec/logout.svg.vec'; - static const String vecMapMarkerSvg = 'assets/vec/map_marker.svg.vec'; - static const String vecMapSvg = 'assets/vec/map.svg.vec'; - static const String vecMessageAddSvg = 'assets/vec/message_add.svg.vec'; - static const String vecPdfDownloadSvg = 'assets/vec/pdf_download.svg.vec'; - static const String vecPictureFrameSvg = 'assets/vec/picture_frame.svg.vec'; - static const String vecProfileCircleSvg = 'assets/vec/profile_circle.svg.vec'; - static const String vecProfileUserSvg = 'assets/vec/profile_user.svg.vec'; - static const String vecReceiptDiscountSvg = 'assets/vec/receipt_discount.svg.vec'; - static const String vecScanBarcodeSvg = 'assets/vec/scan_barcode.svg.vec'; - static const String vecScanSvg = 'assets/vec/scan.svg.vec'; - static const String vecSecurityTimeSvg = 'assets/vec/security_time.svg.vec'; - static const String vecSettingSvg = 'assets/vec/setting.svg.vec'; - static const String vecTagUserSvg = 'assets/vec/tag_user.svg.vec'; - static const String vecTrashSvg = 'assets/vec/trash.svg.vec'; - static const String vecUserSquareSvg = 'assets/vec/user_square.svg.vec'; - static const String vecUserSvg = 'assets/vec/user.svg.vec'; - -} diff --git a/packages/core/lib/presentation/common/assets.gen.dart b/packages/core/lib/presentation/common/assets.gen.dart new file mode 100644 index 0000000..3ae3076 --- /dev/null +++ b/packages/core/lib/presentation/common/assets.gen.dart @@ -0,0 +1,451 @@ +/// GENERATED CODE - DO NOT MODIFY BY HAND +/// ***************************************************** +/// FlutterGen +/// ***************************************************** + +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use + +import 'package:flutter/services.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/flutter_svg.dart' as _svg; +import 'package:vector_graphics/vector_graphics.dart' as _vg; + +class $AssetsIconsGen { + const $AssetsIconsGen(); + + /// File path: assets/icons/add.svg + SvgGenImage get add => const SvgGenImage('assets/icons/add.svg'); + + /// File path: assets/icons/arrow_left.svg + SvgGenImage get arrowLeft => const SvgGenImage('assets/icons/arrow_left.svg'); + + /// File path: assets/icons/arrow_right.svg + SvgGenImage get arrowRight => const SvgGenImage('assets/icons/arrow_right.svg'); + + /// File path: assets/icons/bg_header_user_profile.svg + SvgGenImage get bgHeaderUserProfile => const SvgGenImage('assets/icons/bg_header_user_profile.svg'); + + /// File path: assets/icons/calendar.svg + SvgGenImage get calendar => const SvgGenImage('assets/icons/calendar.svg'); + + /// File path: assets/icons/calendar_search.svg + SvgGenImage get calendarSearch => const SvgGenImage('assets/icons/calendar_search.svg'); + + /// File path: assets/icons/call.svg + SvgGenImage get call => const SvgGenImage('assets/icons/call.svg'); + + /// File path: assets/icons/diagram.svg + SvgGenImage get diagram => const SvgGenImage('assets/icons/diagram.svg'); + + /// File path: assets/icons/download.svg + SvgGenImage get download => const SvgGenImage('assets/icons/download.svg'); + + /// File path: assets/icons/edit.svg + SvgGenImage get edit => const SvgGenImage('assets/icons/edit.svg'); + + /// File path: assets/icons/excel_download.svg + SvgGenImage get excelDownload => const SvgGenImage('assets/icons/excel_download.svg'); + + /// File path: assets/icons/filter.svg + SvgGenImage get filter => const SvgGenImage('assets/icons/filter.svg'); + + /// File path: assets/icons/gps.svg + SvgGenImage get gps => const SvgGenImage('assets/icons/gps.svg'); + + /// File path: assets/icons/information.svg + SvgGenImage get information => const SvgGenImage('assets/icons/information.svg'); + + /// File path: assets/icons/inspection.svg + SvgGenImage get inspection => const SvgGenImage('assets/icons/inspection.svg'); + + /// File path: assets/icons/key.svg + SvgGenImage get key => const SvgGenImage('assets/icons/key.svg'); + + /// File path: assets/icons/liveStock.svg + SvgGenImage get liveStock => const SvgGenImage('assets/icons/liveStock.svg'); + + /// File path: assets/icons/logout.svg + SvgGenImage get logout => const SvgGenImage('assets/icons/logout.svg'); + + /// File path: assets/icons/map.svg + SvgGenImage get map => const SvgGenImage('assets/icons/map.svg'); + + /// File path: assets/icons/map_marker.svg + SvgGenImage get mapMarker => const SvgGenImage('assets/icons/map_marker.svg'); + + /// File path: assets/icons/message_add.svg + SvgGenImage get messageAdd => const SvgGenImage('assets/icons/message_add.svg'); + + /// File path: assets/icons/pdf_download.svg + SvgGenImage get pdfDownload => const SvgGenImage('assets/icons/pdf_download.svg'); + + /// File path: assets/icons/picture_frame.svg + SvgGenImage get pictureFrame => const SvgGenImage('assets/icons/picture_frame.svg'); + + /// File path: assets/icons/profile_circle.svg + SvgGenImage get profileCircle => const SvgGenImage('assets/icons/profile_circle.svg'); + + /// File path: assets/icons/profile_user.svg + SvgGenImage get profileUser => const SvgGenImage('assets/icons/profile_user.svg'); + + /// File path: assets/icons/receipt_discount.svg + SvgGenImage get receiptDiscount => const SvgGenImage('assets/icons/receipt_discount.svg'); + + /// File path: assets/icons/scan.svg + SvgGenImage get scan => const SvgGenImage('assets/icons/scan.svg'); + + /// File path: assets/icons/scan_barcode.svg + SvgGenImage get scanBarcode => const SvgGenImage('assets/icons/scan_barcode.svg'); + + /// File path: assets/icons/security_time.svg + SvgGenImage get securityTime => const SvgGenImage('assets/icons/security_time.svg'); + + /// File path: assets/icons/setting.svg + SvgGenImage get setting => const SvgGenImage('assets/icons/setting.svg'); + + /// File path: assets/icons/tag_user.svg + SvgGenImage get tagUser => const SvgGenImage('assets/icons/tag_user.svg'); + + /// File path: assets/icons/trash.svg + SvgGenImage get trash => const SvgGenImage('assets/icons/trash.svg'); + + /// File path: assets/icons/user.svg + SvgGenImage get user => const SvgGenImage('assets/icons/user.svg'); + + /// File path: assets/icons/user_square.svg + SvgGenImage get userSquare => const SvgGenImage('assets/icons/user_square.svg'); + + /// List of all assets + List get values => [ + add, + arrowLeft, + arrowRight, + bgHeaderUserProfile, + calendar, + calendarSearch, + call, + diagram, + download, + edit, + excelDownload, + filter, + gps, + information, + inspection, + key, + liveStock, + logout, + map, + mapMarker, + messageAdd, + pdfDownload, + pictureFrame, + profileCircle, + profileUser, + receiptDiscount, + scan, + scanBarcode, + securityTime, + setting, + tagUser, + trash, + user, + userSquare, + ]; +} + +class $AssetsImagesGen { + const $AssetsImagesGen(); + + /// File path: assets/images/inner_splash.webp + AssetGenImage get innerSplash => const AssetGenImage('assets/images/inner_splash.webp'); + + /// File path: assets/images/outter_splash.webp + AssetGenImage get outterSplash => const AssetGenImage('assets/images/outter_splash.webp'); + + /// List of all assets + List get values => [innerSplash, outterSplash]; +} + +class $AssetsVecGen { + const $AssetsVecGen(); + + /// File path: assets/vec/add.svg.vec + SvgGenImage get addSvg => const SvgGenImage.vec('assets/vec/add.svg.vec'); + + /// File path: assets/vec/arrow_left.svg.vec + SvgGenImage get arrowLeftSvg => const SvgGenImage.vec('assets/vec/arrow_left.svg.vec'); + + /// File path: assets/vec/arrow_right.svg.vec + SvgGenImage get arrowRightSvg => const SvgGenImage.vec('assets/vec/arrow_right.svg.vec'); + + /// File path: assets/vec/bg_header_user_profile.svg.vec + SvgGenImage get bgHeaderUserProfileSvg => const SvgGenImage.vec('assets/vec/bg_header_user_profile.svg.vec'); + + /// File path: assets/vec/calendar.svg.vec + SvgGenImage get calendarSvg => const SvgGenImage.vec('assets/vec/calendar.svg.vec'); + + /// File path: assets/vec/calendar_search.svg.vec + SvgGenImage get calendarSearchSvg => const SvgGenImage.vec('assets/vec/calendar_search.svg.vec'); + + /// File path: assets/vec/call.svg.vec + SvgGenImage get callSvg => const SvgGenImage.vec('assets/vec/call.svg.vec'); + + /// File path: assets/vec/diagram.svg.vec + SvgGenImage get diagramSvg => const SvgGenImage.vec('assets/vec/diagram.svg.vec'); + + /// File path: assets/vec/download.svg.vec + SvgGenImage get downloadSvg => const SvgGenImage.vec('assets/vec/download.svg.vec'); + + /// File path: assets/vec/edit.svg.vec + SvgGenImage get editSvg => const SvgGenImage.vec('assets/vec/edit.svg.vec'); + + /// File path: assets/vec/excel_download.svg.vec + SvgGenImage get excelDownloadSvg => const SvgGenImage.vec('assets/vec/excel_download.svg.vec'); + + /// File path: assets/vec/filter.svg.vec + SvgGenImage get filterSvg => const SvgGenImage.vec('assets/vec/filter.svg.vec'); + + /// File path: assets/vec/gps.svg.vec + SvgGenImage get gpsSvg => const SvgGenImage.vec('assets/vec/gps.svg.vec'); + + /// File path: assets/vec/information.svg.vec + SvgGenImage get informationSvg => const SvgGenImage.vec('assets/vec/information.svg.vec'); + + /// File path: assets/vec/inspection.svg.vec + SvgGenImage get inspectionSvg => const SvgGenImage.vec('assets/vec/inspection.svg.vec'); + + /// File path: assets/vec/key.svg.vec + SvgGenImage get keySvg => const SvgGenImage.vec('assets/vec/key.svg.vec'); + + /// File path: assets/vec/liveStock.svg.vec + SvgGenImage get liveStockSvg => const SvgGenImage.vec('assets/vec/liveStock.svg.vec'); + + /// File path: assets/vec/logout.svg.vec + SvgGenImage get logoutSvg => const SvgGenImage.vec('assets/vec/logout.svg.vec'); + + /// File path: assets/vec/map.svg.vec + SvgGenImage get mapSvg => const SvgGenImage.vec('assets/vec/map.svg.vec'); + + /// File path: assets/vec/map_marker.svg.vec + SvgGenImage get mapMarkerSvg => const SvgGenImage.vec('assets/vec/map_marker.svg.vec'); + + /// File path: assets/vec/message_add.svg.vec + SvgGenImage get messageAddSvg => const SvgGenImage.vec('assets/vec/message_add.svg.vec'); + + /// File path: assets/vec/pdf_download.svg.vec + SvgGenImage get pdfDownloadSvg => const SvgGenImage.vec('assets/vec/pdf_download.svg.vec'); + + /// File path: assets/vec/picture_frame.svg.vec + SvgGenImage get pictureFrameSvg => const SvgGenImage.vec('assets/vec/picture_frame.svg.vec'); + + /// File path: assets/vec/profile_circle.svg.vec + SvgGenImage get profileCircleSvg => const SvgGenImage.vec('assets/vec/profile_circle.svg.vec'); + + /// File path: assets/vec/profile_user.svg.vec + SvgGenImage get profileUserSvg => const SvgGenImage.vec('assets/vec/profile_user.svg.vec'); + + /// File path: assets/vec/receipt_discount.svg.vec + SvgGenImage get receiptDiscountSvg => const SvgGenImage.vec('assets/vec/receipt_discount.svg.vec'); + + /// File path: assets/vec/scan.svg.vec + SvgGenImage get scanSvg => const SvgGenImage.vec('assets/vec/scan.svg.vec'); + + /// File path: assets/vec/scan_barcode.svg.vec + SvgGenImage get scanBarcodeSvg => const SvgGenImage.vec('assets/vec/scan_barcode.svg.vec'); + + /// File path: assets/vec/security_time.svg.vec + SvgGenImage get securityTimeSvg => const SvgGenImage.vec('assets/vec/security_time.svg.vec'); + + /// File path: assets/vec/setting.svg.vec + SvgGenImage get settingSvg => const SvgGenImage.vec('assets/vec/setting.svg.vec'); + + /// File path: assets/vec/tag_user.svg.vec + SvgGenImage get tagUserSvg => const SvgGenImage.vec('assets/vec/tag_user.svg.vec'); + + /// File path: assets/vec/trash.svg.vec + SvgGenImage get trashSvg => const SvgGenImage.vec('assets/vec/trash.svg.vec'); + + /// File path: assets/vec/user.svg.vec + SvgGenImage get userSvg => const SvgGenImage.vec('assets/vec/user.svg.vec'); + + /// File path: assets/vec/user_square.svg.vec + SvgGenImage get userSquareSvg => const SvgGenImage.vec('assets/vec/user_square.svg.vec'); + + /// List of all assets + List get values => [ + addSvg, + arrowLeftSvg, + arrowRightSvg, + bgHeaderUserProfileSvg, + calendarSvg, + calendarSearchSvg, + callSvg, + diagramSvg, + downloadSvg, + editSvg, + excelDownloadSvg, + filterSvg, + gpsSvg, + informationSvg, + inspectionSvg, + keySvg, + liveStockSvg, + logoutSvg, + mapSvg, + mapMarkerSvg, + messageAddSvg, + pdfDownloadSvg, + pictureFrameSvg, + profileCircleSvg, + profileUserSvg, + receiptDiscountSvg, + scanSvg, + scanBarcodeSvg, + securityTimeSvg, + settingSvg, + tagUserSvg, + trashSvg, + userSvg, + userSquareSvg, + ]; +} + +class Assets { + const Assets._(); + + static const $AssetsIconsGen icons = $AssetsIconsGen(); + static const $AssetsImagesGen images = $AssetsImagesGen(); + static const $AssetsVecGen vec = $AssetsVecGen(); +} + +class AssetGenImage { + const AssetGenImage(this._assetName, {this.size, this.flavors = const {}}); + + final String _assetName; + + final Size? size; + final Set flavors; + + Image image({ + Key? key, + AssetBundle? bundle, + ImageFrameBuilder? frameBuilder, + ImageErrorWidgetBuilder? errorBuilder, + String? semanticLabel, + bool excludeFromSemantics = false, + double? scale, + double? width, + double? height, + Color? color, + Animation? opacity, + BlendMode? colorBlendMode, + BoxFit? fit, + AlignmentGeometry alignment = Alignment.center, + ImageRepeat repeat = ImageRepeat.noRepeat, + Rect? centerSlice, + bool matchTextDirection = false, + bool gaplessPlayback = true, + bool isAntiAlias = false, + String? package, + FilterQuality filterQuality = FilterQuality.medium, + int? cacheWidth, + int? cacheHeight, + }) { + return Image.asset( + _assetName, + key: key, + bundle: bundle, + frameBuilder: frameBuilder, + errorBuilder: errorBuilder, + semanticLabel: semanticLabel, + excludeFromSemantics: excludeFromSemantics, + scale: scale, + width: width, + height: height, + color: color, + opacity: opacity, + colorBlendMode: colorBlendMode, + fit: fit, + alignment: alignment, + repeat: repeat, + centerSlice: centerSlice, + matchTextDirection: matchTextDirection, + gaplessPlayback: gaplessPlayback, + isAntiAlias: isAntiAlias, + package: package, + filterQuality: filterQuality, + cacheWidth: cacheWidth, + cacheHeight: cacheHeight, + ); + } + + ImageProvider provider({AssetBundle? bundle, String? package}) { + return AssetImage(_assetName, bundle: bundle, package: package); + } + + String get path => _assetName; + + String get keyName => _assetName; +} + +class SvgGenImage { + const SvgGenImage(this._assetName, {this.size, this.flavors = const {}}) : _isVecFormat = false; + + const SvgGenImage.vec(this._assetName, {this.size, this.flavors = const {}}) : _isVecFormat = true; + + final String _assetName; + final Size? size; + final Set flavors; + final bool _isVecFormat; + + _svg.SvgPicture svg({ + Key? key, + bool matchTextDirection = false, + AssetBundle? bundle, + String? package, + double? width, + double? height, + BoxFit fit = BoxFit.contain, + AlignmentGeometry alignment = Alignment.center, + bool allowDrawingOutsideViewBox = false, + WidgetBuilder? placeholderBuilder, + String? semanticsLabel, + bool excludeFromSemantics = false, + _svg.SvgTheme? theme, + ColorFilter? colorFilter, + Clip clipBehavior = Clip.hardEdge, + @deprecated Color? color, + @deprecated BlendMode colorBlendMode = BlendMode.srcIn, + @deprecated bool cacheColorFilter = false, + }) { + final _svg.BytesLoader loader; + if (_isVecFormat) { + loader = _vg.AssetBytesLoader(_assetName, assetBundle: bundle, packageName: package); + } else { + loader = _svg.SvgAssetLoader(_assetName, assetBundle: bundle, packageName: package, theme: theme); + } + return _svg.SvgPicture( + loader, + key: key, + matchTextDirection: matchTextDirection, + width: width, + height: height, + fit: fit, + alignment: alignment, + allowDrawingOutsideViewBox: allowDrawingOutsideViewBox, + placeholderBuilder: placeholderBuilder, + semanticsLabel: semanticsLabel, + excludeFromSemantics: excludeFromSemantics, + colorFilter: colorFilter ?? (color == null ? null : ColorFilter.mode(color, colorBlendMode)), + clipBehavior: clipBehavior, + cacheColorFilter: cacheColorFilter, + ); + } + + String get path => _assetName; + + String get keyName => _assetName; +} diff --git a/packages/core/lib/presentation/common/common.dart b/packages/core/lib/presentation/common/common.dart index c3e9fa3..36e4588 100644 --- a/packages/core/lib/presentation/common/common.dart +++ b/packages/core/lib/presentation/common/common.dart @@ -1,3 +1,3 @@ export 'app_color.dart'; export 'app_fonts.dart'; -export 'assets.dart'; +export 'assets.gen.dart'; diff --git a/packages/core/lib/presentation/common/fonts.gen.dart b/packages/core/lib/presentation/common/fonts.gen.dart new file mode 100644 index 0000000..66ad118 --- /dev/null +++ b/packages/core/lib/presentation/common/fonts.gen.dart @@ -0,0 +1,15 @@ +/// GENERATED CODE - DO NOT MODIFY BY HAND +/// ***************************************************** +/// FlutterGen +/// ***************************************************** + +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use + +class FontFamily { + FontFamily._(); + + /// Font family: yekan + static const String yekan = 'yekan'; +} diff --git a/packages/core/lib/presentation/widget/bottom_navigation/wave_bottom_navigation.dart b/packages/core/lib/presentation/widget/bottom_navigation/wave_bottom_navigation.dart index ddcc71f..f2b50b3 100644 --- a/packages/core/lib/presentation/widget/bottom_navigation/wave_bottom_navigation.dart +++ b/packages/core/lib/presentation/widget/bottom_navigation/wave_bottom_navigation.dart @@ -3,7 +3,7 @@ import 'package:rasadyar_core/core.dart'; class WaveBottomNavigationItem { final String title; - final String icon; + final Widget icon; WaveBottomNavigationItem({required this.title, required this.icon}); } @@ -112,12 +112,7 @@ class _WaveBottomNavigationState extends State { children: [ Tooltip( message: item.title, - child: vecWidget( - item.icon, - color: Colors.white, - width: 32, - height: 32, - ), + child: item.icon ), /* Visibility( diff --git a/packages/core/lib/presentation/widget/buttons/fab.dart b/packages/core/lib/presentation/widget/buttons/fab.dart index 3dfe651..200f0ab 100644 --- a/packages/core/lib/presentation/widget/buttons/fab.dart +++ b/packages/core/lib/presentation/widget/buttons/fab.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_core/presentation/common/app_color.dart'; -import 'package:rasadyar_core/presentation/common/assets.dart'; import 'package:rasadyar_core/presentation/utils/color_utils.dart'; -import 'package:rasadyar_core/presentation/widget/vec_widget.dart'; +import '../../common/assets.gen.dart'; class RFab extends StatefulWidget { final VoidCallback? onPressed; @@ -22,7 +21,10 @@ class RFab extends StatefulWidget { RFab.smallAdd({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecAddSvg), + icon: Assets.vec.addSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.greenNormal, key: key, ); @@ -30,7 +32,10 @@ class RFab extends StatefulWidget { RFab.add({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecAddSvg), + icon: Assets.vec.addSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.greenNormal, key: key, ); @@ -41,7 +46,10 @@ class RFab extends StatefulWidget { RFab.smallEdit({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecEditSvg), + icon: Assets.vec.addSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -49,7 +57,10 @@ class RFab extends StatefulWidget { RFab.edit({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecEditSvg), + icon: Assets.vec.addSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -60,7 +71,10 @@ class RFab extends StatefulWidget { RFab.smallDelete({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecTrashSvg), + icon: Assets.vec.trashSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.redNormal, key: key, ); @@ -68,7 +82,10 @@ class RFab extends StatefulWidget { RFab.delete({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecTrashSvg), + icon: Assets.vec.trashSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.redNormal, key: key, ); @@ -79,7 +96,10 @@ class RFab extends StatefulWidget { RFab.smallAction({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecScanSvg), + icon: Assets.vec.scanSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -87,7 +107,10 @@ class RFab extends StatefulWidget { RFab.action({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecScanSvg), + icon: Assets.vec.scanSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -98,7 +121,10 @@ class RFab extends StatefulWidget { RFab.smallFilter({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecFilterSvg), + icon: Assets.vec.scanSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -106,7 +132,10 @@ class RFab extends StatefulWidget { RFab.filter({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecFilterSvg), + icon: Assets.vec.scanSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -117,7 +146,10 @@ class RFab extends StatefulWidget { RFab.smallDownload({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecDownloadSvg), + icon: Assets.vec.downloadSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -125,7 +157,10 @@ class RFab extends StatefulWidget { RFab.download({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecDownloadSvg), + icon: Assets.vec.downloadSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -136,7 +171,10 @@ class RFab extends StatefulWidget { RFab.smallExcel({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecDownloadSvg), + icon: Assets.vec.excelDownloadSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.greenDark, key: key, ); @@ -144,7 +182,10 @@ class RFab extends StatefulWidget { RFab.excel({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecDownloadSvg), + icon: Assets.vec.excelDownloadSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.greenDark, key: key, ); @@ -155,7 +196,10 @@ class RFab extends StatefulWidget { RFab.smallBack({required VoidCallback? onPressed, Key? key}) : this.small( onPressed: onPressed, - icon: vecWidget(Assets.vecArrowLeftSvg), + icon: Assets.vec.arrowLeftSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); @@ -163,7 +207,10 @@ class RFab extends StatefulWidget { RFab.back({required VoidCallback? onPressed, Key? key}) : this( onPressed: onPressed, - icon: vecWidget(Assets.vecArrowLeftSvg), + icon: Assets.vec.arrowLeftSvg.svg( + width: 20, + height: 20, + ), backgroundColor: AppColor.blueNormal, key: key, ); diff --git a/packages/core/lib/presentation/widget/buttons/fab_outlined.dart b/packages/core/lib/presentation/widget/buttons/fab_outlined.dart index fc9f209..2b408bd 100644 --- a/packages/core/lib/presentation/widget/buttons/fab_outlined.dart +++ b/packages/core/lib/presentation/widget/buttons/fab_outlined.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:rasadyar_core/presentation/common/app_color.dart'; -import 'package:rasadyar_core/presentation/common/assets.dart'; +import 'package:rasadyar_core/presentation/common/assets.gen.dart'; import 'package:rasadyar_core/presentation/utils/color_utils.dart'; -import 'package:rasadyar_core/presentation/widget/vec_widget.dart'; class RFabOutlined extends StatefulWidget { final Widget icon; @@ -69,10 +68,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.greenNormal, borderColor: AppColor.greenNormal, - icon: vecWidget2( - Assets.vecAddSvg, - - color: AppColor.greenNormal, + icon: Assets.vec.addSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -81,12 +83,14 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.greenNormal, - icon: vecWidget( - Assets.vecAddSvg, - color: - onPressed != null - ? AppColor.greenNormal - : AppColor.greenNormal.disabledColor, + + icon: Assets.vec.addSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -96,12 +100,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.greenNormal, borderColor: AppColor.greenNormal, - icon: vecWidget( - Assets.vecAddSvg, - color: - onPressed != null - ? AppColor.greenNormal - : AppColor.greenNormal.disabledColor, + icon: Assets.vec.addSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -110,12 +115,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.greenNormal, - icon: vecWidget( - Assets.vecAddSvg, - color: - onPressed != null - ? AppColor.greenNormal - : AppColor.greenNormal.disabledColor, + icon: Assets.vec.addSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -128,12 +134,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecEditSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.editSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -142,12 +149,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecEditSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.editSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -157,12 +165,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecEditSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.editSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -171,12 +180,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecEditSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.editSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -189,12 +199,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.redNormal, borderColor: AppColor.redNormal, - icon: vecWidget( - Assets.vecTrashSvg, - color: - onPressed != null - ? AppColor.redNormal - : AppColor.redNormal.disabledColor, + icon: Assets.vec.trashSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.redNormal + : AppColor.redNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -203,12 +214,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.redNormal, - icon: vecWidget( - Assets.vecTrashSvg, - color: - onPressed != null - ? AppColor.redNormal - : AppColor.redNormal.disabledColor, + icon: Assets.vec.trashSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.redNormal + : AppColor.redNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -218,12 +230,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.redNormal, borderColor: AppColor.redNormal, - icon: vecWidget( - Assets.vecTrashSvg, - color: - onPressed != null - ? AppColor.redNormal - : AppColor.redNormal.disabledColor, + icon: Assets.vec.trashSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.redNormal + : AppColor.redNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -232,12 +245,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.redNormal, - icon: vecWidget( - Assets.vecTrashSvg, - color: - onPressed != null - ? AppColor.redNormal - : AppColor.redNormal.disabledColor, + icon: Assets.vec.trashSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.redNormal + : AppColor.redNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -250,12 +264,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecScanSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.scanSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -264,12 +279,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecScanSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.scanSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -279,12 +295,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecScanSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.scanSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -293,12 +310,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecScanSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.scanSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -311,12 +329,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecFilterSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.filterSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -325,12 +344,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecFilterSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.filterSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -340,12 +360,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecFilterSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.filterSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -354,12 +375,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecFilterSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.filterSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -372,12 +394,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.downloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -386,12 +409,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.downloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -401,12 +425,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.downloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -415,12 +440,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.downloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -433,12 +459,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.greenDark, borderColor: AppColor.greenDark, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.excelDownloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -447,12 +474,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.greenDark, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.excelDownloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -462,12 +490,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.greenDark, borderColor: AppColor.greenDark, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.excelDownloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -476,12 +505,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.greenDark, - icon: vecWidget( - Assets.vecDownloadSvg, - color: - onPressed != null - ? AppColor.greenDark - : AppColor.greenDark.disabledColor, + icon: Assets.vec.excelDownloadSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.greenNormal + : AppColor.greenNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -494,12 +524,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecArrowLeftSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.arrowLeftSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -508,12 +539,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecArrowLeftSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.arrowLeftSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -523,12 +555,13 @@ class RFabOutlined extends StatefulWidget { onPressed: onPressed, backgroundColor: AppColor.blueNormal, borderColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecArrowLeftSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.arrowLeftSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -537,12 +570,13 @@ class RFabOutlined extends StatefulWidget { key: key, onPressed: onPressed, backgroundColor: AppColor.blueNormal, - icon: vecWidget( - Assets.vecArrowLeftSvg, - color: - onPressed != null - ? AppColor.blueNormal - : AppColor.blueNormal.disabledColor, + icon: Assets.vec.arrowLeftSvg.svg( + colorFilter: ColorFilter.mode( + onPressed != null + ? AppColor.blueNormal + : AppColor.blueNormal.disabledColor, + BlendMode.srcIn, + ), ), ); @@ -550,11 +584,12 @@ class RFabOutlined extends StatefulWidget { } class _RFabOutlinedState extends State { - bool isOnPressed =false; + bool isOnPressed = false; + @override Widget build(BuildContext context) { return OutlinedButton( - onPressed:widget.onPressed , + onPressed: widget.onPressed, style: ButtonStyle( side: WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.disabled)) { @@ -598,8 +633,7 @@ class _RFabOutlinedState extends State { ), padding: WidgetStatePropertyAll(EdgeInsets.zero), ), - child: widget.icon + child: widget.icon, ); } } - diff --git a/packages/core/lib/presentation/widget/card/card_with_icon_with_border.dart b/packages/core/lib/presentation/widget/card/card_with_icon_with_border.dart new file mode 100644 index 0000000..510f146 --- /dev/null +++ b/packages/core/lib/presentation/widget/card/card_with_icon_with_border.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +class CardIcon extends StatelessWidget { + const CardIcon({ + super.key, + required this.title, + required this.icon, + this.onTap, + }); + + final String title; + final String icon; + final VoidCallback? onTap; + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + side: const BorderSide(color: AppColor.blueNormal, width: 1), + ), + child: Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.white, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgGenImage(icon).svg(width: 50, height: 50), + const SizedBox(height: 8), + Text( + title, + style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal), + ), + ], + ), + ), + ), + ); + } +} diff --git a/packages/core/lib/presentation/widget/vec_widget.dart b/packages/core/lib/presentation/widget/vec_widget.dart index 4bf8b36..12bcda6 100644 --- a/packages/core/lib/presentation/widget/vec_widget.dart +++ b/packages/core/lib/presentation/widget/vec_widget.dart @@ -22,7 +22,7 @@ SvgPicture vecWidget( } Widget vecWidgetWithOnTap({ - required String assets, + required Widget child, required VoidCallback onTap, double? width, double? height, @@ -31,14 +31,7 @@ Widget vecWidgetWithOnTap({ }) { return InkWell( onTap: onTap, - child: SvgPicture( - AssetBytesLoader(assets), - width: width, - height: height, - fit: fit ?? BoxFit.contain, - colorFilter: - color != null ? ColorFilter.mode(color, BlendMode.srcIn) : null, - ), + child: child ); } diff --git a/packages/core/lib/presentation/widget/widget.dart b/packages/core/lib/presentation/widget/widget.dart index 7175a76..0f3dc7b 100644 --- a/packages/core/lib/presentation/widget/widget.dart +++ b/packages/core/lib/presentation/widget/widget.dart @@ -14,3 +14,4 @@ export 'pagination/show_more.dart'; export 'tabs/new_tab.dart'; export 'tabs/tab.dart'; export 'vec_widget.dart'; +export 'card/card_with_icon_with_border.dart'; diff --git a/packages/core/pubspec.lock b/packages/core/pubspec.lock index 467a430..553ad9b 100644 --- a/packages/core/pubspec.lock +++ b/packages/core/pubspec.lock @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "7.4.4" + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.dev" + source: hosted + version: "4.0.7" args: dependency: transitive description: @@ -153,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" + color: + dependency: transitive + description: + name: color + sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb + url: "https://pub.dev" + source: hosted + version: "3.0.0" convert: dependency: transitive description: @@ -262,6 +278,22 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_gen_core: + dependency: transitive + description: + name: flutter_gen_core + sha256: "3eaa2d3d8be58267ac4cd5e215ac965dd23cae0410dc073de2e82e227be32bfc" + url: "https://pub.dev" + source: hosted + version: "5.10.0" + flutter_gen_runner: + dependency: "direct main" + description: + name: flutter_gen_runner + sha256: e74b4ead01df3e8f02e73a26ca856759dbbe8cb3fd60941ba9f4005cd0cd19c9 + url: "https://pub.dev" + source: hosted + version: "5.10.0" flutter_lints: dependency: "direct dev" description: @@ -493,6 +525,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + hashcodes: + dependency: transitive + description: + name: hashcodes + sha256: "80f9410a5b3c8e110c4b7604546034749259f5d6dcca63e0d3c17c9258f1a651" + url: "https://pub.dev" + source: hosted + version: "2.0.0" hive_ce: dependency: "direct main" description: @@ -541,6 +581,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" + image_size_getter: + dependency: transitive + description: + name: image_size_getter + sha256: "9a299e3af2ebbcfd1baf21456c3c884037ff524316c97d8e56035ea8fdf35653" + url: "https://pub.dev" + source: hosted + version: "2.4.0" intl: dependency: "direct main" description: @@ -885,6 +933,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" + posix: + dependency: transitive + description: + name: posix + sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 + url: "https://pub.dev" + source: hosted + version: "6.0.2" pretty_dio_logger: dependency: "direct main" description: diff --git a/packages/core/pubspec.yaml b/packages/core/pubspec.yaml index 1c25b27..a587f74 100644 --- a/packages/core/pubspec.yaml +++ b/packages/core/pubspec.yaml @@ -36,6 +36,9 @@ dependencies: flutter_svg: ^2.0.17 font_awesome_flutter: ^10.8.0 + #Generator + flutter_gen_runner: ^5.10.0 + ##state manger get: ^4.7.2 @@ -76,6 +79,7 @@ dev_dependencies: freezed: ^3.0.3 json_serializable: ^6.9.4 + ##test mocktail: ^1.0.4 get_test: ^4.0.1 @@ -85,3 +89,9 @@ dev_dependencies: flutter: uses-material-design: true + assets: + - assets/ + - assets/vec/ + - assets/icons/ + + diff --git a/packages/inspection/lib/presentation/action/view.dart b/packages/inspection/lib/presentation/action/view.dart index 1889549..a0d2ac5 100644 --- a/packages/inspection/lib/presentation/action/view.dart +++ b/packages/inspection/lib/presentation/action/view.dart @@ -3,7 +3,6 @@ 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'; @@ -113,7 +112,7 @@ class ActionPage extends GetView { children: [ Container( height: 32, - margin: EdgeInsets.symmetric(horizontal: 22,vertical: 10), + margin: EdgeInsets.symmetric(horizontal: 22, vertical: 10), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, @@ -161,13 +160,13 @@ class ActionPage extends GetView { mainAxisAlignment: MainAxisAlignment.end, children: [ vecWidgetWithOnTap( - assets: Assets.vecPdfDownloadSvg, + child: Assets.vec.pdfDownloadSvg.svg(), onTap: () {}, width: 64, height: 64, ), vecWidgetWithOnTap( - assets: Assets.vecExcelDownloadSvg, + child: Assets.vec.excelDownloadSvg.svg(), onTap: () {}, width: 64, height: 64, @@ -220,7 +219,7 @@ class ActionPage extends GetView { } Widget headerWidget({ - required String icon, + required Widget icon, required String title, required VoidCallback onTap, bool isSelected = false, @@ -240,12 +239,7 @@ class ActionPage extends GetView { borderRadius: BorderRadius.circular(8), ), ), - child: vecWidget( - icon, - width: 40, - height: 40, - color: AppColor.blueNormal, - ), + child: icon, ), Text( title, @@ -279,7 +273,10 @@ class ActionPage extends GetView { padding: EdgeInsets.all(16), borderRadius: BorderRadius.circular(8), autoClose: true, - child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24), + child: Assets.vec.trashSvg.svg( + width: 24, + height: 24, + ), ), ], ), @@ -372,7 +369,10 @@ class ActionPage extends GetView { bottomRight: Radius.circular(8), ), autoClose: true, - child: vecWidget(Assets.vecEditSvg, width: 24, height: 24), + child: Assets.vec.trashSvg.svg( + width: 24, + height: 24, + ), ), CustomSlidableAction( onPressed: (context) {}, @@ -384,7 +384,10 @@ class ActionPage extends GetView { bottomLeft: Radius.circular(8), ), autoClose: true, - child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24), + child: Assets.vec.trashSvg.svg( + width: 24, + height: 24, + ), ), ], ), @@ -492,7 +495,7 @@ class ActionPage extends GetView { spacing: 12, children: [ vecWidgetWithOnTap( - assets: Assets.vecEditSvg, + child: Assets.vec.editSvg.svg(), onTap: () {}, width: 24, height: 24, @@ -506,7 +509,7 @@ class ActionPage extends GetView { ), ), vecWidgetWithOnTap( - assets: Assets.vecTrashSvg, + child: Assets.vec.trashSvg.svg(), width: 24, height: 24, color: AppColor.redNormal, @@ -649,7 +652,7 @@ class ActionPage extends GetView { children: [ Row(), Padding( - padding: const EdgeInsets.symmetric(horizontal: 22,vertical: 10), + padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 10), child: Text( title, textAlign: TextAlign.center, diff --git a/packages/inspection/lib/presentation/add_mobile_inspector/view.dart b/packages/inspection/lib/presentation/add_mobile_inspector/view.dart index 61a9aba..c39030c 100644 --- a/packages/inspection/lib/presentation/add_mobile_inspector/view.dart +++ b/packages/inspection/lib/presentation/add_mobile_inspector/view.dart @@ -14,11 +14,13 @@ class AddMobileInspectorPage extends GetView { backgroundColor: AppColor.bgLight, appBar: RAppBar( title: 'افزودن بازرس همراه', - leading: vecWidget( - Assets.vecMessageAddSvg, - color: Colors.white, + leading: Assets.vec.messageAddSvg.svg( width: 16, height: 16, + colorFilter: ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), ), additionalActions: [ RFab.smallAdd(onPressed: () => controller.countInspector.value++), diff --git a/packages/inspection/lib/presentation/add_supervision/view.dart b/packages/inspection/lib/presentation/add_supervision/view.dart index 46738a1..89fa9bd 100644 --- a/packages/inspection/lib/presentation/add_supervision/view.dart +++ b/packages/inspection/lib/presentation/add_supervision/view.dart @@ -13,11 +13,13 @@ class AddSupervisionPage extends GetView { backgroundColor: AppColor.lightGreyLight, appBar: RAppBar( title: 'ایجاد بازرسی', - leading: vecWidget( - Assets.vecMessageAddSvg, - color: Colors.white, + leading: Assets.vec.messageAddSvg.svg( width: 16, height: 16, + colorFilter: ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), ), ), body: Column( diff --git a/packages/inspection/lib/presentation/display_information/view.dart b/packages/inspection/lib/presentation/display_information/view.dart index 3adbe1f..33f879a 100644 --- a/packages/inspection/lib/presentation/display_information/view.dart +++ b/packages/inspection/lib/presentation/display_information/view.dart @@ -12,11 +12,13 @@ class DisplayInformationPage extends GetView { backgroundColor: AppColor.bgLight, appBar: RAppBar( title: 'نمایش اطلاعات', - leading: vecWidget( - Assets.vecMessageAddSvg, - color: AppColor.blueNormal, + leading: Assets.vec.messageAddSvg.svg( width: 16, height: 16, + colorFilter: ColorFilter.mode( + AppColor.blueNormal, + BlendMode.srcIn, + ), ), ), diff --git a/packages/inspection/lib/presentation/filter/view.dart b/packages/inspection/lib/presentation/filter/view.dart index c8b2271..3f7ee39 100644 --- a/packages/inspection/lib/presentation/filter/view.dart +++ b/packages/inspection/lib/presentation/filter/view.dart @@ -74,7 +74,7 @@ class SupervisionFilterPage extends GetView { return RFab.small( backgroundColor: AppColor.greenNormal, isLoading: data.value, - icon: vecWidget(Assets.vecGpsSvg), + icon: Assets.vec.gpsSvg.svg(), onPressed: () async { controller.isLoading.value = true; await controller.determineCurrentPosition(); @@ -91,7 +91,7 @@ class SupervisionFilterPage extends GetView { bottom: 30, child: RFab.small( backgroundColor: AppColor.blueNormal, - icon: vecWidget(Assets.vecFilterSvg, width: 24, height: 24), + icon: Assets.vec.filterSvg.svg(width: 24,height: 24), onPressed: () => controller.filterBottomSheetController.toggle(), ), ); @@ -107,7 +107,10 @@ Marker markerWidget({required LatLng marker, required VoidCallback onTap}) { child: SizedBox( width: 36, height: 36, - child: vecWidget(Assets.vecMapMarkerSvg,width: 30,height: 30,), + child:Assets.vec.mapMarkerSvg.svg( + width: 30, + height: 30, + ) ), ), ); @@ -318,7 +321,7 @@ Widget markerDetailsWidget() { ), Spacer(), vecWidgetWithOnTap( - assets: Assets.vecMapSvg, + child: Assets.vec.mapSvg.svg(), onTap: () { Get.toNamed(InspectionRoutes.inspectionLocationDetails); }, @@ -327,7 +330,7 @@ Widget markerDetailsWidget() { color: AppColor.blueNormal, ), vecWidgetWithOnTap( - assets: Assets.vecMessageAddSvg, + child: Assets.vec.messageAddSvg.svg(), width: 24, height: 24, color: AppColor.greenNormal, @@ -337,7 +340,7 @@ Widget markerDetailsWidget() { ), vecWidgetWithOnTap( - assets: Assets.vecSecurityTimeSvg, + child: Assets.vec.securityTimeSvg.svg(), color: AppColor.warning, height: 24, width: 24, @@ -531,7 +534,7 @@ Widget selectedLocationWidget({ bottomRight: Radius.circular(8), topRight: Radius.circular(8), ), - child: vecWidget(Assets.vecMapSvg, width: 24, height: 24), + child: Assets.vec.mapSvg.svg( width: 24, height: 24), ), CustomSlidableAction( onPressed: (context) { @@ -539,7 +542,7 @@ Widget selectedLocationWidget({ }, backgroundColor: AppColor.greenNormal, padding: EdgeInsets.all(16), - child: vecWidget(Assets.vecMessageAddSvg), + child: Assets.vec.messageAddSvg.svg(), ), CustomSlidableAction( onPressed: (context) {}, @@ -549,8 +552,8 @@ Widget selectedLocationWidget({ bottomLeft: Radius.circular(8), topLeft: Radius.circular(8), ), - child: vecWidget(Assets.vecSecurityTimeSvg), - ), + child: Assets.vec.securityTimeSvg.svg()), + ], ), child: GestureDetector( @@ -598,7 +601,7 @@ Widget selectedLocationWidget({ ), ], ), - vecWidget(Assets.vecScanBarcodeSvg), + Assets.vec.scanBarcodeSvg.svg(), ], ), ), diff --git a/packages/inspection/lib/presentation/profile/view.dart b/packages/inspection/lib/presentation/profile/view.dart index c6a321b..b125f1a 100644 --- a/packages/inspection/lib/presentation/profile/view.dart +++ b/packages/inspection/lib/presentation/profile/view.dart @@ -18,8 +18,7 @@ class ProfilePage extends GetView { alignment: Alignment.center, clipBehavior: Clip.none, children: [ - vecWidget(Assets.vecBgHeaderUserProfileSvg, fit: BoxFit.cover), - + Assets.vec.bgHeaderUserProfileSvg.svg(), Positioned( bottom: -20, left: 0, @@ -105,7 +104,7 @@ class ProfilePage extends GetView { onPressed: () { data.value = 0; }, - icon: Assets.vecProfileUserSvg, + icon: Assets.vec.profileUserSvg.path, selected: data.value == 0, ), cardActionWidget( @@ -113,7 +112,7 @@ class ProfilePage extends GetView { onPressed: () { data.value = 1; }, - icon: Assets.vecInformationSvg, + icon: Assets.vec.informationSvg.path, selected: data.value == 1, ), cardActionWidget( @@ -121,7 +120,7 @@ class ProfilePage extends GetView { onPressed: () { data.value = 2; }, - icon: Assets.vecReceiptDiscountSvg, + icon: Assets.vec.receiptDiscountSvg.path, selected: data.value == 2, ), ], @@ -129,9 +128,7 @@ class ProfilePage extends GetView { ); }, controller.selectedInformationType), - SizedBox( - height: 100, - ) + SizedBox(height: 100), ], ), ), @@ -159,34 +156,38 @@ class ProfilePage extends GetView { itemList( title: 'نام و نام خانوادگی', content: 'آیدا گل محمدی', - icon: Assets.vecUserSvg, + icon: Assets.vec.userSvg.path, ), itemList( title: 'موبایل', content: '09302654896', - icon: Assets.vecCallSvg, + icon: Assets.vec.callSvg.path, ), itemList( title: 'کدملی', content: 'نا مشخص', - icon: Assets.vecTagUserSvg, + icon: Assets.vec.tagUserSvg.path, ), itemList( title: 'شماره شناسنامه', content: 'نا مشخص', - icon: Assets.vecUserSquareSvg, + icon: Assets.vec.userSquareSvg.path, ), itemList( title: 'تاریخ تولد', content: '1404/10/12', - icon: Assets.vecCalendarSvg, + icon: Assets.vec.calendarSvg.path, ), itemList( title: 'استان', content: 'لرستان', - icon: Assets.vecPictureFrameSvg, + icon: Assets.vec.pictureFrameSvg.path, + ), + itemList( + title: 'شهر', + content: 'خرم آباد', + icon: Assets.vec.mapSvg.path, ), - itemList(title: 'شهر', content: 'خرم آباد', icon: Assets.vecMapSvg), ], ); } @@ -201,11 +202,10 @@ class ProfilePage extends GetView { if (icon != null) Padding( padding: const EdgeInsets.only(left: 8.0), - child: vecWidget( - icon, + child: SvgGenImage.vec(icon).svg( width: 20, height: 20, - color: AppColor.blueNormal, + colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn), ), ), Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)), @@ -238,11 +238,13 @@ class ProfilePage extends GetView { borderRadius: BorderRadius.circular(8), ), ), - child: vecWidget( - icon, + child: SvgGenImage.vec(icon).svg( width: 40, height: 40, - color: selected ? AppColor.blueNormalActive : AppColor.blueNormal, + colorFilter: ColorFilter.mode( + selected ? AppColor.whiteLight : AppColor.blueNormal, + BlendMode.srcIn, + ), ), ), SizedBox(height: 2), diff --git a/packages/inspection/lib/presentation/registration_of_violation/view.dart b/packages/inspection/lib/presentation/registration_of_violation/view.dart index 9e75e0a..2efa87f 100644 --- a/packages/inspection/lib/presentation/registration_of_violation/view.dart +++ b/packages/inspection/lib/presentation/registration_of_violation/view.dart @@ -15,11 +15,13 @@ class RegistrationOfViolationPage backgroundColor: AppColor.bgLight, appBar: RAppBar( title: 'ثبت تخلف', - leading: vecWidget( - Assets.vecMessageAddSvg, - color: Colors.white, + leading: Assets.vec.messageAddSvg.svg( width: 16, height: 16, + colorFilter: ColorFilter.mode( + Colors.white, + BlendMode.srcIn, + ), ), additionalActions: [ RFab.smallAdd(onPressed: () => controller.countViolation.value++), diff --git a/packages/inspection/lib/presentation/root/view.dart b/packages/inspection/lib/presentation/root/view.dart index 8b7faea..2994617 100644 --- a/packages/inspection/lib/presentation/root/view.dart +++ b/packages/inspection/lib/presentation/root/view.dart @@ -116,30 +116,54 @@ class RootPage extends GetView { ), bottomNavigationBar: WaveBottomNavigation( items: [ - WaveBottomNavigationItem(title: 'خانه', icon: Assets.vecMapSvg), + WaveBottomNavigationItem(title: 'خانه', icon: Assets.vec.mapSvg.svg( + width: 32, + height: 32, + colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), + )), WaveBottomNavigationItem( title: 'عملیات', - icon: Assets.vecUserSvg, + icon: Assets.vec.userSvg.svg( + width: 32, + height: 32, + colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), ), WaveBottomNavigationItem( title: 'افزودن', - icon: Assets.vecAddSvg, + icon: Assets.vec.addSvg.svg( + width: 32, + height: 32, + colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), ), WaveBottomNavigationItem( title: 'آمار', - icon: Assets.vecDiagramSvg, + icon: Assets.vec.diagramSvg.svg(width: 32,height: 32,colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),), ), WaveBottomNavigationItem( title: 'تماس', - icon: Assets.vecCallSvg, + icon: Assets.vec.callSvg.svg( + width: 32, + height: 32, + colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), ), WaveBottomNavigationItem( title: 'مکان ', - icon: Assets.vecGpsSvg, + icon: Assets.vec.gpsSvg.svg( + width: 32, + height: 32, + colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), ), WaveBottomNavigationItem( title: 'تاریخ', - icon: Assets.vecCalendarSvg, + icon: Assets.vec.calendarSvg.svg( + width: 32, + height: 32, + colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), + ), ), ], onPageChanged: (index) { diff --git a/packages/livestock/lib/presentation/page/root/logic.dart b/packages/livestock/lib/presentation/page/root/logic.dart new file mode 100644 index 0000000..e335077 --- /dev/null +++ b/packages/livestock/lib/presentation/page/root/logic.dart @@ -0,0 +1,17 @@ + + +import 'package:rasadyar_core/core.dart'; + +class RootLogic extends GetxController { + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } +} diff --git a/packages/livestock/lib/presentation/page/root/view.dart b/packages/livestock/lib/presentation/page/root/view.dart new file mode 100644 index 0000000..4725935 --- /dev/null +++ b/packages/livestock/lib/presentation/page/root/view.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; +import 'logic.dart'; + +class RootPage extends GetView { + const RootPage({super.key}); + + @override + Widget build(BuildContext context) { + return Container(); + } +} diff --git a/pubspec.lock b/pubspec.lock index 82b7839..14ce169 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "7.4.5" + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.dev" + source: hosted + version: "4.0.7" args: dependency: transitive description: @@ -153,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" + color: + dependency: transitive + description: + name: color + sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb + url: "https://pub.dev" + source: hosted + version: "3.0.0" convert: dependency: transitive description: @@ -262,6 +278,22 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_gen_core: + dependency: transitive + description: + name: flutter_gen_core + sha256: "3eaa2d3d8be58267ac4cd5e215ac965dd23cae0410dc073de2e82e227be32bfc" + url: "https://pub.dev" + source: hosted + version: "5.10.0" + flutter_gen_runner: + dependency: "direct dev" + description: + name: flutter_gen_runner + sha256: e74b4ead01df3e8f02e73a26ca856759dbbe8cb3fd60941ba9f4005cd0cd19c9 + url: "https://pub.dev" + source: hosted + version: "5.10.0" flutter_lints: dependency: "direct dev" description: @@ -493,6 +525,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + hashcodes: + dependency: transitive + description: + name: hashcodes + sha256: "80f9410a5b3c8e110c4b7604546034749259f5d6dcca63e0d3c17c9258f1a651" + url: "https://pub.dev" + source: hosted + version: "2.0.0" hive_ce: dependency: transitive description: @@ -541,6 +581,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" + image_size_getter: + dependency: transitive + description: + name: image_size_getter + sha256: "9a299e3af2ebbcfd1baf21456c3c884037ff524316c97d8e56035ea8fdf35653" + url: "https://pub.dev" + source: hosted + version: "2.4.0" intl: dependency: transitive description: @@ -885,6 +933,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" + posix: + dependency: transitive + description: + name: posix + sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 + url: "https://pub.dev" + source: hosted + version: "6.0.2" pretty_dio_logger: dependency: transitive description: @@ -938,6 +994,13 @@ packages: relative: true source: path version: "1.0.1" + rasadyar_livestock: + dependency: "direct main" + description: + path: "packages/livestock" + relative: true + source: path + version: "1.0.0" rxdart: dependency: transitive description: