|
|
@ -31,6 +31,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> { |
|
|
|
int dynamicType = 0; |
|
|
|
int dynamicType = 0; |
|
|
|
TextEditingController textController = TextEditingController(); |
|
|
|
TextEditingController textController = TextEditingController(); |
|
|
|
TextEditingController addressController = TextEditingController(); |
|
|
|
TextEditingController addressController = TextEditingController(); |
|
|
|
|
|
|
|
|
|
|
|
// TextEditingController houseNumberController = TextEditingController(); |
|
|
|
// TextEditingController houseNumberController = TextEditingController(); |
|
|
|
ApiService apiService; |
|
|
|
ApiService apiService; |
|
|
|
Map addressMap; |
|
|
|
Map addressMap; |
|
|
@ -86,75 +87,80 @@ class _ReleaseDynamic extends State<ReleaseDynamic> { |
|
|
|
releaseDynamic(); |
|
|
|
releaseDynamic(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
body: Container( |
|
|
|
body: GestureDetector( |
|
|
|
child: Column( |
|
|
|
behavior: HitTestBehavior.translucent, |
|
|
|
children: [ |
|
|
|
onTap: () { |
|
|
|
buildEdit(), |
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); |
|
|
|
Container( |
|
|
|
}, |
|
|
|
width: double.infinity, |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.all(16), |
|
|
|
child: Column( |
|
|
|
padding: EdgeInsets.only(left: 16, right: 16), |
|
|
|
children: [ |
|
|
|
child: Row( |
|
|
|
buildEdit(), |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
Container( |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
width: double.infinity, |
|
|
|
children: [ |
|
|
|
margin: EdgeInsets.all(16), |
|
|
|
Text( |
|
|
|
padding: EdgeInsets.only(left: 16, right: 16), |
|
|
|
"!", |
|
|
|
child: Row( |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
style: TextStyle( |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
children: [ |
|
|
|
fontSize: 14.sp, |
|
|
|
Text( |
|
|
|
color: Colors.red, |
|
|
|
"!", |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
style: TextStyle( |
|
|
|
SizedBox( |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
width: 10, |
|
|
|
fontSize: 14.sp, |
|
|
|
), |
|
|
|
color: Colors.red, |
|
|
|
Expanded( |
|
|
|
), |
|
|
|
child: Text( |
|
|
|
|
|
|
|
"用户发布内容需要等待系统审核,审核通过后才会在推荐广场展示", |
|
|
|
|
|
|
|
maxLines: 2, |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
color: Color(0xFFB3B2B2), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox( |
|
|
|
) |
|
|
|
width: 10, |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Expanded( |
|
|
|
), |
|
|
|
child: Text( |
|
|
|
Expanded( |
|
|
|
"用户发布内容需要等待系统审核,审核通过后才会在推荐广场展示", |
|
|
|
child: GridView.builder( |
|
|
|
maxLines: 2, |
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
crossAxisCount: 3, |
|
|
|
style: TextStyle( |
|
|
|
crossAxisSpacing: 12.w, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
mainAxisSpacing: 12.w, |
|
|
|
fontSize: 12.sp, |
|
|
|
childAspectRatio: 1, |
|
|
|
color: Color(0xFFB3B2B2), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
padding: EdgeInsets.all(16), |
|
|
|
Expanded( |
|
|
|
shrinkWrap: true, |
|
|
|
child: GridView.builder( |
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
|
|
|
itemBuilder: (context, position) { |
|
|
|
crossAxisCount: 3, |
|
|
|
if (mediaPaths.length > position) { |
|
|
|
crossAxisSpacing: 12.w, |
|
|
|
return imageItem(mediaPaths[position]); |
|
|
|
mainAxisSpacing: 12.w, |
|
|
|
} else { |
|
|
|
childAspectRatio: 1, |
|
|
|
return addImageItem(); |
|
|
|
), |
|
|
|
} |
|
|
|
padding: EdgeInsets.all(16), |
|
|
|
}, |
|
|
|
shrinkWrap: true, |
|
|
|
itemCount: (mediaPaths.length == 0) |
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
? 1 |
|
|
|
itemBuilder: (context, position) { |
|
|
|
: ((dynamicType == 2) |
|
|
|
if (mediaPaths.length > position) { |
|
|
|
|
|
|
|
return imageItem(mediaPaths[position]); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return addImageItem(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
itemCount: (mediaPaths.length == 0) |
|
|
|
? 1 |
|
|
|
? 1 |
|
|
|
: mediaPaths.length >= 9 |
|
|
|
: ((dynamicType == 2) |
|
|
|
? 9 |
|
|
|
? 1 |
|
|
|
: (mediaPaths.length + 1)), |
|
|
|
: mediaPaths.length >= 9 |
|
|
|
), |
|
|
|
? 9 |
|
|
|
|
|
|
|
: (mediaPaths.length + 1)), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
)), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -195,18 +201,18 @@ class _ReleaseDynamic extends State<ReleaseDynamic> { |
|
|
|
"video": remoteVideoUrl, |
|
|
|
"video": remoteVideoUrl, |
|
|
|
"coverImg": remoteVideoCoverImg, |
|
|
|
"coverImg": remoteVideoCoverImg, |
|
|
|
"latitude": "", |
|
|
|
"latitude": "", |
|
|
|
"location": addressController.text == "" |
|
|
|
"location": addressController.text == "" ? "" : addressController.text, |
|
|
|
? "" |
|
|
|
|
|
|
|
: addressController.text, |
|
|
|
|
|
|
|
"longitude": "", |
|
|
|
"longitude": "", |
|
|
|
}).catchError((onError) { |
|
|
|
}).catchError((onError) { |
|
|
|
EasyLoading.dismiss(); |
|
|
|
EasyLoading.dismiss(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
SmartDialog.showToast("发布成功!"); |
|
|
|
SmartDialog.showToast("发布成功!"); |
|
|
|
Future.delayed(Duration(seconds: 1), () { |
|
|
|
Future.delayed(Duration(seconds: 1), () { |
|
|
|
Navigator.of(context).pop(true); |
|
|
|
Navigator.of(context).pop(true); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
} |
|
|
|
} |
|
|
|
EasyLoading.dismiss(); |
|
|
|
EasyLoading.dismiss(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -446,8 +452,6 @@ class _ReleaseDynamic extends State<ReleaseDynamic> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///动态输入框 |
|
|
|
///动态输入框 |
|
|
|
Widget buildEdit() { |
|
|
|
Widget buildEdit() { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
@ -504,7 +508,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> { |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
toMap(); |
|
|
|
toMap(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
child:Row( |
|
|
|
child: Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
@ -519,7 +523,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> { |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
addressController.text == "" |
|
|
|
addressController.text == "" |
|
|
|
? "你在哪里呢?" |
|
|
|
? "你在哪里呢?" |
|
|
|
: addressController.text , |
|
|
|
: addressController.text, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.sp, |
|
|
|
fontSize: 11.sp, |
|
|
|