|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_native_image/flutter_native_image.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
...
|
...
|
@@ -11,9 +14,13 @@ import 'package:one_key/widgets/system_app_bar.dart'; |
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../models/reserve_img_text.dart';
|
|
|
|
import '../../models/upload_img_model.dart';
|
|
|
|
import '../../provider/marketing_center_provider.dart';
|
|
|
|
import '../../provider/upload_img_provider.dart';
|
|
|
|
import '../../provider/user_model.dart';
|
|
|
|
import '../../res/colors.dart';
|
|
|
|
import '../../utils/event_bus.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
import '../../utils/upload_image_util.dart';
|
|
|
|
import '../../utils/utils.dart';
|
|
...
|
...
|
@@ -44,7 +51,9 @@ class AdditionModel { |
|
|
|
}
|
|
|
|
|
|
|
|
class InvicationAdditionPage extends StatefulWidget {
|
|
|
|
InvicationAdditionPage();
|
|
|
|
final String rid;
|
|
|
|
|
|
|
|
InvicationAdditionPage(this.rid);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<InvicationAdditionPage> createState() => _InvicationAdditionPageState();
|
|
...
|
...
|
@@ -57,6 +66,8 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
final picker = ImagePicker();
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
|
|
|
MarketingCenterProvider marketingCenterProvider;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
...
|
...
|
@@ -81,6 +92,7 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
_getQiniuInfo();
|
|
|
|
getReserveImgText();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -90,6 +102,55 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
await _uploadImageProvider.getQiniuInfo(context, {});
|
|
|
|
}
|
|
|
|
|
|
|
|
getReserveImgText() async {
|
|
|
|
await marketingCenterProvider.getReserveImgText(context, widget.rid);
|
|
|
|
if (marketingCenterProvider.reserveImgText != null) {
|
|
|
|
titleC.text = marketingCenterProvider.reserveImgText.title;
|
|
|
|
for (int i = 0;
|
|
|
|
i < marketingCenterProvider.reserveImgText.content.length;
|
|
|
|
i++) {
|
|
|
|
ContentModel contentModel =
|
|
|
|
marketingCenterProvider.reserveImgText.content[i];
|
|
|
|
if (contentModel.type == '1') {
|
|
|
|
//图片
|
|
|
|
AdditionModel additionModel = AdditionModel();
|
|
|
|
additionModel.content = contentModel.content;
|
|
|
|
additionModel.type = '1';
|
|
|
|
|
|
|
|
additionModel.image = UploadImgModel();
|
|
|
|
additionModel.image.process = 1;
|
|
|
|
additionModel.image.qiniuUrl = contentModel.content;
|
|
|
|
data.add(additionModel);
|
|
|
|
} else {
|
|
|
|
AdditionModel additionModel = AdditionModel();
|
|
|
|
additionModel.content = contentModel.content;
|
|
|
|
additionModel.infoC.text = contentModel.content;
|
|
|
|
additionModel.type = contentModel.type;
|
|
|
|
|
|
|
|
data.add(additionModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// AdditionModel additionModel = AdditionModel();
|
|
|
|
// additionModel.content =
|
|
|
|
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
|
|
|
|
// additionModel.type = '1';
|
|
|
|
// additionModel.order = 0;
|
|
|
|
// additionModel.image = UploadImgModel();
|
|
|
|
// additionModel.image.process = 1;
|
|
|
|
// additionModel.image.qiniuUrl =
|
|
|
|
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
|
|
|
|
|
|
|
|
// AdditionModel additionModel1 = AdditionModel();
|
|
|
|
// additionModel1.content = 'webenkjfkdfjakdfjaldfkjaldfjaldf';
|
|
|
|
// additionModel1.type = '2';
|
|
|
|
// additionModel1.order = 1;
|
|
|
|
|
|
|
|
// data.add(additionModel);
|
|
|
|
// data.add(additionModel1);
|
|
|
|
marketingCenterProvider.notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
...
|
...
|
@@ -99,49 +160,261 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
///#相机拍照,单图选择
|
|
|
|
Future _getFromPictureOrCamera(int index, imageSource) async {
|
|
|
|
final pickedFile = await picker.pickImage(source: imageSource);
|
|
|
|
File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
pickedFile.path,
|
|
|
|
quality: 50,
|
|
|
|
percentage: 50);
|
|
|
|
UploadImgModel imgModel = _uploadImageProvider.getDynamicValue('${index}');
|
|
|
|
setState(() {
|
|
|
|
if (pickedFile == null){
|
|
|
|
|
|
|
|
} else{
|
|
|
|
UploadImgModel uploadImgModel =
|
|
|
|
UploadImgModel(); //图
|
|
|
|
_uploadImageProvider.setDynamicValue(
|
|
|
|
'${data.length}', uploadImgModel);
|
|
|
|
|
|
|
|
AdditionModel additionModel =
|
|
|
|
AdditionModel();
|
|
|
|
// additionModel.content = imgModel.qiniuUrl;
|
|
|
|
additionModel.type = '1';
|
|
|
|
// additionModel.order = data.length;
|
|
|
|
additionModel.image = uploadImgModel;
|
|
|
|
// additionModel.image.process = 1;
|
|
|
|
// additionModel.image.qiniuUrl =
|
|
|
|
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
|
|
|
|
|
|
|
|
data.add(additionModel);
|
|
|
|
File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
pickedFile.path,
|
|
|
|
quality: 50,
|
|
|
|
percentage: 50);
|
|
|
|
UploadImgModel imgModel =
|
|
|
|
_uploadImageProvider.getDynamicValue('${index}');
|
|
|
|
setState(() {
|
|
|
|
if (pickedFile != null) {
|
|
|
|
imgModel.file = File(pickedFile.path);
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
imgModel.file = File(pickedFile.path);
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
|
|
// if (title == '头像') {
|
|
|
|
// _uploadImageProvider.imgSizeTouxiang = 76;
|
|
|
|
// _uploadImageProvider.touxiang.qiniuUrl = null;
|
|
|
|
// } else {
|
|
|
|
// _uploadImageProvider.imgSizeErweima = 76;
|
|
|
|
imgModel.qiniuUrl = null;
|
|
|
|
// }
|
|
|
|
bool need = await Utils.sizeNeed(File(pickedFile.path));
|
|
|
|
File file = File(pickedFile.path);
|
|
|
|
if (need) {
|
|
|
|
file = File(compressedFile.absolute.path);
|
|
|
|
}
|
|
|
|
UploadImageUtil().startUploadOnlyAddition(
|
|
|
|
context, file, index, true, _uploadImageProvider, () {
|
|
|
|
UploadImgModel imgModel =
|
|
|
|
_uploadImageProvider.getDynamicValue('${index}');
|
|
|
|
AdditionModel additionModel = AdditionModel();
|
|
|
|
additionModel.content = imgModel.qiniuUrl;
|
|
|
|
additionModel.type = '1';
|
|
|
|
// additionModel.order = index;
|
|
|
|
additionModel.image = imgModel;
|
|
|
|
// additionModel.image.process = 1;
|
|
|
|
// additionModel.image.qiniuUrl =
|
|
|
|
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
|
|
|
|
|
|
|
|
data[index] = additionModel;
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
// if (title == '头像') {
|
|
|
|
// _uploadImageProvider.imgSizeTouxiang = 76;
|
|
|
|
// _uploadImageProvider.touxiang.qiniuUrl = null;
|
|
|
|
// } else {
|
|
|
|
// _uploadImageProvider.imgSizeErweima = 76;
|
|
|
|
imgModel.qiniuUrl = null;
|
|
|
|
// }
|
|
|
|
bool need = await Utils.sizeNeed(File(pickedFile.path));
|
|
|
|
File file = File(pickedFile.path);
|
|
|
|
if (need) {
|
|
|
|
file = File(compressedFile.absolute.path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> _scrolleWidget() {
|
|
|
|
List<Widget> temp = [];
|
|
|
|
for (AdditionModel item in data) {
|
|
|
|
if (item.type == '1') {
|
|
|
|
if (item.image.qiniuUrl == null && item.image.file == null) {
|
|
|
|
} else {
|
|
|
|
temp.add(Container(
|
|
|
|
key: ValueKey(item),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// double process;
|
|
|
|
// String qiniuUrl;
|
|
|
|
// List<String> tempList = [];
|
|
|
|
// // if (title == '头像') {
|
|
|
|
// process = item.image.process;
|
|
|
|
// qiniuUrl = item.image.qiniuUrl;
|
|
|
|
// // } else {
|
|
|
|
// // process = _uploadImageProvider.erweima.process;
|
|
|
|
// // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// if (qiniuUrl != null &&
|
|
|
|
// qiniuUrl != '') {
|
|
|
|
// // tempList.add(qiniuUrl);
|
|
|
|
|
|
|
|
// // ///没有上传完成的不可以点击
|
|
|
|
// // _showPhotoView(context, 0, tempList);
|
|
|
|
|
|
|
|
// // _uploadImageProvider.firstImage.qiniuUrl = null;
|
|
|
|
// // _uploadImageProvider.firstImage.process = 0;
|
|
|
|
// // setState(() {});
|
|
|
|
// _openModalBottomSheet(context);
|
|
|
|
// // Utils.getPickPermission(context, () {
|
|
|
|
// // _getFromPictureOrCamera(
|
|
|
|
// // _uploadImageProvider.firstImage,
|
|
|
|
// // ImageSource.gallery);
|
|
|
|
// // },
|
|
|
|
// // Platform.isAndroid
|
|
|
|
// // ? Permission.storage
|
|
|
|
// // : Permission.photos);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: Stack(alignment: Alignment.bottomCenter, children: [
|
|
|
|
Stack(clipBehavior: Clip.none, children: [
|
|
|
|
item.image.qiniuUrl != null && item.image.qiniuUrl != ''
|
|
|
|
? Image.network(
|
|
|
|
item.image.qiniuUrl,
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
width: double.infinity,
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(
|
|
|
|
// _uploadImageProvider
|
|
|
|
// .imgSizefirstImage *
|
|
|
|
// 2),
|
|
|
|
)
|
|
|
|
: Image.file(
|
|
|
|
item.image.file,
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
width: double.infinity,
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(
|
|
|
|
// _uploadImageProvider
|
|
|
|
// .imgSizefirstImage *
|
|
|
|
// 2),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
child: (item.image.file != null) &&
|
|
|
|
item.image.process != 1 &&
|
|
|
|
item.image.process != 0.01
|
|
|
|
? Container(
|
|
|
|
width: ScreenUtil().screenWidth,
|
|
|
|
height:
|
|
|
|
w(_uploadImageProvider.imgSizefirstImage),
|
|
|
|
color: MyColours.color_4D000000,
|
|
|
|
child: Center(
|
|
|
|
child: Text('上传中',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_F8F9FD)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container()),
|
|
|
|
]),
|
|
|
|
// item.image.process == 1
|
|
|
|
// ? Container(
|
|
|
|
// width: w(150),
|
|
|
|
// height: w(30),
|
|
|
|
// color: MyColours.color_4D000000,
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// child: Text(
|
|
|
|
// '点击图片可以更换',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours
|
|
|
|
// .color_F8F9FD,
|
|
|
|
// fontSize: font(14),
|
|
|
|
// fontWeight:
|
|
|
|
// FontWeight.bold),
|
|
|
|
// ))
|
|
|
|
// : SizedBox(),
|
|
|
|
item.image.process == 1
|
|
|
|
? Positioned(
|
|
|
|
top: w(15),
|
|
|
|
right: w(15),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
data.remove(item);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: w(30),
|
|
|
|
height: w(30),
|
|
|
|
color: Colors.transparent,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath('add_close')))))
|
|
|
|
: SizedBox(),
|
|
|
|
]))));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
temp.add(Container(
|
|
|
|
key: ValueKey(item),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
|
|
|
|
// child: Text(item.content),
|
|
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
// height: w(152),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(r(5)),
|
|
|
|
border: Border.all(
|
|
|
|
width: w(1), color: MyColours.color_DBDBDB)),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: w(10), top: w(10), bottom: w(10), right: w(60)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: w(16), bottom: w(16), left: w(14), right: w(10)),
|
|
|
|
child: TextField(
|
|
|
|
controller: item.infoC,
|
|
|
|
// textAlign: TextAlign.right,
|
|
|
|
// focusNode: _cusdemNode,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
// textBaseline: TextBaseline.alphabetic
|
|
|
|
),
|
|
|
|
// textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 5,
|
|
|
|
maxLength: 50,
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(10), // 设置输入长度限制
|
|
|
|
// ],
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "点击录入文字",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
),
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
item.content = value;
|
|
|
|
})),
|
|
|
|
Positioned(
|
|
|
|
top: w(10),
|
|
|
|
right: w(10),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
data.remove(item);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: w(30),
|
|
|
|
height: w(30),
|
|
|
|
color: Colors.transparent,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Image.asset(Utils.getImgPath('add_close_b')))))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
UploadImageUtil().startUploadOnlyAddition(
|
|
|
|
context, file, index, true, _uploadImageProvider, () {
|
|
|
|
UploadImgModel imgModel =
|
|
|
|
_uploadImageProvider.getDynamicValue('${index}');
|
|
|
|
AdditionModel additionModel = AdditionModel();
|
|
|
|
additionModel.content = imgModel.qiniuUrl;
|
|
|
|
additionModel.type = '1';
|
|
|
|
// additionModel.order = index;
|
|
|
|
additionModel.image = imgModel;
|
|
|
|
// additionModel.image.process = 1;
|
|
|
|
// additionModel.image.qiniuUrl =
|
|
|
|
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
|
|
|
|
|
|
|
|
data[index] = additionModel;
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
///添加图片UI弹出
|
|
...
|
...
|
@@ -253,6 +526,8 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
Widget build(BuildContext context) {
|
|
|
|
_uploadImageProvider =
|
|
|
|
Provider.of<UploadImageProvider>(context, listen: true);
|
|
|
|
marketingCenterProvider =
|
|
|
|
Provider.of<MarketingCenterProvider>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar('自定义图文'),
|
|
...
|
...
|
@@ -291,9 +566,10 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
),
|
|
|
|
// textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 1,
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(10), // 设置输入长度限制
|
|
|
|
// ],
|
|
|
|
inputFormatters: [
|
|
|
|
LengthLimitingTextInputFormatter(
|
|
|
|
10), // 设置输入长度限制
|
|
|
|
],
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "点击输入区域标题(不超过10个字)",
|
|
|
|
hintStyle: TextStyle(
|
|
...
|
...
|
@@ -327,251 +603,13 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
child: ReorderableListView(
|
|
|
|
shrinkWrap: true,
|
|
|
|
scrollController: controller,
|
|
|
|
children: <Widget>[
|
|
|
|
for (AdditionModel item in data)
|
|
|
|
item.type == '1'
|
|
|
|
? item.image.qiniuUrl == null &&
|
|
|
|
item.image.file == null
|
|
|
|
? SizedBox()
|
|
|
|
: Container(
|
|
|
|
key: ValueKey(item),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// double process;
|
|
|
|
// String qiniuUrl;
|
|
|
|
// List<String> tempList = [];
|
|
|
|
// // if (title == '头像') {
|
|
|
|
// process = item.image.process;
|
|
|
|
// qiniuUrl = item.image.qiniuUrl;
|
|
|
|
// // } else {
|
|
|
|
// // process = _uploadImageProvider.erweima.process;
|
|
|
|
// // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
|
|
|
|
// // }
|
|
|
|
|
|
|
|
// if (qiniuUrl != null &&
|
|
|
|
// qiniuUrl != '') {
|
|
|
|
// // tempList.add(qiniuUrl);
|
|
|
|
|
|
|
|
// // ///没有上传完成的不可以点击
|
|
|
|
// // _showPhotoView(context, 0, tempList);
|
|
|
|
|
|
|
|
// // _uploadImageProvider.firstImage.qiniuUrl = null;
|
|
|
|
// // _uploadImageProvider.firstImage.process = 0;
|
|
|
|
// // setState(() {});
|
|
|
|
// _openModalBottomSheet(context);
|
|
|
|
// // Utils.getPickPermission(context, () {
|
|
|
|
// // _getFromPictureOrCamera(
|
|
|
|
// // _uploadImageProvider.firstImage,
|
|
|
|
// // ImageSource.gallery);
|
|
|
|
// // },
|
|
|
|
// // Platform.isAndroid
|
|
|
|
// // ? Permission.storage
|
|
|
|
// // : Permission.photos);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment
|
|
|
|
.bottomCenter,
|
|
|
|
children: [
|
|
|
|
Stack(
|
|
|
|
clipBehavior:
|
|
|
|
Clip.none,
|
|
|
|
children: [
|
|
|
|
item.image.qiniuUrl !=
|
|
|
|
null &&
|
|
|
|
item.image
|
|
|
|
.qiniuUrl !=
|
|
|
|
''
|
|
|
|
? Image
|
|
|
|
.network(
|
|
|
|
item.image
|
|
|
|
.qiniuUrl,
|
|
|
|
fit: BoxFit
|
|
|
|
.contain,
|
|
|
|
width: double
|
|
|
|
.infinity,
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(
|
|
|
|
// _uploadImageProvider
|
|
|
|
// .imgSizefirstImage *
|
|
|
|
// 2),
|
|
|
|
)
|
|
|
|
: Image.file(
|
|
|
|
item.image
|
|
|
|
.file,
|
|
|
|
fit: BoxFit
|
|
|
|
.contain,
|
|
|
|
width: double
|
|
|
|
.infinity,
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(
|
|
|
|
// _uploadImageProvider
|
|
|
|
// .imgSizefirstImage *
|
|
|
|
// 2),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
child: (item.image.file != null) &&
|
|
|
|
item.image.process !=
|
|
|
|
1 &&
|
|
|
|
item.image.process !=
|
|
|
|
0.01
|
|
|
|
? Container(
|
|
|
|
width:
|
|
|
|
ScreenUtil().screenWidth,
|
|
|
|
height:
|
|
|
|
w(_uploadImageProvider.imgSizefirstImage),
|
|
|
|
color:
|
|
|
|
MyColours.color_4D000000,
|
|
|
|
child:
|
|
|
|
Center(
|
|
|
|
child:
|
|
|
|
Text('上传中', style: TextStyle(color: MyColours.color_F8F9FD)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container()),
|
|
|
|
]),
|
|
|
|
// item.image.process == 1
|
|
|
|
// ? Container(
|
|
|
|
// width: w(150),
|
|
|
|
// height: w(30),
|
|
|
|
// color: MyColours.color_4D000000,
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// child: Text(
|
|
|
|
// '点击图片可以更换',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours
|
|
|
|
// .color_F8F9FD,
|
|
|
|
// fontSize: font(14),
|
|
|
|
// fontWeight:
|
|
|
|
// FontWeight.bold),
|
|
|
|
// ))
|
|
|
|
// : SizedBox(),
|
|
|
|
item.image.process == 1
|
|
|
|
? Positioned(
|
|
|
|
top: w(15),
|
|
|
|
right: w(15),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
data.remove(
|
|
|
|
item);
|
|
|
|
setState(
|
|
|
|
() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: w(
|
|
|
|
30),
|
|
|
|
height: w(
|
|
|
|
30),
|
|
|
|
color: Colors
|
|
|
|
.transparent,
|
|
|
|
alignment:
|
|
|
|
Alignment
|
|
|
|
.center,
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath('add_close')))))
|
|
|
|
: SizedBox(),
|
|
|
|
])))
|
|
|
|
: Container(
|
|
|
|
key: ValueKey(item),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
width: w(1),
|
|
|
|
color:
|
|
|
|
MyColours.color_DBDBDB)),
|
|
|
|
// child: Text(item.content),
|
|
|
|
|
|
|
|
// color: Colors.red,
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
// height: w(152),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
r(5)),
|
|
|
|
border: Border.all(
|
|
|
|
width: w(1),
|
|
|
|
color: MyColours
|
|
|
|
.color_DBDBDB)),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: w(10),
|
|
|
|
top: w(10),
|
|
|
|
bottom: w(10),
|
|
|
|
right: w(60)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: w(16),
|
|
|
|
bottom: w(16),
|
|
|
|
left: w(14),
|
|
|
|
right: w(10)),
|
|
|
|
child: TextField(
|
|
|
|
controller: item.infoC,
|
|
|
|
// textAlign: TextAlign.right,
|
|
|
|
// focusNode: _cusdemNode,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_515151,
|
|
|
|
fontSize: ScreenUtil()
|
|
|
|
.setSp(28),
|
|
|
|
// textBaseline: TextBaseline.alphabetic
|
|
|
|
),
|
|
|
|
// textAlignVertical: TextAlignVertical.center,
|
|
|
|
maxLines: 5,
|
|
|
|
maxLength: 50,
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(10), // 设置输入长度限制
|
|
|
|
// ],
|
|
|
|
decoration:
|
|
|
|
InputDecoration(
|
|
|
|
hintText: "点击录入文字",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_999999,
|
|
|
|
fontSize: ScreenUtil()
|
|
|
|
.setSp(28),
|
|
|
|
),
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.zero,
|
|
|
|
border:
|
|
|
|
OutlineInputBorder(
|
|
|
|
borderSide:
|
|
|
|
BorderSide
|
|
|
|
.none),
|
|
|
|
),
|
|
|
|
keyboardType:
|
|
|
|
TextInputType.text,
|
|
|
|
onChanged: (value) {
|
|
|
|
item.content = value;
|
|
|
|
})),
|
|
|
|
Positioned(
|
|
|
|
top: w(10),
|
|
|
|
right: w(10),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
data.remove(item);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: w(30),
|
|
|
|
height: w(30),
|
|
|
|
color: Colors
|
|
|
|
.transparent,
|
|
|
|
alignment:
|
|
|
|
Alignment.center,
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'add_close_b')))))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
children: _scrolleWidget(),
|
|
|
|
onReorder: (int oldIndex, int newIndex) async {
|
|
|
|
print(newIndex);
|
|
|
|
if (oldIndex < newIndex) {
|
|
|
|
newIndex -= 1;
|
|
|
|
}
|
|
|
|
print(newIndex);
|
|
|
|
|
|
|
|
// var childold = tableManagerModel.areas[oldIndex];
|
|
|
|
// Map<String, String> params = {
|
|
...
|
...
|
@@ -597,24 +635,9 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
UploadImgModel uploadImgModel =
|
|
|
|
UploadImgModel(); //图
|
|
|
|
_uploadImageProvider.setDynamicValue(
|
|
|
|
'${data.length}', uploadImgModel);
|
|
|
|
|
|
|
|
AdditionModel additionModel =
|
|
|
|
AdditionModel();
|
|
|
|
// additionModel.content = imgModel.qiniuUrl;
|
|
|
|
additionModel.type = '1';
|
|
|
|
// additionModel.order = data.length;
|
|
|
|
additionModel.image = uploadImgModel;
|
|
|
|
// additionModel.image.process = 1;
|
|
|
|
// additionModel.image.qiniuUrl =
|
|
|
|
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
|
|
|
|
|
|
|
|
data.add(additionModel);
|
|
|
|
|
|
|
|
_openModalBottomSheet(
|
|
|
|
context, data.length - 1);
|
|
|
|
context, data.length);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: w(77),
|
|
...
|
...
|
@@ -700,11 +723,55 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { |
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () async {
|
|
|
|
// _createReserveDeposit();
|
|
|
|
// print(data);
|
|
|
|
// print(titleC.text);
|
|
|
|
print(data);
|
|
|
|
print(titleC.text);
|
|
|
|
print(data);
|
|
|
|
|
|
|
|
bool can = true;
|
|
|
|
innerloop:
|
|
|
|
for (AdditionModel item in data) {
|
|
|
|
if (item.type == '1' && item.image.process < 1) {
|
|
|
|
Utils.showToast('正在上传图片,请稍等');
|
|
|
|
// return false;
|
|
|
|
can = false;
|
|
|
|
break innerloop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.removeWhere((element) => element.type == '2'&& (element.infoC.text.trim() == ''||element.infoC.text ==null) );
|
|
|
|
if (can) {
|
|
|
|
List temp = [];
|
|
|
|
for (int i = 0; i < data.length; i++) {
|
|
|
|
AdditionModel element = data[i];
|
|
|
|
temp.add({
|
|
|
|
'type': element.type,
|
|
|
|
'content': element.type == '2'
|
|
|
|
? element.infoC.text
|
|
|
|
: element.image.qiniuUrl,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
'rid': widget.rid,
|
|
|
|
'uid': Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.openid,
|
|
|
|
'title': titleC.text,
|
|
|
|
'content': jsonEncode(temp)
|
|
|
|
};
|
|
|
|
|
|
|
|
if (marketingCenterProvider.reserveImgText != null) {
|
|
|
|
params['id'] =
|
|
|
|
marketingCenterProvider.reserveImgText.id;
|
|
|
|
}
|
|
|
|
bool success = await marketingCenterProvider.setReserveImgText(
|
|
|
|
context, params);
|
|
|
|
if (success){
|
|
|
|
bus.emit('getReserveImgText');
|
|
|
|
Navigator.pop(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
],
|
...
|
...
|
|