1-bottom sheet
2- on tap location
3- swipe widget
This commit is contained in:
2025-04-14 16:23:09 +03:30
parent 28d43aa027
commit cf4dfb23ea
28 changed files with 349 additions and 68 deletions

View File

@@ -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

View File

@@ -0,0 +1,7 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="vuesax/bold/message-add">
<g id="message-add">
<path id="Vector" d="M16 2H8C4 2 2 4 2 8V21C2 21.55 2.45 22 3 22H16C20 22 22 20 22 16V8C22 4 20 2 16 2ZM15.5 12.75H12.75V15.5C12.75 15.91 12.41 16.25 12 16.25C11.59 16.25 11.25 15.91 11.25 15.5V12.75H8.5C8.09 12.75 7.75 12.41 7.75 12C7.75 11.59 8.09 11.25 8.5 11.25H11.25V8.5C11.25 8.09 11.59 7.75 12 7.75C12.41 7.75 12.75 8.09 12.75 8.5V11.25H15.5C15.91 11.25 16.25 11.59 16.25 12C16.25 12.41 15.91 12.75 15.5 12.75Z" fill="white"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 601 B

View File

@@ -0,0 +1,14 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="vuesax/outline/scan-barcode">
<g id="scan-barcode">
<path id="Vector" d="M2 9.75C1.59 9.75 1.25 9.41 1.25 9V6.5C1.25 3.6 3.61 1.25 6.5 1.25H9C9.41 1.25 9.75 1.59 9.75 2C9.75 2.41 9.41 2.75 9 2.75H6.5C4.43 2.75 2.75 4.43 2.75 6.5V9C2.75 9.41 2.41 9.75 2 9.75Z" fill="#2D5FFF"/>
<path id="Vector_2" d="M22 9.75C21.59 9.75 21.25 9.41 21.25 9V6.5C21.25 4.43 19.57 2.75 17.5 2.75H15C14.59 2.75 14.25 2.41 14.25 2C14.25 1.59 14.59 1.25 15 1.25H17.5C20.39 1.25 22.75 3.6 22.75 6.5V9C22.75 9.41 22.41 9.75 22 9.75Z" fill="#2D5FFF"/>
<path id="Vector_3" d="M17.5 22.75H16C15.59 22.75 15.25 22.41 15.25 22C15.25 21.59 15.59 21.25 16 21.25H17.5C19.57 21.25 21.25 19.57 21.25 17.5V16C21.25 15.59 21.59 15.25 22 15.25C22.41 15.25 22.75 15.59 22.75 16V17.5C22.75 20.4 20.39 22.75 17.5 22.75Z" fill="#2D5FFF"/>
<path id="Vector_4" d="M9 22.75H6.5C3.61 22.75 1.25 20.4 1.25 17.5V15C1.25 14.59 1.59 14.25 2 14.25C2.41 14.25 2.75 14.59 2.75 15V17.5C2.75 19.57 4.43 21.25 6.5 21.25H9C9.41 21.25 9.75 21.59 9.75 22C9.75 22.41 9.41 22.75 9 22.75Z" fill="#2D5FFF"/>
<path id="Vector_5" d="M9 11.25H7C5.59 11.25 4.75 10.41 4.75 9V7C4.75 5.59 5.59 4.75 7 4.75H9C10.41 4.75 11.25 5.59 11.25 7V9C11.25 10.41 10.41 11.25 9 11.25ZM7 6.25C6.41 6.25 6.25 6.41 6.25 7V9C6.25 9.59 6.41 9.75 7 9.75H9C9.59 9.75 9.75 9.59 9.75 9V7C9.75 6.41 9.59 6.25 9 6.25H7Z" fill="#2D5FFF"/>
<path id="Vector_6" d="M17 11.25H15C13.59 11.25 12.75 10.41 12.75 9V7C12.75 5.59 13.59 4.75 15 4.75H17C18.41 4.75 19.25 5.59 19.25 7V9C19.25 10.41 18.41 11.25 17 11.25ZM15 6.25C14.41 6.25 14.25 6.41 14.25 7V9C14.25 9.59 14.41 9.75 15 9.75H17C17.59 9.75 17.75 9.59 17.75 9V7C17.75 6.41 17.59 6.25 17 6.25H15Z" fill="#2D5FFF"/>
<path id="Vector_7" d="M9 19.25H7C5.59 19.25 4.75 18.41 4.75 17V15C4.75 13.59 5.59 12.75 7 12.75H9C10.41 12.75 11.25 13.59 11.25 15V17C11.25 18.41 10.41 19.25 9 19.25ZM7 14.25C6.41 14.25 6.25 14.41 6.25 15V17C6.25 17.59 6.41 17.75 7 17.75H9C9.59 17.75 9.75 17.59 9.75 17V15C9.75 14.41 9.59 14.25 9 14.25H7Z" fill="#2D5FFF"/>
<path id="Vector_8" d="M17 19.25H15C13.59 19.25 12.75 18.41 12.75 17V15C12.75 13.59 13.59 12.75 15 12.75H17C18.41 12.75 19.25 13.59 19.25 15V17C19.25 18.41 18.41 19.25 17 19.25ZM15 14.25C14.41 14.25 14.25 14.41 14.25 15V17C14.25 17.59 14.41 17.75 15 17.75H17C17.59 17.75 17.75 17.59 17.75 17V15C17.75 14.41 17.59 14.25 17 14.25H15Z" fill="#2D5FFF"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,8 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="vuesax/bold/security-time">
<g id="security-time">
<path id="Vector" d="M12 8.25C10.21 8.25 8.75 9.71 8.75 11.5C8.75 13.29 10.21 14.75 12 14.75C13.79 14.75 15.25 13.29 15.25 11.5C15.25 9.71 13.79 8.25 12 8.25ZM13 11.18C13 11.79 12.67 12.37 12.15 12.68L11.38 13.14C11.26 13.21 11.13 13.25 10.99 13.25C10.74 13.25 10.49 13.12 10.35 12.89C10.14 12.53 10.25 12.07 10.61 11.86L11.37 11.4C11.45 11.35 11.49 11.27 11.49 11.19V10.26C11.49 9.85 11.83 9.51 12.24 9.51C12.65 9.51 13 9.84 13 10.25V11.18Z" fill="white"/>
<path id="Vector_2" d="M18.5398 4.16965L13.0398 2.10965C12.4698 1.89965 11.5398 1.89965 10.9698 2.10965L5.4698 4.16965C4.4098 4.56965 3.5498 5.80965 3.5498 6.93965V15.0396C3.5498 15.8496 4.0798 16.9196 4.7298 17.3996L10.2298 21.5096C11.1998 22.2396 12.7898 22.2396 13.7598 21.5096L19.2598 17.3996C19.9098 16.9096 20.4398 15.8496 20.4398 15.0396V6.93965C20.4498 5.80965 19.5898 4.56965 18.5398 4.16965ZM11.9998 16.2496C9.3798 16.2496 7.2498 14.1196 7.2498 11.4996C7.2498 8.87965 9.3798 6.74965 11.9998 6.74965C14.6198 6.74965 16.7498 8.87965 16.7498 11.4996C16.7498 14.1196 14.6198 16.2496 11.9998 16.2496Z" fill="white"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

