特推多品根据后台配置位置

master
章文轩 4 years ago
parent a3e9cd2a8a
commit 47c88bfb22

@ -63,18 +63,24 @@ class PromotionModel {
class PromotionActivityModel {
int id;
int activitySortId;
String activityUrl;
String logoUrl;
String topUrl;
PromotionActivityModel(
{this.id, this.activityUrl, this.logoUrl, this.topUrl});
{this.id,
this.activityUrl,
this.logoUrl,
this.topUrl,
this.activitySortId});
PromotionActivityModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
activityUrl = json['activityUrl'];
logoUrl = json['logoUrl'];
topUrl = json['topUrl'];
activitySortId = json['activity_sort_id'];
}
Map<String, dynamic> toJson() {
@ -83,6 +89,7 @@ class PromotionActivityModel {
data['activityUrl'] = this.activityUrl;
data['logoUrl'] = this.logoUrl;
data['topUrl'] = this.topUrl;
data['activity_sort_id'] = this.activitySortId;
return data;
}
}

@ -1188,8 +1188,10 @@ class _HomePageState extends BaseStoreState<HomePage>
// fit: BoxFit.fill,
// ),
CachedNetworkImage(
imageUrl: icon, placeholder: (context,url) => Image.asset(
R.ASSETS_PLACEHOLDER_NEW_1X1_A_PNG,fit: BoxFit.fill,
imageUrl: icon,
placeholder: (context, url) => Image.asset(
R.ASSETS_PLACEHOLDER_NEW_1X1_A_PNG,
fit: BoxFit.fill,
)),
),
Container(
@ -1436,12 +1438,28 @@ class _HomePageState extends BaseStoreState<HomePage>
array.addAll(model.data.goodsList);
}
if (model.data.activityList != null && model.data.activityList.length > 0) {
if (model.data.activityList.first.activitySortId != 0) {
if (array.length >= model.data.activityList.first.activitySortId) {
array.insert(model.data.activityList.first.activitySortId - 1,
model.data.activityList.first);
} else {
array.add(model.data.activityList.first);
}
} else {
if (array.length > 3) {
array.insert(3, model.data.activityList.first);
} else {
array.add(model.data.activityList.first);
}
}
// if (array.length > 3) {
// array.insert(3, model.data.activityList.first);
// } else {
// array.add(model.data.activityList.first);
// }
}
// _promotionGoodsList = model.data.goodsList;
_promotionGoodsList = array;
if (mounted) {

@ -3,6 +3,7 @@ import 'package:flutter/widgets.dart';
import 'package:extended_text/extended_text.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:lunar_calendar_converter/lunar_solar_converter.dart';
import 'package:recook/constants/header.dart';
@ -10,6 +11,8 @@ import 'package:recook/constants/styles.dart';
import 'package:recook/models/home_weather_model.dart';
import 'package:recook/utils/date/recook_lunar.dart';
import 'home_weather_detail_page.dart';
class HomeWeatherWidget extends StatefulWidget {
final HomeWeatherModel homeWeatherModel;
final Color backgroundColor;
@ -45,7 +48,12 @@ class HomeWeatherWidgetState extends State<HomeWeatherWidget>
solarDay: nowDateTime.day,
solarMonth: nowDateTime.month);
Lunar lunar = LunarSolarConverter.solarToLunar(solar);
return Container(
return GestureDetector(
onTap: () {
Get.to(HomeWeatherDetailPage());
},
child: Container(
color: _backgroundColor,
child: Column(
children: <Widget>[
@ -162,6 +170,7 @@ class HomeWeatherWidgetState extends State<HomeWeatherWidget>
)
],
),
),
);
}

Loading…
Cancel
Save