Преглед изворни кода

1.修复我的页面背景闪烁问题

2.增加进入app时加载配置失败等的弹窗提示
3.优化多眼导航的行数显示
4.适配智能粘贴板的无操作行为
tags/0.0.3+3
“yanghuaxuan” пре 3 година
родитељ
комит
7600cd19ac
14 измењених фајлова са 227 додато и 117 уклоњено
  1. +16
    -22
      lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart
  2. +1
    -1
      lib/dialog/global_dialog/policy_dialog/policy_dialog.dart
  3. +9
    -3
      lib/pages/home_page/home_page.dart
  4. +12
    -3
      lib/pages/launch_page/launch_page.dart
  5. +32
    -12
      lib/pages/main_page/main_page.dart
  6. +1
    -1
      lib/pages/main_page/main_page_bloc.dart
  7. +1
    -1
      lib/register.dart
  8. +10
    -0
      lib/widgets/custom/multi_nav/custom_quick_entry.dart
  9. +94
    -47
      lib/widgets/home/home_goods/home_goods_item_single.dart
  10. +14
    -7
      lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart
  11. +5
    -3
      lib/widgets/hot_ranking/hot_ranking_list/model/hot_ranking_list_data_model.dart
  12. +0
    -1
      lib/widgets/mine/mine_header/mine_header_static_container.dart
  13. +14
    -10
      lib/widgets/mine/mine_nav/mine_nav_bg.dart
  14. +18
    -6
      lib/widgets/others/mine_header_bg_widget.dart

+ 16
- 22
lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart Прегледај датотеку

