diff --git a/lib/screens/inventory_inout/components/inventory_inout_info.dart b/lib/screens/inventory_inout/components/inventory_inout_info.dart index ef2d854..c6618fa 100644 --- a/lib/screens/inventory_inout/components/inventory_inout_info.dart +++ b/lib/screens/inventory_inout/components/inventory_inout_info.dart @@ -1,16 +1,13 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:loading_animation_widget/loading_animation_widget.dart'; import 'package:sk_base_mobile/apis/index.dart'; import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/config.dart'; import 'package:sk_base_mobile/constants/bg_color.dart'; import 'package:sk_base_mobile/constants/constants.dart'; import 'package:sk_base_mobile/models/index.dart'; -import 'package:sk_base_mobile/models/inventory.model.dart'; import 'package:sk_base_mobile/util/date.util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; -import 'package:sk_base_mobile/widgets/empty.dart'; import 'package:sk_base_mobile/widgets/fade_in_cache_image.dart'; import 'package:sk_base_mobile/widgets/image_preview.dart'; import 'package:sk_base_mobile/widgets/loading_indicator.dart'; @@ -162,7 +159,8 @@ class InventoryInoutInfo extends StatelessWidget { return ListTile( leading: Text( '${leading ?? ''}: ', - style: TextStyle(fontSize: ScreenAdaper.sp(25)), + style: TextStyle( + fontSize: ScreenAdaper.sp(25), fontWeight: FontWeight.w600), ), trailing: Text('${trailing ?? ''}', style: TextStyle(fontSize: ScreenAdaper.sp(25)))); diff --git a/lib/screens/inventory_inout/components/upper_body.dart b/lib/screens/inventory_inout/components/upper_body.dart index c5647c8..68da619 100644 --- a/lib/screens/inventory_inout/components/upper_body.dart +++ b/lib/screens/inventory_inout/components/upper_body.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:sk_base_mobile/constants/bg_color.dart'; import 'package:sk_base_mobile/screens/inventory_inout/components/custom_app_bar.dart'; import 'package:sk_base_mobile/screens/inventory_inout/components/date_container.dart'; @@ -19,22 +20,26 @@ class UperBody extends StatelessWidget { CustomAppBar(), SizedBox( height: ScreenAdaper.height(150), - child: ListView.builder( - key: PageStorageKey('${controller.endTime.value}'), - controller: controller.scrollController, - shrinkWrap: true, - reverse: true, - itemCount: controller.daysNum, + child: SmartRefresher( + enablePullDown: false, + enablePullUp: false, scrollDirection: Axis.horizontal, - padding: EdgeInsets.only( - bottom: ScreenAdaper.height(20), top: defaultPadding), - itemBuilder: (context, index) { - return InkWell( - borderRadius: BorderRadius.circular(ScreenAdaper.sp(20)), - onTap: () => controller.setIndex(index), - child: DateContainer(index: index), - ); - }, + reverse: true, + controller: controller.refreshController, + child: ListView.builder( + key: PageStorageKey('${controller.endTime.value}'), + controller: controller.scrollController, + itemCount: controller.daysNum, + padding: EdgeInsets.only( + bottom: ScreenAdaper.height(20), top: defaultPadding), + itemBuilder: (context, index) { + return InkWell( + borderRadius: BorderRadius.circular(ScreenAdaper.sp(20)), + onTap: () => controller.setIndex(index), + child: DateContainer(index: index), + ); + }, + ), ), ), ], diff --git a/lib/screens/inventory_inout/inventory_inout_controller.dart b/lib/screens/inventory_inout/inventory_inout_controller.dart index 9feac5f..dba6329 100644 --- a/lib/screens/inventory_inout/inventory_inout_controller.dart +++ b/lib/screens/inventory_inout/inventory_inout_controller.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:sk_base_mobile/apis/index.dart'; import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/constants/enum.dart'; @@ -31,6 +32,7 @@ class InventoryInoutController extends GetxController { RxInt barIndex = 0.obs; RxList model = [].obs; final ScrollController scrollController = ScrollController(); + final RefreshController refreshController = RefreshController(); final daysNum = 20; RxBool loading = RxBool(false); @override diff --git a/lib/screens/new_inventory_inout/new_inventory_inout.dart b/lib/screens/new_inventory_inout/new_inventory_inout.dart index 5f8e55e..2193d9c 100644 --- a/lib/screens/new_inventory_inout/new_inventory_inout.dart +++ b/lib/screens/new_inventory_inout/new_inventory_inout.dart @@ -24,10 +24,8 @@ class NewInventoryInout extends StatelessWidget { final dictService = Get.find(); final int inOrOut; NewInventoryInout({Key? key, this.inOrOut = InventoryInOrOutEnum.In}) - : controller = Get.find(), - super(key: key) { - controller.inOrOut = inOrOut; - } + : controller = Get.put(NewInventoryInoutController(inOrOut: inOrOut)), + super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/screens/new_inventory_inout/new_inventory_inout_controller.dart b/lib/screens/new_inventory_inout/new_inventory_inout_controller.dart index cdd1b80..eb8e48a 100644 --- a/lib/screens/new_inventory_inout/new_inventory_inout_controller.dart +++ b/lib/screens/new_inventory_inout/new_inventory_inout_controller.dart @@ -132,9 +132,9 @@ class NewInventoryInoutController extends GetxController { return; } payload['quantity'] = quantityTextController.text; - if (payload['quantity'].isEmpty) { + if (payload['quantity'].isEmpty || payload['quantity'] == '0') { SnackBarUtil().info( - '数量不能为空', + '数量必须大于1', ); return; } diff --git a/lib/widgets/loading_indicator.dart b/lib/widgets/loading_indicator.dart index bd899ef..2fdcf53 100644 --- a/lib/widgets/loading_indicator.dart +++ b/lib/widgets/loading_indicator.dart @@ -13,7 +13,7 @@ class LoadingIndicator extends StatelessWidget { Widget build(BuildContext context) { return common ? LoadingAnimationWidget.fourRotatingDots( - color: AppTheme.primaryColorLight, size: ScreenAdaper.sp(50)) + color: AppTheme.primaryColorLight, size: ScreenAdaper.sp(45)) : CupertinoActivityIndicator( animating: animating, color: AppTheme.primaryColor,