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,22 +20,26 @@ class UperBody extends StatelessWidget {
CustomAppBar(), CustomAppBar(),
SizedBox( SizedBox(
height: ScreenAdaper.height(150), height: ScreenAdaper.height(150),
child: ListView.builder( child: SmartRefresher(
key: PageStorageKey<String>('${controller.endTime.value}'), enablePullDown: false,
controller: controller.scrollController, enablePullUp: false,
shrinkWrap: true,
reverse: true,
itemCount: controller.daysNum,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
padding: EdgeInsets.only( reverse: true,
bottom: ScreenAdaper.height(20), top: defaultPadding), controller: controller.refreshController,
itemBuilder: (context, index) { child: ListView.builder(
return InkWell( key: PageStorageKey<String>('${controller.endTime.value}'),
borderRadius: BorderRadius.circular(ScreenAdaper.sp(20)), controller: controller.scrollController,
onTap: () => controller.setIndex(index), itemCount: controller.daysNum,
child: DateContainer(index: index), 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),
);
},
),
), ),
), ),
], ],

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,