fix:
1-bottom sheet 2- on tap location 3- swipe widget
This commit is contained in:
@@ -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';
|
||||
|
||||
|
||||
|
||||
22
packages/core/lib/data/utils.dart
Normal file
22
packages/core/lib/data/utils.dart
Normal 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());
|
||||
}
|
||||
32
packages/core/lib/infrastructure/di/di.dart
Normal file
32
packages/core/lib/infrastructure/di/di.dart
Normal 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>()),
|
||||
// );
|
||||
//
|
||||
// //
|
||||
// }
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user