diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index bfb2507..ac6af7a 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -8,7 +8,7 @@ plugins { android { namespace = "com.hoshomandsazan.rasadyar_app" compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion + ndkVersion = "27.0.12077973" compileOptions { sourceCompatibility = JavaVersion.VERSION_11 diff --git a/assets/icons/message_add.svg b/assets/icons/message_add.svg new file mode 100644 index 0000000..9d83a3f --- /dev/null +++ b/assets/icons/message_add.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/icons/scan_barcode.svg b/assets/icons/scan_barcode.svg new file mode 100644 index 0000000..cd387e0 --- /dev/null +++ b/assets/icons/scan_barcode.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/icons/security-time.svg b/assets/icons/security-time.svg new file mode 100644 index 0000000..1fab0fe --- /dev/null +++ b/assets/icons/security-time.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/vec/message_add.svg.vec b/assets/vec/message_add.svg.vec new file mode 100644 index 0000000..f740dd5 Binary files /dev/null and b/assets/vec/message_add.svg.vec differ diff --git a/assets/vec/scan_barcode.svg.vec b/assets/vec/scan_barcode.svg.vec new file mode 100644 index 0000000..2456035 Binary files /dev/null and b/assets/vec/scan_barcode.svg.vec differ diff --git a/assets/vec/security-time.svg.vec b/assets/vec/security-time.svg.vec new file mode 100644 index 0000000..72e5dee Binary files /dev/null and b/assets/vec/security-time.svg.vec differ diff --git a/copyAssets.sh b/copyAssets.sh new file mode 100644 index 0000000..a32ff95 --- /dev/null +++ b/copyAssets.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +SOURCE_FILE="lib/presentation/common/assets.dart" +TARGET_DIR="packages/core/lib/presentation/common/assets.dart" + +echo "--- Starting File Operations ---" + +echo " 💀 Attempting to delete '$FILE_PATH_TO_DELETE'..." +rm -fv "$FILE_PATH_TO_DELETE" +echo "✅ Deletion step complete (file removed if it existed)." + + + + +echo "Attempting to copy source(s) to '$TARGET_DIR'..." + diff --git a/core/lib/presentation/common/assets.dart/assets.dart b/core/lib/presentation/common/assets.dart/assets.dart new file mode 100644 index 0000000..432e743 --- /dev/null +++ b/core/lib/presentation/common/assets.dart/assets.dart @@ -0,0 +1,42 @@ +///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 iconsCall = 'assets/icons/call.svg'; + static const String iconsDownload = 'assets/icons/download.svg'; + static const String iconsEdit = 'assets/icons/edit.svg'; + static const String iconsFilter = 'assets/icons/filter.svg'; + static const String iconsGps = 'assets/icons/gps.svg'; + static const String iconsKey = 'assets/icons/key.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 iconsProfileCircle = 'assets/icons/profile_circle.svg'; + static const String iconsScan = 'assets/icons/scan.svg'; + static const String iconsSecurityTime = 'assets/icons/security-time.svg'; + static const String iconsSetting = 'assets/icons/setting.svg'; + static const String iconsTrash = 'assets/icons/trash.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 vecCallSvg = 'assets/vec/call.svg.vec'; + static const String vecDownloadSvg = 'assets/vec/download.svg.vec'; + static const String vecEditSvg = 'assets/vec/edit.svg.vec'; + static const String vecFilterSvg = 'assets/vec/filter.svg.vec'; + static const String vecGpsSvg = 'assets/vec/gps.svg.vec'; + static const String vecKeySvg = 'assets/vec/key.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 vecProfileCircleSvg = 'assets/vec/profile_circle.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 vecTrashSvg = 'assets/vec/trash.svg.vec'; + +} diff --git a/features/supervision/lib/presentation/filter/logic.dart b/features/supervision/lib/presentation/filter/logic.dart index 521ed9c..3b2ca9f 100644 --- a/features/supervision/lib/presentation/filter/logic.dart +++ b/features/supervision/lib/presentation/filter/logic.dart @@ -6,6 +6,7 @@ import 'package:flutter_map_animations/flutter_map_animations.dart'; import 'package:geolocator/geolocator.dart'; import 'package:latlong2/latlong.dart'; import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_core/data/utils.dart'; import 'package:supervision/data/utils/marker_generator.dart'; enum BottomSheetStep { filter, markerSelected, markerDetails } @@ -108,30 +109,35 @@ class SupervisionFilterLogic extends GetxController DraggableBottomSheetController( initialVisibility: false, initialHeight: 300, - minHeight: 50, + minHeight: 70, maxHeight: 600, ).obs; bottomSheetStep.listen((data) { + tLog('1 bottomSheetStep -> ${data.name}'); if (data == BottomSheetStep.filter) { - sheetController = - DraggableBottomSheetController( - initialVisibility: false, + sheetController.value = DraggableBottomSheetController( + initialVisibility: true, initialHeight: 300, - minHeight: 50, + minHeight: 70, maxHeight: 600, - ).obs; + ); } else if (data == BottomSheetStep.markerSelected) { - sheetController = + sheetController.value = DraggableBottomSheetController( initialVisibility: true, - initialHeight: 150, + initialHeight: 300, minHeight: 50, - maxHeight: 150, - ).obs; - sheetController.refresh(); + maxHeight: 300, + ); + } + sheetController.refresh(); + sheetController.value.toggle(); + }); + + } @override diff --git a/features/supervision/lib/presentation/filter/view.dart b/features/supervision/lib/presentation/filter/view.dart index 034b0e5..27587bb 100644 --- a/features/supervision/lib/presentation/filter/view.dart +++ b/features/supervision/lib/presentation/filter/view.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_core/data/utils.dart'; import 'package:rasadyar_core/presentation/widget/buttons/fab.dart'; import 'logic.dart'; @@ -42,26 +44,7 @@ class SupervisionFilterPage extends GetView { ObxValue((markers) { return MarkerLayer( markers: - markers - .map( - (marker) => Marker( - point: marker, - - child: IconButton( - onPressed: () { - controller.bottomSheetStep.value = - BottomSheetStep.markerSelected; - - }, - icon: Icon( - Icons.location_on, - color: Colors.red, - size: 30, - ), - ), - ), - ) - .toList(), + markers.map((marker) => markerWidget(marker)).toList(), ); }, controller.markers), ], @@ -93,6 +76,9 @@ class SupervisionFilterPage extends GetView { backgroundColor: AppColor.blueNormal, icon: vecWidget(Assets.vecFilterSvg, width: 24, height: 24), onPressed: () { + if (controller.bottomSheetStep.value != BottomSheetStep.filter) { + controller.bottomSheetStep.value = BottomSheetStep.filter; + } controller.sheetController.value.toggle(); }, ), @@ -102,20 +88,18 @@ class SupervisionFilterPage extends GetView { left: 0, right: 0, child: ObxValue((data) { + fLog(data); return DraggableBottomSheet( controller: data.value, child: ObxValue((data) { if (data.value == BottomSheetStep.filter) { return filterWidget(); } else if (data.value == BottomSheetStep.markerSelected) { - return const SizedBox( - height: 150, - child: Center(child: Text('Marker Selected')), - ); + return selectedLocationWidget(); } else { return const SizedBox( height: 150, - child: Center(child: Text('Noting')), + child: Center(child: Text('Marker Selected')), ); } }, controller.bottomSheetStep), @@ -126,6 +110,111 @@ class SupervisionFilterPage extends GetView { ); } + Marker markerWidget(LatLng marker) { + return Marker( + point: marker, + child: IconButton( + onPressed: () { + controller.bottomSheetStep.value = BottomSheetStep.markerSelected; + if (!controller.sheetController.value.isVisible.value) { + controller.sheetController.value.show(); + } + }, + icon: Icon(Icons.location_on, color: Colors.red, size: 30), + ), + ); + } + + Widget selectedLocationWidget() { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20), + child: Slidable( + key: Key('item'), + + endActionPane: ActionPane( + motion: StretchMotion(), + children: [ + CustomSlidableAction( + onPressed: (context) {}, + backgroundColor: AppColor.blueNormal, + foregroundColor: Colors.white, + padding: EdgeInsets.all(16), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(8), + topRight: Radius.circular(8), + ), + child: vecWidget(Assets.vecMapSvg, width: 24, height: 24), + ), + CustomSlidableAction( + onPressed: (context) {}, + backgroundColor: AppColor.greenNormal, + padding: EdgeInsets.all(16), + child: vecWidget(Assets.vecMessageAddSvg), + ), + CustomSlidableAction( + onPressed: (context) {}, + backgroundColor: AppColor.warning, + padding: EdgeInsets.all(16), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(8), + topLeft: Radius.circular(8), + ), + child: vecWidget(Assets.vecSecurityTimeSvg), + ), + ], + ), + child: Container( + height: 58, + padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), + + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8), + border: Border.all(width: 1, color: AppColor.blackLightHover), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + Text( + 'داود خرم مهری پور', + style: AppFonts.yekan10.copyWith( + color: AppColor.blueNormal, + ), + ), + Text( + 'گوشت و مرغ', + style: AppFonts.yekan12.copyWith( + color: AppColor.darkGreyDarkHover, + ), + ), + ], + ), + Column( + children: [ + Text( + 'باقی مانده', + style: AppFonts.yekan10.copyWith( + color: AppColor.blueNormal, + ), + ), + Text( + '0 کیلوگرم', + style: AppFonts.yekan12.copyWith( + color: AppColor.darkGreyDarkHover, + ), + ), + ], + ), + vecWidget(Assets.vecScanBarcodeSvg), + ], + ), + ), + ), + ); + } + Padding filterWidget() { return Padding( padding: const EdgeInsets.all(20.0), diff --git a/features/supervision/pubspec.lock b/features/supervision/pubspec.lock index 3ee017f..ad08c3e 100644 --- a/features/supervision/pubspec.lock +++ b/features/supervision/pubspec.lock @@ -110,6 +110,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.9.0" + flutter_slidable: + dependency: transitive + description: + name: flutter_slidable + sha256: ab7dbb16f783307c9d7762ede2593ce32c220ba2ba0fd540a3db8e9a3acba71a + url: "https://pub.dev" + source: hosted + version: "4.0.0" flutter_svg: dependency: transitive description: diff --git a/lib/domain/service/user/user_service.dart b/lib/domain/service/user/user_service.dart index db8005c..3c4b464 100644 --- a/lib/domain/service/user/user_service.dart +++ b/lib/domain/service/user/user_service.dart @@ -8,7 +8,7 @@ class UserService extends GetxService { @override void onInit() { return super.onInit(); - _userLocalStorage = di.get(); + // _userLocalStorage = di.get(); } Future isUserAuthed() async { diff --git a/lib/infrastructure/di/di.dart b/lib/infrastructure/di/di.dart index 7b43cc5..b3919d0 100644 --- a/lib/infrastructure/di/di.dart +++ b/lib/infrastructure/di/di.dart @@ -1,3 +1,4 @@ +/* import 'package:get_it/get_it.dart'; import 'package:hive_ce_flutter/hive_flutter.dart'; import 'package:logger/logger.dart'; @@ -33,3 +34,4 @@ Future _setupLocalStorage() async { // } +*/ diff --git a/lib/main.dart b/lib/main.dart index c62ccab..5163177 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,6 +4,7 @@ import 'package:rasadyar_app/domain/service/user/user_service.dart'; import 'package:rasadyar_app/infrastructure/di/di.dart'; import 'package:rasadyar_app/presentation/common/app_color.dart'; import 'package:rasadyar_app/presentation/routes/app_pages.dart'; +import 'package:rasadyar_core/infrastructure/di/di.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); diff --git a/lib/presentation/common/assets.dart b/lib/presentation/common/assets.dart index 4e91d17..c51cd01 100644 --- a/lib/presentation/common/assets.dart +++ b/lib/presentation/common/assets.dart @@ -13,8 +13,11 @@ class Assets { static const String iconsKey = 'assets/icons/key.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 iconsProfileCircle = 'assets/icons/profile_circle.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 iconsTrash = 'assets/icons/trash.svg'; static const String imagesInnerSplash = 'assets/images/inner_splash.webp'; @@ -30,8 +33,11 @@ class Assets { static const String vecKeySvg = 'assets/vec/key.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 vecProfileCircleSvg = 'assets/vec/profile_circle.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 vecTrashSvg = 'assets/vec/trash.svg.vec'; diff --git a/lib/presentation/pages/auth/auth_with_use_and_pass/view.dart b/lib/presentation/pages/auth/auth_with_use_and_pass/view.dart index 9a45635..e92376c 100644 --- a/lib/presentation/pages/auth/auth_with_use_and_pass/view.dart +++ b/lib/presentation/pages/auth/auth_with_use_and_pass/view.dart @@ -234,8 +234,7 @@ class AuthWithUseAndPassPage extends GetView { RElevated( text: 'ورود', onPressed: () { - di.get().t(data.value.currentState?.validate()); - di.get().t(controller.captchaController.validate()); + if (data.value.currentState?.validate() == true && controller.captchaController.validate()) { Get.toNamed(SupervisionRoutes.supervision); diff --git a/packages/core/lib/core.dart b/packages/core/lib/core.dart index be75d72..6359f17 100644 --- a/packages/core/lib/core.dart +++ b/packages/core/lib/core.dart @@ -4,5 +4,6 @@ export 'package:get/get.dart'; export 'package:rasadyar_core/presentation/common/common.dart'; export 'package:rasadyar_core/presentation/utils/utils.dart'; export 'package:rasadyar_core/presentation/widget/widget.dart'; +export 'package:flutter_slidable/flutter_slidable.dart'; diff --git a/packages/core/lib/data/utils.dart b/packages/core/lib/data/utils.dart new file mode 100644 index 0000000..fbaf1a8 --- /dev/null +++ b/packages/core/lib/data/utils.dart @@ -0,0 +1,22 @@ +import 'package:logger/logger.dart'; +import 'package:rasadyar_core/infrastructure/di/di.dart'; + +void iLog(dynamic message) { + di.get().i(message.toString()); +} + +void eLog(dynamic message) { + di.get().e(message.toString()); +} + +void dLog(dynamic message) { + di.get().d(message.toString()); +} + +void fLog(dynamic message) { + di.get().f(message.toString()); +} + +void tLog(dynamic message) { + di.get().t(message.toString()); +} diff --git a/packages/core/lib/infrastructure/di/di.dart b/packages/core/lib/infrastructure/di/di.dart new file mode 100644 index 0000000..c6ecb54 --- /dev/null +++ b/packages/core/lib/infrastructure/di/di.dart @@ -0,0 +1,32 @@ +import 'package:get_it/get_it.dart'; +import 'package:hive_ce_flutter/hive_flutter.dart'; +import 'package:logger/logger.dart'; + + +final di = GetIt.instance; + +void setupInjection() { + // di.registerLazySingleton(() => HiveProvider(), instanceName: 'HiveProvider'); + di.registerSingleton( Logger()); +} + +Future setupAllProvider() async { + //await _setupLocalStorage(); + await di.allReady(); +} + +// Future _setupLocalStorage() async { +// final hiveProvider = di.get(instanceName: 'HiveProvider'); +// await hiveProvider.init(); +// Hive.registerAdapter(UserModelAdapter()); +// +// await Hive.openBox(HiveBoxNames.user.name); +// +// //user +// di.registerLazySingleton(() => UserLocalStorage()); +// di.registerLazySingleton( +// () => UserRepository(di.get()), +// ); +// +// // +// } diff --git a/packages/core/lib/presentation/common/app_fonts.dart b/packages/core/lib/presentation/common/app_fonts.dart index 65be3b0..dd5d433 100644 --- a/packages/core/lib/presentation/common/app_fonts.dart +++ b/packages/core/lib/presentation/common/app_fonts.dart @@ -81,6 +81,8 @@ class AppFonts { height: _height, ); + + static const TextStyle yekan13 = TextStyle( fontFamily: yekan, fontWeight: regular, @@ -88,6 +90,15 @@ class AppFonts { height: _height, ); + + static const TextStyle yekan12 = TextStyle( + fontFamily: yekan, + fontWeight: regular, + fontSize: 12, + height: _height, + ); + + static const TextStyle yekan10 = TextStyle( // Rounded from 10.24 fontFamily: yekan, diff --git a/packages/core/lib/presentation/common/assets.dart b/packages/core/lib/presentation/common/assets.dart index 4e91d17..c51cd01 100644 --- a/packages/core/lib/presentation/common/assets.dart +++ b/packages/core/lib/presentation/common/assets.dart @@ -13,8 +13,11 @@ class Assets { static const String iconsKey = 'assets/icons/key.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 iconsProfileCircle = 'assets/icons/profile_circle.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 iconsTrash = 'assets/icons/trash.svg'; static const String imagesInnerSplash = 'assets/images/inner_splash.webp'; @@ -30,8 +33,11 @@ class Assets { static const String vecKeySvg = 'assets/vec/key.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 vecProfileCircleSvg = 'assets/vec/profile_circle.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 vecTrashSvg = 'assets/vec/trash.svg.vec'; diff --git a/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet.dart b/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet.dart index b61941c..39517bf 100644 --- a/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet.dart +++ b/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:rasadyar_core/data/utils.dart'; import 'package:rasadyar_core/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet_controller.dart'; class DraggableBottomSheet extends StatelessWidget { @@ -23,12 +24,11 @@ class DraggableBottomSheet extends StatelessWidget { @override Widget build(BuildContext context) { - // If no controller is passed, create one locally final DraggableBottomSheetController bottomSheetController = controller ?? Get.put( DraggableBottomSheetController( - initialVisibility: false, // always start hidden + initialVisibility: false, initialHeight: initialHeight, minHeight: minHeight, maxHeight: maxHeight, @@ -52,7 +52,7 @@ class DraggableBottomSheet extends StatelessWidget { right: 0, child: GestureDetector( onVerticalDragUpdate: (DragUpdateDetails details) { - bottomSheetController.updateHeight(details.delta.dy); + bottomSheetController.updateHeight(details.primaryDelta); }, child: Container( height: data.value, @@ -63,18 +63,9 @@ class DraggableBottomSheet extends StatelessWidget { child: Column( children: [ const SizedBox(height: 10), - - /* Container( - width: 40, - height: 5, - decoration: BoxDecoration( - color: Colors.grey[400], - borderRadius: BorderRadius.circular(5), - ), - ),*/ GestureDetector( onTap: () { - bottomSheetController.hide(); + bottomSheetController.toggle(); }, behavior: HitTestBehavior.opaque, child: Row( @@ -83,7 +74,7 @@ class DraggableBottomSheet extends StatelessWidget { ), ), const SizedBox(height: 10), - Expanded(child: child ?? SizedBox.shrink()), + child ?? SizedBox.shrink(), ], ), ), diff --git a/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet_controller.dart b/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet_controller.dart index eedebc8..e42138e 100644 --- a/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet_controller.dart +++ b/packages/core/lib/presentation/widget/draggable_bottom_sheet/draggable_bottom_sheet_controller.dart @@ -1,7 +1,5 @@ -import 'package:flutter/foundation.dart'; import 'package:get/get.dart'; - class DraggableBottomSheetController extends GetxController { // Observable variables final RxBool isVisible = false.obs; @@ -19,7 +17,7 @@ class DraggableBottomSheetController extends GetxController { this.maxHeight = 700, }) { isVisible.value = initialVisibility; - currentHeight.value = initialHeight; + currentHeight.value = 0; } // Show the bottom sheet @@ -53,14 +51,15 @@ class DraggableBottomSheetController extends GetxController { } } - // Update height (usually called during drag) - void updateHeight(double delta) { - final newHeight = currentHeight.value - delta; - if(newHeight < minHeight) { - hide(); - return; + void updateHeight(double? delta) { + if (delta == null) return; + final newHeight = (currentHeight.value - delta).clamp(minHeight, maxHeight); + + if (newHeight <= minHeight) { + toggle(); + } else { + currentHeight.value = newHeight; } - currentHeight.value = newHeight.clamp(minHeight, maxHeight); } // Expand to maximum height @@ -73,4 +72,4 @@ class DraggableBottomSheetController extends GetxController { void collapse() { currentHeight.value = minHeight; } -} \ No newline at end of file +} diff --git a/packages/core/pubspec.lock b/packages/core/pubspec.lock index c2b2c17..e6df05c 100644 --- a/packages/core/pubspec.lock +++ b/packages/core/pubspec.lock @@ -230,6 +230,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.0.0" + flutter_slidable: + dependency: "direct main" + description: + name: flutter_slidable + sha256: ab7dbb16f783307c9d7762ede2593ce32c220ba2ba0fd540a3db8e9a3acba71a + url: "https://pub.dev" + source: hosted + version: "4.0.0" flutter_svg: dependency: "direct main" description: diff --git a/packages/core/pubspec.yaml b/packages/core/pubspec.yaml index 1aca781..d46e2e5 100644 --- a/packages/core/pubspec.yaml +++ b/packages/core/pubspec.yaml @@ -10,8 +10,9 @@ dependencies: flutter: sdk: flutter - + #UI cupertino_icons: ^1.0.8 + flutter_slidable: ^4.0.0 ##Log logger: ^2.5.0 @@ -38,7 +39,6 @@ dependencies: ##Di get_it: ^8.0.3 - permission_handler: ^11.4.0 dev_dependencies: diff --git a/pubspec.lock b/pubspec.lock index ef4da26..29b58c7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -254,6 +254,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.9.0" + flutter_slidable: + dependency: transitive + description: + name: flutter_slidable + sha256: ab7dbb16f783307c9d7762ede2593ce32c220ba2ba0fd540a3db8e9a3acba71a + url: "https://pub.dev" + source: hosted + version: "4.0.0" flutter_svg: dependency: "direct main" description: @@ -801,7 +809,7 @@ packages: source: hosted version: "1.5.0" rasadyar_core: - dependency: transitive + dependency: "direct main" description: path: "packages/core" relative: true diff --git a/pubspec.yaml b/pubspec.yaml index 326d4f4..546bb1c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,6 +42,10 @@ dependencies: supervision: path: ./features/supervision + rasadyar_core: + path: ./packages/core + + dev_dependencies: flutter_test: sdk: flutter