|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../models/wine_manage_model.dart';
|
|
|
|
import '../../../provider/upload_img_provider.dart';
|
|
|
|
import '../../../res/colors.dart';
|
|
|
|
import '../../../utils/screen_util.dart';
|
|
|
|
import '../../../utils/upload_image_util.dart';
|
|
|
|
import '../../../utils/utils.dart';
|
|
|
|
import '../../../widgets/MyDivider.dart';
|
|
|
|
import '../../../widgets/v_empty_view.dart';
|
|
|
|
import '../../online_check/img_picker_widget.dart';
|
|
|
|
import '../../online_check/photo_view_wiget.dart';
|
|
|
|
|
|
|
|
//出库申请item
|
|
|
|
|
|
|
|
class ApplyOutStoreItemPage extends StatefulWidget {
|
|
|
|
final WineManageModel wineManageModel;
|
|
|
|
final ScrollController controller;
|
|
|
|
final int index;
|
|
|
|
|
|
|
|
ApplyOutStoreItemPage(
|
|
|
|
{Key key, this.wineManageModel, this.controller, this.index})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_ApplyOutStoreItemPageState createState() => _ApplyOutStoreItemPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> {
|
|
|
|
Widget _textFieldWidget(
|
|
|
|
String title, String hintText, TextEditingController controller) {
|
|
|
|
return Column(children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(48 * 2),
|
|
|
|
padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(16)),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(16 * 2),
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_515151),
|
|
|
|
controller: controller,
|
|
|
|
// focusNode: _phoneNode,
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
textAlignVertical: TextAlignVertical.center,
|
|
|
|
|
|
|
|
// textAlignVertical:
|
|
|
|
// TextAlignVertical.center,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: hintText,
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
// contentPadding:
|
|
|
|
// EdgeInsets.symmetric(
|
|
|
|
// vertical: w(12)),
|
|
|
|
border:
|
|
|
|
OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
print(value);
|
|
|
|
// if (value.trim().isEmpty || value.trim().length > 11) {
|
|
|
|
// //内容为空,或 超过11位
|
|
|
|
// setState(() {
|
|
|
|
// _baseIndoProvider.userHistorys.clear();
|
|
|
|
// });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// "keywords": value.trim(),
|
|
|
|
// "sid": Provider.of<UserModel>(context, listen: false)
|
|
|
|
// .user
|
|
|
|
// .sellerid,
|
|
|
|
// };
|
|
|
|
// _baseIndoProvider.getUserHistorys(context, params);
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode());
|
|
|
|
},
|
|
|
|
onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// showPhoneHistory = true;
|
|
|
|
// });
|
|
|
|
// Future.delayed(Duration(milliseconds: 300), () {
|
|
|
|
// _controller.jumpTo(_controller.position.maxScrollExtent);
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
))),
|
|
|
|
// InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// // _openAddressBook();
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// width: ScreenUtil().setWidth(74) * 2,
|
|
|
|
// height: ScreenUtil().setWidth(48),
|
|
|
|
// alignment: Alignment.centerRight,
|
|
|
|
// child: Text('一键录入',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_515151,
|
|
|
|
// fontSize: ScreenUtil().setSp(28),
|
|
|
|
// )),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
h(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _textWidget(String title, String subTitle) {
|
|
|
|
return Column(children: [
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(48 * 2),
|
|
|
|
padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(16)),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(16 * 2),
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Text(
|
|
|
|
subTitle,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_999999),
|
|
|
|
)),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
h(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
//查看大图
|
|
|
|
_showPhotoView(BuildContext context, int index, List<String> imgs,
|
|
|
|
{isShow = false, List dashName}) async {
|
|
|
|
// if (imgs.length == 1 &&
|
|
|
|
// imgs[0] ==
|
|
|
|
// 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
|
|
|
|
// imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
|
|
|
|
// }
|
|
|
|
Utils.setBarStatus(false, color: Colors.black);
|
|
|
|
dynamic result = await showGeneralDialog(
|
|
|
|
context: context,
|
|
|
|
barrierDismissible: false,
|
|
|
|
// barrierColor: Colors.red,
|
|
|
|
barrierLabel:
|
|
|
|
MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
|
transitionDuration: const Duration(milliseconds: 150),
|
|
|
|
pageBuilder: (BuildContext context, Animation animation,
|
|
|
|
Animation secondaryAnimation) {
|
|
|
|
Widget child = Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
PhotoPreview(
|
|
|
|
initialIndex: index,
|
|
|
|
photoList: imgs,
|
|
|
|
isShow: isShow,
|
|
|
|
dashName: dashName)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
return child;
|
|
|
|
});
|
|
|
|
Utils.setBarStatus(true, color: Colors.white);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 九宫格
|
|
|
|
Widget _getGridImg(context, List<String> temp) {
|
|
|
|
return GridView.builder(
|
|
|
|
controller: widget.controller,
|
|
|
|
// padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: temp.length,
|
|
|
|
|
|
|
|
//SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
//横轴元素个数
|
|
|
|
crossAxisCount: 3,
|
|
|
|
//纵轴间距
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(40),
|
|
|
|
//横轴间距
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(36),
|
|
|
|
//子组件宽高长度比例
|
|
|
|
childAspectRatio: 1.0),
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
//Widget Function(BuildContext context, int index)
|
|
|
|
|
|
|
|
return temp.length < 1
|
|
|
|
? Text('')
|
|
|
|
: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
///没有上传完成的不可以点击
|
|
|
|
_showPhotoView(context, index, temp);
|
|
|
|
},
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
imageUrl: temp[index],
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: ScreenUtil().setWidth(100 * 2),
|
|
|
|
height: ScreenUtil().setWidth(100 * 2),
|
|
|
|
));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
margin:
|
|
|
|
EdgeInsets.only(top: w(16), bottom: w(10), left: w(20), right: w(20)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
_textWidget(
|
|
|
|
'酒品名称',
|
|
|
|
"酒名",
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
_textFieldWidget('出库数量', '数量', widget.wineManageModel.wineNumC),
|
|
|
|
VEmptyView(16),
|
|
|
|
_textWidget('计量单位', '计量单位'),
|
|
|
|
VEmptyView(16),
|
|
|
|
_textWidget('存酒编号', '存酒编号'),
|
|
|
|
VEmptyView(16),
|
|
|
|
_textWidget('存酒日期', '2023-02-14 15:34:23'),
|
|
|
|
VEmptyView(16),
|
|
|
|
_getGridImg(context, widget.wineManageModel.imageData),
|
|
|
|
VEmptyView(16),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|