17
copyAssets.sh Normal file
View File

@@ -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'..."

View File

@@ -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';
}

View File

@@ -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

View File

@@ -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<SupervisionFilterLogic> {
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<SupervisionFilterLogic> {
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<SupervisionFilterLogic> {
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<SupervisionFilterLogic> {
);
}
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),

View File

@@ -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:

View File

@@ -8,7 +8,7 @@ class UserService extends GetxService {
@override
void onInit() {
return super.onInit();
_userLocalStorage = di.get<UserRepository>();
// _userLocalStorage = di.get<UserRepository>();
}
Future<bool> isUserAuthed() async {

View File

@@ -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<void> _setupLocalStorage() async {
//
}
*/

View File

@@ -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();

View File

@@ -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';

View File

@@ -234,8 +234,7 @@ class AuthWithUseAndPassPage extends GetView<AuthWithUseAndPassLogic> {
RElevated(
text: 'ورود',
onPressed: () {
di.get<Logger>().t(data.value.currentState?.validate());
di.get<Logger>().t(controller.captchaController.validate());
if (data.value.currentState?.validate() == true &&
controller.captchaController.validate()) {
Get.toNamed(SupervisionRoutes.supervision);

View File

@@ -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';

View File

@@ -0,0 +1,22 @@
import 'package:logger/logger.dart';
import 'package:rasadyar_core/infrastructure/di/di.dart';
void iLog(dynamic message) {
di.get<Logger>().i(message.toString());
}
void eLog(dynamic message) {
di.get<Logger>().e(message.toString());
}
void dLog(dynamic message) {
di.get<Logger>().d(message.toString());
}
void fLog(dynamic message) {
di.get<Logger>().f(message.toString());
}
void tLog(dynamic message) {
di.get<Logger>().t(message.toString());
}

View File

@@ -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>( Logger());
}
Future<void> setupAllProvider() async {
//await _setupLocalStorage();
await di.allReady();
}
// Future<void> _setupLocalStorage() async {
// final hiveProvider = di.get<HiveProvider>(instanceName: 'HiveProvider');
// await hiveProvider.init();
// Hive.registerAdapter(UserModelAdapter());
//
// await Hive.openBox<UserModel>(HiveBoxNames.user.name);
//
// //user
// di.registerLazySingleton<IUserLocalStorage>(() => UserLocalStorage());
// di.registerLazySingleton<IUserRepository>(
// () => UserRepository(di.get<IUserLocalStorage>()),
// );
//
// //
// }

View File

@@ -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,

View File

@@ -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';

View File

@@ -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(),
],
),
),

View File

@@ -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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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

View File

@@ -42,6 +42,10 @@ dependencies:
supervision:
path: ./features/supervision
rasadyar_core:
path: ./packages/core
dev_dependencies:
flutter_test:
sdk: flutter