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,25 +14,21 @@ class LandingPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
child: GestureDetector(
|
child: Stack(children: [
|
||||||
onTap: () {
|
const BackColors(),
|
||||||
controller.showCreateBtn.value = true;
|
SafeArea(
|
||||||
},
|
child: Obx(() => Scaffold(
|
||||||
child: Stack(children: [
|
floatingActionButtonLocation:
|
||||||
const BackColors(),
|
FloatingActionButtonLocation.centerDocked,
|
||||||
SafeArea(
|
floatingActionButton: controller.currentIndex.value == 0
|
||||||
child: Obx(() => Scaffold(
|
? FloatingCreateButton()
|
||||||
floatingActionButtonLocation:
|
: null,
|
||||||
FloatingActionButtonLocation.centerDocked,
|
bottomNavigationBar: BottomNavBar(),
|
||||||
floatingActionButton: controller.currentIndex.value == 0
|
backgroundColor: Colors.transparent,
|
||||||
? FloatingCreateButton()
|
body: Obx(
|
||||||
: null,
|
() => controller.pages[controller.currentIndex.value]),
|
||||||
bottomNavigationBar: BottomNavBar(),
|
)))
|
||||||
backgroundColor: Colors.transparent,
|
]),
|
||||||
body: Obx(() =>
|
|
||||||
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,40 +40,45 @@ class FloatingCreateButton extends StatelessWidget {
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
Transform.translate(
|
GestureDetector(
|
||||||
offset: Offset(-ScreenAdaper.width(120) * value,
|
onTap: () {
|
||||||
-ScreenAdaper.height(120)),
|
print('元素被点击');
|
||||||
child: AnimatedContainer(
|
// 在这里添加你的代码
|
||||||
duration: const Duration(milliseconds: 200),
|
},
|
||||||
height: ScreenAdaper.height(200),
|
child: Transform.translate(
|
||||||
width: ScreenAdaper.height(200),
|
offset: Offset(-ScreenAdaper.width(120) * value,
|
||||||
decoration: const BoxDecoration(
|
-ScreenAdaper.height(120)),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
child: AnimatedContainer(
|
||||||
gradient: LinearGradient(colors: [
|
duration: const Duration(milliseconds: 200),
|
||||||
AppTheme.primaryColorLight,
|
height: ScreenAdaper.height(200),
|
||||||
AppTheme.primaryColor
|
width: ScreenAdaper.height(200),
|
||||||
]),
|
decoration: const BoxDecoration(
|
||||||
),
|
borderRadius:
|
||||||
alignment: Alignment.center,
|
BorderRadius.all(Radius.circular(30)),
|
||||||
child: Column(
|
gradient: LinearGradient(colors: [
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
AppTheme.primaryColorLight,
|
||||||
children: [
|
AppTheme.primaryColor
|
||||||
Icon(
|
]),
|
||||||
Icons.add_circle_outline,
|
|
||||||
color: AppTheme.nearlyWhite,
|
|
||||||
size: ScreenAdaper.sp(70),
|
|
||||||
),
|
),
|
||||||
Text(
|
alignment: Alignment.center,
|
||||||
'入库',
|
child: Column(
|
||||||
style: TextStyle(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
color: AppTheme.nearlyWhite,
|
children: [
|
||||||
fontSize: ScreenAdaper.sp(50),
|
Icon(
|
||||||
letterSpacing: ScreenAdaper.width(5),
|
Icons.add_circle_outline,
|
||||||
fontWeight: FontWeight.w700),
|
color: AppTheme.nearlyWhite,
|
||||||
)
|
size: ScreenAdaper.sp(70),
|
||||||
]),
|
),
|
||||||
),
|
Text(
|
||||||
),
|
'入库',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppTheme.nearlyWhite,
|
||||||
|
fontSize: ScreenAdaper.sp(50),
|
||||||
|
letterSpacing: ScreenAdaper.width(5),
|
||||||
|
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