feat: create inventory in or out picker
This commit is contained in:
parent
9a8b04f3e9
commit
504dc26ed4
|
@ -1,9 +1,15 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:sk_base_mobile/app_theme.dart';
|
||||||
import 'package:sk_base_mobile/db_helper/dbHelper.dart';
|
import 'package:sk_base_mobile/db_helper/dbHelper.dart';
|
||||||
|
import 'package:sk_base_mobile/screens/new_inventory_inout/new_inventory_inout.dart';
|
||||||
import 'package:sk_base_mobile/util/date.util.dart';
|
import 'package:sk_base_mobile/util/date.util.dart';
|
||||||
|
import 'package:sk_base_mobile/util/logger_util.dart';
|
||||||
import 'package:sk_base_mobile/util/modal.util.dart';
|
import 'package:sk_base_mobile/util/modal.util.dart';
|
||||||
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||||
|
|
||||||
|
import 'components/responsive.dart';
|
||||||
|
|
||||||
class InventoryInoutController extends GetxController {
|
class InventoryInoutController extends GetxController {
|
||||||
RxMap userData = {}.obs;
|
RxMap userData = {}.obs;
|
||||||
|
@ -24,7 +30,158 @@ class InventoryInoutController extends GetxController {
|
||||||
RxList model = [].obs;
|
RxList model = [].obs;
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
|
|
||||||
InventoryInoutController() {}
|
Future<void> showInOrOutPickerDialog() async {
|
||||||
|
showDialog(
|
||||||
|
context: Get.overlayContext!,
|
||||||
|
builder: (_) => Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
widthFactor: 1,
|
||||||
|
heightFactor: 1,
|
||||||
|
child: SizedBox(
|
||||||
|
width: ScreenAdaper.width(1000),
|
||||||
|
height: ScreenAdaper.height(500),
|
||||||
|
child: TweenAnimationBuilder(
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
tween: Tween<double>(begin: 0, end: 1),
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
AnimatedPositioned(
|
||||||
|
duration: const Duration(milliseconds: 100),
|
||||||
|
left: value * 80,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
showInventoryInoutCreateDialog();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: ScreenAdaper.height(350),
|
||||||
|
width: ScreenAdaper.height(350),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(30)),
|
||||||
|
gradient: LinearGradient(colors: [
|
||||||
|
AppTheme.primaryColorLight,
|
||||||
|
AppTheme.primaryColor
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.add_circle_outline,
|
||||||
|
color: AppTheme.nearlyWhite,
|
||||||
|
size: ScreenAdaper.sp(80),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: ScreenAdaper.height(10),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'入库',
|
||||||
|
style: TextStyle(
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
color: AppTheme.nearlyWhite,
|
||||||
|
fontSize: ScreenAdaper.sp(60),
|
||||||
|
letterSpacing: ScreenAdaper.width(5),
|
||||||
|
fontWeight: FontWeight.w700),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
AnimatedPositioned(
|
||||||
|
duration: const Duration(milliseconds: 100),
|
||||||
|
right: 80 * value,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
showInventoryInoutCreateDialog();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: ScreenAdaper.height(350),
|
||||||
|
width: ScreenAdaper.height(350),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
// shape: BoxShape.circle,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(30)),
|
||||||
|
gradient: LinearGradient(colors: [
|
||||||
|
AppTheme.primaryColorLight,
|
||||||
|
AppTheme.primaryColor
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
// 减号、
|
||||||
|
Icons.remove_circle_outline,
|
||||||
|
color: AppTheme.nearlyWhite,
|
||||||
|
size: ScreenAdaper.sp(80),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: ScreenAdaper.height(10),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'出库',
|
||||||
|
style: TextStyle(
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
color: AppTheme.nearlyWhite,
|
||||||
|
fontSize: ScreenAdaper.sp(60),
|
||||||
|
letterSpacing:
|
||||||
|
ScreenAdaper.width(5),
|
||||||
|
fontWeight: FontWeight.w700),
|
||||||
|
)
|
||||||
|
])),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 打开新建库存出入库对话框
|
||||||
|
Future<void> showInventoryInoutCreateDialog() async {
|
||||||
|
final isTablet = Responsive.isTablet(Get.context!);
|
||||||
|
isTablet
|
||||||
|
? showGeneralDialog(
|
||||||
|
context: Get.overlayContext!,
|
||||||
|
barrierLabel: "Barrier",
|
||||||
|
barrierDismissible: true,
|
||||||
|
barrierColor: Colors.black.withOpacity(0.5),
|
||||||
|
transitionDuration: const Duration(milliseconds: 400),
|
||||||
|
pageBuilder: (_, __, ___) {
|
||||||
|
return Center(
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
child: Material(child: NewInventoryInout()),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
transitionBuilder: (_, anim, __, child) {
|
||||||
|
Tween<Offset> tween;
|
||||||
|
tween = Tween(begin: const Offset(0, -1), end: Offset.zero);
|
||||||
|
return SlideTransition(
|
||||||
|
position: tween.animate(
|
||||||
|
CurvedAnimation(parent: anim, curve: Curves.easeInOut),
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: showModalBottomSheet(
|
||||||
|
elevation: 0,
|
||||||
|
isScrollControlled: true,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
context: Get.overlayContext!,
|
||||||
|
builder: (context) {
|
||||||
|
return NewInventoryInout();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
getTasks() async {
|
getTasks() async {
|
||||||
db.getData().then((value) {
|
db.getData().then((value) {
|
||||||
|
|
|
@ -14,10 +14,6 @@ class LandingPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
controller.showCreateBtn.value = true;
|
|
||||||
},
|
|
||||||
child: Stack(children: [
|
child: Stack(children: [
|
||||||
const BackColors(),
|
const BackColors(),
|
||||||
SafeArea(
|
SafeArea(
|
||||||
|
@ -29,10 +25,10 @@ class LandingPage extends StatelessWidget {
|
||||||
: null,
|
: null,
|
||||||
bottomNavigationBar: BottomNavBar(),
|
bottomNavigationBar: BottomNavBar(),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
body: Obx(() =>
|
body: Obx(
|
||||||
controller.pages[controller.currentIndex.value]),
|
() => controller.pages[controller.currentIndex.value]),
|
||||||
)))
|
)))
|
||||||
])),
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,63 +1,21 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:sk_base_mobile/app_theme.dart';
|
import 'package:sk_base_mobile/app_theme.dart';
|
||||||
import 'package:sk_base_mobile/screens/inventory_inout/components/responsive.dart';
|
|
||||||
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
|
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
|
||||||
import 'package:sk_base_mobile/screens/landing/landing_controller.dart';
|
import 'package:sk_base_mobile/screens/landing/landing_controller.dart';
|
||||||
import 'package:sk_base_mobile/screens/new_inventory_inout/new_inventory_inout.dart';
|
import 'package:sk_base_mobile/util/logger_util.dart';
|
||||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||||
|
|
||||||
class FloatingCreateButton extends StatelessWidget {
|
class FloatingCreateButton extends StatelessWidget {
|
||||||
FloatingCreateButton({super.key});
|
FloatingCreateButton({super.key});
|
||||||
final controller = Get.find<LandingController>();
|
final controller = Get.find<LandingController>();
|
||||||
|
final inventoryInoutController = Get.find<InventoryInoutController>();
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isTablet = Responsive.isTablet(context);
|
|
||||||
return Obx(() => controller.showCreateBtn.value
|
return Obx(() => controller.showCreateBtn.value
|
||||||
? InkWell(
|
? InkWell(
|
||||||
borderRadius: BorderRadius.circular(ScreenAdaper.sp(50)),
|
borderRadius: BorderRadius.circular(ScreenAdaper.sp(50)),
|
||||||
onTap: () {
|
onTap: inventoryInoutController.showInOrOutPickerDialog,
|
||||||
controller.showCreateBtn.value = false;
|
|
||||||
return;
|
|
||||||
!isTablet
|
|
||||||
? showGeneralDialog(
|
|
||||||
context: context,
|
|
||||||
barrierLabel: "Barrier",
|
|
||||||
barrierDismissible: true,
|
|
||||||
barrierColor: Colors.black.withOpacity(0.5),
|
|
||||||
transitionDuration: const Duration(milliseconds: 400),
|
|
||||||
pageBuilder: (_, __, ___) {
|
|
||||||
return Center(
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(30),
|
|
||||||
child: Material(child: NewInventoryInout()),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
transitionBuilder: (_, anim, __, child) {
|
|
||||||
Tween<Offset> tween;
|
|
||||||
tween =
|
|
||||||
Tween(begin: const Offset(0, -1), end: Offset.zero);
|
|
||||||
return SlideTransition(
|
|
||||||
position: tween.animate(
|
|
||||||
CurvedAnimation(
|
|
||||||
parent: anim, curve: Curves.easeInOut),
|
|
||||||
),
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: showModalBottomSheet(
|
|
||||||
elevation: 0,
|
|
||||||
isScrollControlled: true,
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return NewInventoryInout();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
child: Container(
|
||||||
height: ScreenAdaper.height(140),
|
height: ScreenAdaper.height(140),
|
||||||
width: ScreenAdaper.height(140),
|
width: ScreenAdaper.height(140),
|
||||||
|
@ -82,7 +40,12 @@ class FloatingCreateButton extends StatelessWidget {
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
Transform.translate(
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
print('元素被点击');
|
||||||
|
// 在这里添加你的代码
|
||||||
|
},
|
||||||
|
child: Transform.translate(
|
||||||
offset: Offset(-ScreenAdaper.width(120) * value,
|
offset: Offset(-ScreenAdaper.width(120) * value,
|
||||||
-ScreenAdaper.height(120)),
|
-ScreenAdaper.height(120)),
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
|
@ -90,7 +53,8 @@ class FloatingCreateButton extends StatelessWidget {
|
||||||
height: ScreenAdaper.height(200),
|
height: ScreenAdaper.height(200),
|
||||||
width: ScreenAdaper.height(200),
|
width: ScreenAdaper.height(200),
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(30)),
|
||||||
gradient: LinearGradient(colors: [
|
gradient: LinearGradient(colors: [
|
||||||
AppTheme.primaryColorLight,
|
AppTheme.primaryColorLight,
|
||||||
AppTheme.primaryColor
|
AppTheme.primaryColor
|
||||||
|
@ -114,8 +78,7 @@ class FloatingCreateButton extends StatelessWidget {
|
||||||
fontWeight: FontWeight.w700),
|
fontWeight: FontWeight.w700),
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
),
|
))),
|
||||||
),
|
|
||||||
Transform.translate(
|
Transform.translate(
|
||||||
offset: Offset(ScreenAdaper.width(120) * value,
|
offset: Offset(ScreenAdaper.width(120) * value,
|
||||||
-ScreenAdaper.height(120)),
|
-ScreenAdaper.height(120)),
|
||||||
|
|
|
@ -5,10 +5,10 @@ import 'package:sk_base_mobile/constants/constants.dart';
|
||||||
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
||||||
|
|
||||||
class GradientButton extends StatelessWidget {
|
class GradientButton extends StatelessWidget {
|
||||||
VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
bool isLoading;
|
final bool isLoading;
|
||||||
String buttonText;
|
final String buttonText;
|
||||||
GradientButton(
|
const GradientButton(
|
||||||
{super.key,
|
{super.key,
|
||||||
this.buttonText = TextEnum.createInventoryInOutBtnText,
|
this.buttonText = TextEnum.createInventoryInOutBtnText,
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
|
|
|
@ -2,9 +2,8 @@ import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class TapToDismissKeyboard extends StatelessWidget {
|
class TapToDismissKeyboard extends StatelessWidget {
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
late BuildContext context;
|
final BuildContext context;
|
||||||
|
const TapToDismissKeyboard({super.key, this.child, required this.context});
|
||||||
TapToDismissKeyboard({this.child, required context});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
Loading…
Reference in New Issue