fix: inout controller missing error

This commit is contained in:
louis 2024-03-26 16:47:24 +08:00
parent fbd129c90b
commit 845c37e253
6 changed files with 29 additions and 26 deletions

View File

@ -1,16 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.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/apis/index.dart';
import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/config.dart'; import 'package:sk_base_mobile/config.dart';
import 'package:sk_base_mobile/constants/bg_color.dart'; import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/constants.dart'; import 'package:sk_base_mobile/constants/constants.dart';
import 'package:sk_base_mobile/models/index.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/date.util.dart';
import 'package:sk_base_mobile/util/screen_adaper_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/fade_in_cache_image.dart';
import 'package:sk_base_mobile/widgets/image_preview.dart'; import 'package:sk_base_mobile/widgets/image_preview.dart';
import 'package:sk_base_mobile/widgets/loading_indicator.dart'; import 'package:sk_base_mobile/widgets/loading_indicator.dart';
@ -162,7 +159,8 @@ class InventoryInoutInfo extends StatelessWidget {
return ListTile( return ListTile(
leading: Text( leading: Text(
'${leading ?? ''}: ', '${leading ?? ''}: ',
style: TextStyle(fontSize: ScreenAdaper.sp(25)), style: TextStyle(
fontSize: ScreenAdaper.sp(25), fontWeight: FontWeight.w600),
), ),
trailing: Text('${trailing ?? ''}', trailing: Text('${trailing ?? ''}',
style: TextStyle(fontSize: ScreenAdaper.sp(25)))); style: TextStyle(fontSize: ScreenAdaper.sp(25))));

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.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/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/custom_app_bar.dart';
import 'package:sk_base_mobile/screens/inventory_inout/components/date_container.dart'; import 'package:sk_base_mobile/screens/inventory_inout/components/date_container.dart';
@ -19,13 +20,16 @@ class UperBody extends StatelessWidget {
CustomAppBar(), CustomAppBar(),
SizedBox( SizedBox(
height: ScreenAdaper.height(150), height: ScreenAdaper.height(150),
child: SmartRefresher(
enablePullDown: false,
enablePullUp: false,
scrollDirection: Axis.horizontal,
reverse: true,
controller: controller.refreshController,
child: ListView.builder( child: ListView.builder(
key: PageStorageKey<String>('${controller.endTime.value}'), key: PageStorageKey<String>('${controller.endTime.value}'),
controller: controller.scrollController, controller: controller.scrollController,
shrinkWrap: true,
reverse: true,
itemCount: controller.daysNum, itemCount: controller.daysNum,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: ScreenAdaper.height(20), top: defaultPadding), bottom: ScreenAdaper.height(20), top: defaultPadding),
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -37,6 +41,7 @@ class UperBody extends StatelessWidget {
}, },
), ),
), ),
),
], ],
); );
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.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/apis/index.dart';
import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/constants/enum.dart'; import 'package:sk_base_mobile/constants/enum.dart';
@ -31,6 +32,7 @@ class InventoryInoutController extends GetxController {
RxInt barIndex = 0.obs; RxInt barIndex = 0.obs;
RxList model = [].obs; RxList model = [].obs;
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController();
final daysNum = 20; final daysNum = 20;
RxBool loading = RxBool(false); RxBool loading = RxBool(false);
@override @override

View File

@ -24,10 +24,8 @@ class NewInventoryInout extends StatelessWidget {
final dictService = Get.find<DictService>(); final dictService = Get.find<DictService>();
final int inOrOut; final int inOrOut;
NewInventoryInout({Key? key, this.inOrOut = InventoryInOrOutEnum.In}) NewInventoryInout({Key? key, this.inOrOut = InventoryInOrOutEnum.In})
: controller = Get.find<NewInventoryInoutController>(), : controller = Get.put(NewInventoryInoutController(inOrOut: inOrOut)),
super(key: key) { super(key: key);
controller.inOrOut = inOrOut;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -132,9 +132,9 @@ class NewInventoryInoutController extends GetxController {
return; return;
} }
payload['quantity'] = quantityTextController.text; payload['quantity'] = quantityTextController.text;
if (payload['quantity'].isEmpty) { if (payload['quantity'].isEmpty || payload['quantity'] == '0') {
SnackBarUtil().info( SnackBarUtil().info(
'数量不能为空', '数量必须大于1',
); );
return; return;
} }

View File

@ -13,7 +13,7 @@ class LoadingIndicator extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return common return common
? LoadingAnimationWidget.fourRotatingDots( ? LoadingAnimationWidget.fourRotatingDots(
color: AppTheme.primaryColorLight, size: ScreenAdaper.sp(50)) color: AppTheme.primaryColorLight, size: ScreenAdaper.sp(45))
: CupertinoActivityIndicator( : CupertinoActivityIndicator(
animating: animating, animating: animating,
color: AppTheme.primaryColor, color: AppTheme.primaryColor,