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

@@ -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
@@ -73,4 +72,4 @@ class DraggableBottomSheetController extends GetxController {
void collapse() {
currentHeight.value = minHeight;
}
}
}