@@ -25,6 +25,7 @@ class IntellectCreate {
try {
_requestSetData(context);
} catch (e, s) {
isRequest = false;
print(e);
print(s);
}
@@ -45,27 +46,22 @@ class IntellectCreate {
var param = {"webId": ""};

//请求参数
await NetUtil.request('/api/v1/cfg/clipboard_base', params: param,
onSuccess: (data) async {
await NetUtil.request('/api/v1/cfg/clipboard_base', params: param, onSuccess: (data) async {
print("设置参数" + data.toString());

///检查是否已缓存过设置信息
String result = await SharedPreferencesUtil.getStringValue(
Constants.spIsCacheSetModel);
_setModel = IntellectSearchSetModel.fromJson(
json.decode(data['clipboard_base']));
String result = await SharedPreferencesUtil.getStringValue(Constants.spIsCacheSetModel);
_setModel = IntellectSearchSetModel.fromJson(json.decode(data['clipboard_base']));
if (result == null || result.isEmpty) {
validate(context, _setModel);
}
SharedPreferencesUtil.setNetCacheResult(
Constants.spIsCacheSetModel, data['clipboard_base']);
SharedPreferencesUtil.setNetCacheResult(Constants.spIsCacheSetModel, data['clipboard_base']);
});

isRequest = false;

///拿缓存数据
var cacheData = await SharedPreferencesUtil.getNetCacheResult(
Constants.spIsCacheSetModel);
var cacheData = await SharedPreferencesUtil.getNetCacheResult(Constants.spIsCacheSetModel);

///如果存在缓存直接进入验证阶段
if (cacheData != null) {
@@ -88,20 +84,21 @@ class IntellectCreate {
// content =
// "6緮置内容 Http:/T¢ZKkjceixTjW¢转移至ta0寶【URBANISTA/爱班Stockholm斯德哥尔摩 真无线蓝牙运动耳机半入耳式】";
var params = {"content": content};
NetUtil.request("/api/v1/clipboard/parse",
params: params, method: NetMethod.POST, onSuccess: (data) async {
NetUtil.request("/api/v1/clipboard/parse", params: params, method: NetMethod.POST, onSuccess: (data) async {
print(data);
isRequest = false;
if (data == null || data.toString().length == 0) {
///弹起存在不存在商品的弹窗
if (!Constants.isShowIntellectDialog) {
Constants.isShowIntellectDialog = true;
await showDialog(
context: context, child: IntellectSearchNoGoodsDialog());
await showDialog(context: context, child: IntellectSearchNoGoodsDialog());
Constants.isShowIntellectDialog = false;
}
} else if (data.toString() == "403032") {
//啥也不干
} else {
IntellectDialogDataModel model =
IntellectDialogDataModel.fromJson(data);
///弹起存在商品的弹窗
IntellectDialogDataModel model = IntellectDialogDataModel.fromJson(data);
if (!Constants.isShowIntellectDialog) {
Constants.isShowIntellectDialog = true;
await showDialog(
@@ -116,8 +113,7 @@ class IntellectCreate {
}

///检查字段是否被监听
static void validate(
BuildContext context, IntellectSearchSetModel setModel) async {
static void validate(BuildContext context, IntellectSearchSetModel setModel) async {
ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain);
String content = data?.text?.trim() ?? "";
//是否监听
@@ -130,9 +126,7 @@ class IntellectCreate {
}

///长度大小限制
if (setModel.isKeyLength == "1" &&
(int.tryParse(setModel.keyLengthMin) > content.length) ||
(int.tryParse(setModel.keyLengthMax) < content.length)) {
if (setModel.isKeyLength == "1" && (int.tryParse(setModel.keyLengthMin) > content.length) || (int.tryParse(setModel.keyLengthMax) < content.length)) {
return;
}

@@ -151,7 +145,7 @@ class IntellectCreate {
return;
}

///是否包含某个排除词
///是否包含某个排除词,如果是则不监听
if (setModel.banWords != null && setModel.banWords.length > 0) {
for (var item in setModel.banWords) {
if (contains(content, item)) {


+ 1
- 1
lib/dialog/global_dialog/policy_dialog/policy_dialog.dart Прегледај датотеку

@@ -175,7 +175,7 @@ class _PolicyDialogState extends State<PolicyDialog> {
text: '',
style: TextStyle(
height: 1.2,
fontSize: 12,
fontSize: 14,
color: HexColor.fromHex('#555555'),
),
children: texts,


+ 9
- 3
lib/pages/home_page/home_page.dart Прегледај датотеку

@@ -156,9 +156,15 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
onTap: ((index) async {
BaseTabModel model = BaseTabModel.fromJson(tabs[index]);
if (await _checkLimit(model)) {
setState(() {
_currentIndex = index;
});
///避免同一个页面多次点击多次重绘
if(_currentIndex==index){
return;
}else{
setState(() {
_currentIndex = index;
});
}

}
}),
//底部导航栏


+ 12
- 3
lib/pages/launch_page/launch_page.dart Прегледај датотеку

@@ -4,6 +4,8 @@ import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:zhiying_base_widget/dialog/tip_dialog/tip_dialog.dart';
import 'package:zhiying_base_widget/models/app_config_model.dart';
import 'package:zhiying_base_widget/pages/guide_page/guide_page.dart';
import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
@@ -27,7 +29,7 @@ class LaunchPage extends StatefulWidget {
class _LaunchPageState extends State<LaunchPage> {
@override
void initState() {
Connectivity().checkConnectivity().then((connectivityResult) {
Connectivity().checkConnectivity().then((connectivityResult) async {
if (connectivityResult == ConnectivityResult.mobile ||
connectivityResult == ConnectivityResult.wifi) {
// I am connected to a wifi network.
@@ -52,12 +54,19 @@ class _LaunchPageState extends State<LaunchPage> {
// CupertinoPageRoute(builder: (context) => HomePage()));
Navigator.of(context).pushReplacementNamed('/homePage');
}
}).catchError((err) {
}).catchError((err) async {
if(err.toString().contains("BaseSettingModel")){
await showDialog(context: context,child: TipDialog(content: "基本配置加载失败!请检查网络是否可用后再启动应用!",));
SystemNavigator.pop();
}
Logger.error(err);
});
} else {
///在无网络情况下提示用户打开网络
await showDialog(context: context,child: TipDialog(content: "无法连接网络!请打开移动网络/连接WIFI后再尝试",));
Logger.error('未知网络,APP初始化失败');
print('unknow');
SystemNavigator.pop();
}
});

@@ -90,7 +99,7 @@ class _LaunchPageState extends State<LaunchPage> {
return Image.asset(
'assets/images/launch_image/launch_image.png',
package: 'zhiying_base_widget',
fit: BoxFit.cover,
fit: BoxFit.fill,
);
}
}

+ 32
- 12
lib/pages/main_page/main_page.dart Прегледај датотеку

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:ui';

import 'package:flutter/cupertino.dart';
@@ -8,6 +9,7 @@ import 'package:zhiying_base_widget/pages/main_page/main_page_bloc.dart';
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart';
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart';
import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_nav/mine_nav_bg.dart';
import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart';
import 'package:zhiying_base_widget/widgets/refresh/refresh_header/refresh_header.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
@@ -54,8 +56,7 @@ class _MainPageContainerState extends State<_MainPageContainer> {
bool _isEnded = false;
ScrollController _controller = ScrollController();
MainPageBloc _bloc;
RefreshController _refreshController =
RefreshController(initialRefresh: false);
RefreshController _refreshController = RefreshController(initialRefresh: false);

Widget _floatWidget;

@@ -90,13 +91,11 @@ class _MainPageContainerState extends State<_MainPageContainer> {

_controller.addListener(() {
// print('${_controller.offset} ${_controller.position.maxScrollExtent}');
if (_controller.offset >= _controller.position.maxScrollExtent &&
!_isEnded) {
if (_controller.offset >= _controller.position.maxScrollExtent && !_isEnded) {
// 滑动到底部
_isEnded = true;
Provider.of<MainPageNotifier>(context, listen: false).loadMore();
} else if (_controller.offset < _controller.position.maxScrollExtent &&
_isEnded) {
} else if (_controller.offset < _controller.position.maxScrollExtent && _isEnded) {
_isEnded = false;
Provider.of<MainPageNotifier>(context, listen: false).reset();
}
@@ -113,11 +112,11 @@ class _MainPageContainerState extends State<_MainPageContainer> {
builder: (BuildContext context, AsyncSnapshot snapshot) {
List widgets = _createContent(context, snapshot.data ?? []);
_refreshController.refreshCompleted();
Widget bgWidget = validateBgWidget(context, snapshot.data ?? []);
return Scaffold(
backgroundColor: Color(0xfff9f9f9),
floatingActionButton: _floatWidget,
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
body: MediaQuery.removePadding(
removeTop: true,
context: context,
@@ -127,6 +126,7 @@ class _MainPageContainerState extends State<_MainPageContainer> {
fit: StackFit.passthrough,
children: <Widget>[
MineHeaderBgWidget(
bgWidget: bgWidget,
controller: _controller,
),
SmartRefresher(
@@ -151,12 +151,10 @@ class _MainPageContainerState extends State<_MainPageContainer> {
});
}

List<Widget> _createContent(
BuildContext context, List<Map<String, dynamic>> datas) {
List<Widget> _createContent(BuildContext context, List<Map<String, dynamic>> datas) {
List<Widget> list = List();
for (int i = 0; i < datas.length; i++) {
WidgetModel item =
WidgetModel.fromJson(Map<String, dynamic>.from(datas[i]));
WidgetModel item = WidgetModel.fromJson(Map<String, dynamic>.from(datas[i]));

print('item.modName ${item.modName}');
if (item.modName == 'index_taobao_auth_tip') {
@@ -181,4 +179,26 @@ class _MainPageContainerState extends State<_MainPageContainer> {
}
return list;
}



///处理特殊背景图
Widget validateBgWidget(BuildContext context, List<Map<String, dynamic>> datas) {
for (int i = 0; i < datas.length; i++) {
WidgetModel item = WidgetModel.fromJson(Map<String, dynamic>.from(datas[i]));
if (item.modName == "profile_background") {
final double statusBarHeight = MediaQuery.of(context).padding.top;
String url=json.decode(item.data)['img'];
return Container(
width: double.infinity,
height: statusBarHeight + 250,
child: CachedNetworkImage(
imageUrl: url,
fit: BoxFit.fitHeight,
),
);
}
}
return null;
}
}

+ 1
- 1
lib/pages/main_page/main_page_bloc.dart Прегледај датотеку

@@ -7,7 +7,7 @@ class MainPageBloc extends BlocBase {
List<Map<String, dynamic>> _pageData = List();

StreamController<List<Map<String, dynamic>>> _mainController =
StreamController<List<Map<String, dynamic>>>();
StreamController<List<Map<String, dynamic>>>.broadcast();

Stream<List<Map<String, dynamic>>> get outData => _mainController.stream;



+ 1
- 1
lib/register.dart Прегледај датотеку

@@ -102,7 +102,7 @@ class BaseWidgetRegister {
static void registInit() {
Application.addMethod(() async {
if (await BaseSettingModel.init() == null) {
throw Future.error('BaseSettingModel 初始化失败');
throw Exception('BaseSettingModel 初始化失败');
}
});



+ 10
- 0
lib/widgets/custom/multi_nav/custom_quick_entry.dart Прегледај датотеку

@@ -90,6 +90,16 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>
// 展示的列数
int columSize = int.parse(model?.columSize ?? '5');

//计算实际显示行数
if(totalRowSize*columSize>totalDataSize){
for(int index=1;index<=totalRowSize;index++){
if(index*columSize>=totalRowSize){
totalRowSize=index;
break;
}
}
}

// 图标的高度
double iconHeight = 40.0;
// 标题的高度


+ 94
- 47
lib/widgets/home/home_goods/home_goods_item_single.dart Прегледај датотеку

@@ -19,8 +19,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
final double marginTop;
final double marginBottom;

HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data, this.marginBottom = 4, this.marginTop = 4, this.marginLeft= 12.5, this.marginRight = 12.5})
: super(key: key) {
HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data, this.marginBottom = 4, this.marginTop = 4, this.marginLeft = 12.5, this.marginRight = 12.5}) : super(key: key) {
if (this.data != null && this.data.containsKey('data')) {
String data = this.data['data'];
Map<String, dynamic> json = Map<String, dynamic>.from(jsonDecode(data));
@@ -31,8 +30,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
/// 跳到商品详情
void _onJumpGoodsDetails(BuildContext context, HomeGoodsModel goods) {
RouterUtil.hideKeyboard(context);
Navigator.push(context,
CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson())));
Navigator.push(context, CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson())));
}

@override
@@ -42,9 +40,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
child: Container(
margin: EdgeInsets.only(left: marginLeft, right: marginRight, top: marginTop, bottom: marginBottom),
padding: EdgeInsets.all(7.5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(7.5))),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(7.5))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@@ -71,10 +67,12 @@ class HomeGoodsItemSingle extends StatelessWidget {
width: double.infinity,
child: _createTitle(),
),
_createShop(),
style?.listStyle?.hotRank?.isOpen == "0" ? _createShop() : Container(),
_createCupone(),
Expanded(child: Container()),
style?.listStyle?.hotRank?.isOpen == "0"? Expanded(child: Container()):Container(),
_createBottom(),
style?.listStyle?.hotRank?.isOpen == "1"? Expanded(child: Container()):Container(),
style?.listStyle?.hotRank?.isOpen == "1"? _buildHotItem():Container()
],
),
),
@@ -122,10 +120,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
}
list.add(TextSpan(
text: goods.goodTitle,
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex('#333333'),
fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 15, color: HexColor.fromHex('#333333'), fontWeight: FontWeight.bold),
));
return RichText(
maxLines: 2,
@@ -153,11 +148,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
child: Text(
goods.shopName,
maxLines: 1,
style: TextStyle(
color: HexColor.fromHex(
style?.listStyle?.shopNameColor ?? '#666666'),
fontSize: 11,
fontWeight: FontWeight.w400),
style: TextStyle(color: HexColor.fromHex(style?.listStyle?.shopNameColor ?? '#666666'), fontSize: 11, fontWeight: FontWeight.w400),
))
],
),
@@ -170,15 +161,12 @@ class HomeGoodsItemSingle extends StatelessWidget {
var couponDe = style?.listStyle?.couponCommission?.coupon?.bgImg == 'img'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(
style?.listStyle?.couponCommission?.coupon?.bgImg ??
''),
image: CachedNetworkImageProvider(style?.listStyle?.couponCommission?.coupon?.bgImg ?? ''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(
style?.listStyle?.couponCommission?.coupon?.bgColor),
color: HexColor.fromHex(style?.listStyle?.couponCommission?.coupon?.bgColor),
borderRadius: BorderRadius.circular(2.5),
);

@@ -210,18 +198,15 @@ class HomeGoodsItemSingle extends StatelessWidget {
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.fontColor),
color: HexColor.fromHex(style?.listStyle?.couponCommission?.coupon?.fontColor),
),
children: [
TextSpan(
text:
'${style?.listStyle?.couponCommission?.coupon?.text ?? '元劵'}',
text: '${style?.listStyle?.couponCommission?.coupon?.text ?? '元劵'}',
style: TextStyle(
height: 1,
fontSize: 11,
color: HexColor.fromHex(style
?.listStyle?.couponCommission?.coupon?.fontColor),
color: HexColor.fromHex(style?.listStyle?.couponCommission?.coupon?.fontColor),
),
)
]),
@@ -230,21 +215,17 @@ class HomeGoodsItemSingle extends StatelessWidget {
}

if (goods.commission != null || goods.commission != '') {
var commissionDe =
style?.listStyle?.couponCommission?.commission?.bgType == 'img'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.listStyle
?.couponCommission?.commission?.bgImg ??
''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.listStyle?.couponCommission
?.commission?.bgColor),
borderRadius: BorderRadius.circular(2.5),
);
var commissionDe = style?.listStyle?.couponCommission?.commission?.bgType == 'img'
? BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(style?.listStyle?.couponCommission?.commission?.bgImg ?? ''),
),
borderRadius: BorderRadius.circular(2.5),
)
: BoxDecoration(
color: HexColor.fromHex(style?.listStyle?.couponCommission?.commission?.bgColor),
borderRadius: BorderRadius.circular(2.5),
);

widgets.add(
Container(
@@ -270,8 +251,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
maxLines: 1,
textAlign: TextAlign.center,
text: TextSpan(
text:
'${style?.listStyle?.couponCommission?.commission?.text ?? ''}',
text: '${style?.listStyle?.couponCommission?.commission?.text ?? ''}',
style: TextStyle(
height: 1,
fontSize: 11,
@@ -308,7 +288,7 @@ class HomeGoodsItemSingle extends StatelessWidget {
_createPrice(),
_createOriginPrice(),
Expanded(child: Container()),
_createSale(),
style?.listStyle?.hotRank?.isOpen == "0"? _createSale():Container(),
],
),
);
@@ -366,4 +346,71 @@ class HomeGoodsItemSingle extends StatelessWidget {
style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999')),
);
}

///热点
_buildHotItem() {
var hotRank=style?.listStyle?.hotRank;
return Row(
children: <Widget>[
Expanded(
child: Stack(
alignment: Alignment.centerLeft,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Container(
alignment: Alignment.centerLeft,
height: 20,
padding: EdgeInsets.only(
left: 20,
),
margin:
EdgeInsets.only(right: 20, left: 10),
color: HexColor.fromHex(
hotRank.bgColor ?? ""),
child: Text(
(goods.inorderCount??"") ,
style: TextStyle(
color: Colors.white,
fontSize: 11,
fontFamily: 'Din',
package: 'zhiying_comm'),
),
))
],
),
Container(
width: 24,
height: 24,
child: CachedNetworkImage(
imageUrl:
hotRank?.hotSaleImg ?? "",
width: 24,
height: 24,
placeholder: (context, _) =>
Container(color: Colors.yellow),
fit: BoxFit.fill,
),
),
Align(
alignment: Alignment.centerRight,
child: Container(
height: 24,
width: 63.5,
decoration: BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(
hotRank.buyNowImg ??
""),
fit: BoxFit.fitWidth),
borderRadius:
BorderRadius.circular(20)),
margin: EdgeInsets.only(right: 0),
))
],
))
],
);
}
}

+ 14
- 7
lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart Прегледај датотеку

@@ -5,6 +5,10 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:zhiying_base_widget/dialog/loading/loading.dart';
import 'package:zhiying_base_widget/dialog/loading/loading_dialog.dart';
import 'package:zhiying_base_widget/pages/hot_ranking_page/hot_ranking_page_bloc.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_item_single.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_list_style_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart';
import 'package:zhiying_base_widget/widgets/hot_ranking/hot_ranking_goods/hot_ranking_goods.dart';
import 'package:zhiying_base_widget/widgets/hot_ranking/hot_ranking_list/model/hot_ranking_list_data_model.dart';
import 'package:zhiying_base_widget/widgets/hot_ranking/hot_ranking_list/model/hot_ranking_list_model.dart';
@@ -29,7 +33,7 @@ class _HotRankingState extends State<HotRankingList>
HotRankingListBloc _bloc;
TabController _tabController;
RefreshController _refreshController;
List<Good> goods;
List<HomeGoodsModel> goods;

HotRankingPageBloc _pageBloc;

@@ -119,12 +123,15 @@ class _HotRankingState extends State<HotRankingList>
}

Widget _buildListItem(BuildContext context, int index) {
return HotRankingGoods(
styleModel:
HotRankingListModel.fromJson(json.decode(widget.data['data'])),
good: goods[index],
index: index,
);
HomeGoodsStyleModel homeGoodsStyleModel=HomeGoodsStyleModel();
homeGoodsStyleModel.listStyle=HomeGoodsListStyleModel.fromJson(json.decode(widget.data['data']));
return HomeGoodsItemSingle(goods[index],homeGoodsStyleModel);
// return HotRankingGoods(
// styleModel:
// HotRankingListModel.fromJson(json.decode(widget.data['data'])),
// good: goods[index],
// index: index,
// );
}

@override


+ 5
- 3
lib/widgets/hot_ranking/hot_ranking_list/model/hot_ranking_list_data_model.dart Прегледај датотеку

@@ -1,15 +1,17 @@
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart';

class HotRankingListDataModel {
String provider;
List<Good> good;
List<HomeGoodsModel> good;

HotRankingListDataModel({this.provider, this.good});

HotRankingListDataModel.fromJson(Map<String, dynamic> json) {
provider = json['provider'];
if (json['good'] != null) {
good = new List<Good>();
good = new List<HomeGoodsModel>();
json['good'].forEach((v) {
good.add(new Good.fromJson(v));
good.add(new HomeGoodsModel.fromJson(v));
});
}
}


+ 0
- 1
lib/widgets/mine/mine_header/mine_header_static_container.dart Прегледај датотеку

@@ -50,7 +50,6 @@ class _MineStaticContainerState extends State<MineStaticContainer> {
children: <Widget>[
Container(
width: 120,
height: 20,
child: Text(
widget.staticModel.loginName,
style: TextStyle(


+ 14
- 10
lib/widgets/mine/mine_nav/mine_nav_bg.dart Прегледај датотеку

@@ -9,12 +9,13 @@ import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifi
class MineNavBg extends StatefulWidget {
final Map<String, dynamic> data;
Map<String, dynamic> model;
MineNavBg(this.data, {Key key}) : super(key: key){
try{
model = jsonDecode(data['data']);
} catch(e,s){
Logger.error(e,s);
}

MineNavBg(this.data, {Key key}) : super(key: key) {
try {
model = jsonDecode(data['data']);
} catch (e, s) {
Logger.error(e, s);
}
}

@override
@@ -22,6 +23,8 @@ class MineNavBg extends StatefulWidget {
}

class _MineNavBgState extends State<MineNavBg> {
int isFirst = 0;

@override
void initState() {
super.initState();
@@ -45,9 +48,10 @@ class _MineNavBgState extends State<MineNavBg> {

@override
Widget build(BuildContext context) {
Future.delayed(Duration.zero, () {
_updateBg();
});
return Container();
// Future.delayed(Duration.zero, () {
// print("使用" + isFirst.toString());
// _updateBg();
// });
return Container();
}
}

+ 18
- 6
lib/widgets/others/mine_header_bg_widget.dart Прегледај датотеку

@@ -1,11 +1,17 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:zhiying_base_widget/pages/main_page/main_page_bloc.dart';
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import '';

class MineHeaderBgWidget extends StatefulWidget {
final ScrollController controller;
ScrollController controller;
Widget bgWidget;

const MineHeaderBgWidget({Key key, this.controller}) : super(key: key);
MineHeaderBgWidget({Key key, this.controller, this.bgWidget}) : super(key: key);

@override
_MineHeaderBgWidgetState createState() => _MineHeaderBgWidgetState();
@@ -15,12 +21,10 @@ class _MineHeaderBgWidgetState extends State<MineHeaderBgWidget> {
int zIndex = 0;
double _offsetY = 0;
double _height = 300;
_MineHeaderBgContainer _content;

@override
void initState() {
super.initState();
_content = _MineHeaderBgContainer();

if (widget.controller != null) {
widget.controller.addListener(() {
@@ -41,20 +45,28 @@ class _MineHeaderBgWidgetState extends State<MineHeaderBgWidget> {
Widget build(BuildContext context) {
return Transform.translate(
offset: Offset(0, _offsetY),
child: _content,
child: _MineHeaderBgContainer(bgWidget: widget?.bgWidget),
);
}
}

class _MineHeaderBgContainer extends StatefulWidget {
Widget bgWidget;

_MineHeaderBgContainer({Key key, this.bgWidget}) : super(key: key);

@override
_MineHeaderBgContainerState createState() => _MineHeaderBgContainerState();
}

class _MineHeaderBgContainerState extends State<_MineHeaderBgContainer> {

@override
Widget build(BuildContext context) {
print('_MineHeaderBgContainerState build');
if (widget.bgWidget != null) {
return widget.bgWidget;
}
return Consumer<MainPageBgNotifier>(builder: (context, model, widget) {
return Stack(
fit: StackFit.passthrough,


Loading…
Откажи
Сачувај