分享小程序海报 选中的图片默认为第一张

master
zhangmeng 4 years ago
parent 06154c382c
commit 2aded504a9

@ -339,7 +339,7 @@ class _GoodsPageState extends BaseStoreState<GoodsPage> {
String img = '';
int length = widget.goodsDetail.data.mainPhotos.length;
if (length >= 2)
img = widget.goodsDetail.data.mainPhotos[1].url;
img = widget.goodsDetail.data.mainPhotos[0].url;
if (length >= 1)
img = widget.goodsDetail.data.mainPhotos[0].url;
ShareTool().goodsShare(

@ -162,13 +162,14 @@ class _HomePageState extends BaseStoreState<HomePage>
// AMapFlutterLocation.setApiKey(
// '7225bca14fe7493f9f469315a933f99c', 'e8a8057cfedcdcadcf4e8f2c7f8de982');
_amapFlutterLocation = AMapFlutterLocation();
requestPermission().then((value) {
if (value) {
//
_amapFlutterLocation.onLocationChanged().listen(
(event) {
_weatherLocation = event;
LoggerData.addData(_weatherLocation['city']);
_getWeather();
},
);
@ -463,12 +464,12 @@ class _HomePageState extends BaseStoreState<HomePage>
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 10),
width: ScreenAdapterUtils.setWidth(iconSize),
height: ScreenAdapterUtils.setWidth(iconSize),
width: iconSize * 2.w,
height: iconSize * 2.w,
child: Image.asset(
'assets/home_tab_search.png',
width: ScreenAdapterUtils.setWidth(iconSize),
height: ScreenAdapterUtils.setWidth(iconSize),
width: iconSize * 2.w,
height: iconSize * 2.w,
),
),
Container(

@ -743,8 +743,8 @@ class GoodsItemWidget extends StatelessWidget {
String imgUrl;
GoodsDetailModel imagesModel =
await GoodsDetailModelImpl.getDetailInfo(this.id, UserManager.instance.user.info.id);
if (imagesModel.data.mainPhotos.length>1) {
imgUrl = imagesModel.data.mainPhotos[1].url;
if (imagesModel.data.mainPhotos.length>=1) {
imgUrl = imagesModel.data.mainPhotos[0].url;
} else {
imgUrl = imagesModel.data?.mainPhotos?.first?.url ?? '';
}

@ -156,8 +156,8 @@ class _ShareGoodsPosterPageState extends BaseStoreState<ShareGoodsPosterPage> {
}
// _bottomBarController.setFavorite(_goodsDetail.data.isFavorite);
MainPhotos photo = _goodsDetail.data.mainPhotos[0];
if (_goodsDetail.data.mainPhotos.length >= 2) {
photo = _goodsDetail.data.mainPhotos[1];
if (_goodsDetail.data.mainPhotos.length >= 1) {
photo = _goodsDetail.data.mainPhotos[0];
}
photo.isSelect = true;
photo.isSelectNumber = 1;

Loading…
Cancel
Save