|
|
@@ -4,11 +4,100 @@ import 'package:flutter/material.dart'; |
|
|
|
import 'package:zhiying_base_widget/widgets/goods_details/upgrade_tip/model/upgrade_tip_model.dart'; |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
import 'package:cached_network_image/cached_network_image.dart'; |
|
|
|
|
|
|
|
import 'package:zhiying_comm/util/shared_prefe_util.dart'; |
|
|
|
/// |
|
|
|
/// 更新提示widget |
|
|
|
/// |
|
|
|
class UpgradeTipWidget extends StatelessWidget { |
|
|
|
// class UpgradeTipWidget extends StatelessWidget { |
|
|
|
// final Map<String, dynamic> data; |
|
|
|
// UpgradeTipModel _model; |
|
|
|
// |
|
|
|
// UpgradeTipWidget(this.data, {Key key}) : super(key: key) { |
|
|
|
// try { |
|
|
|
// _model = UpgradeTipModel.fromJson(jsonDecode(data['data'])); |
|
|
|
// } catch (e) { |
|
|
|
// Logger.log('UpgradeTipWidget e = $e'); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// /// 点击事件 |
|
|
|
// void _onClickListener(context) { |
|
|
|
// if (!EmptyUtil.isEmpty(_model) && !EmptyUtil.isEmpty(_model?.goSkip)) { |
|
|
|
// RouterUtil.route(_model?.goSkip, _model?.goSkip?.toJson(), context); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// @override |
|
|
|
// Widget build(BuildContext context) { |
|
|
|
// return Container( |
|
|
|
// width: double.infinity, |
|
|
|
// margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(_model?.topMargin), left: ParseUtil.stringParseDouble(_model?.leftRightMargin), right: ParseUtil.stringParseDouble(_model?.leftRightMargin)), |
|
|
|
// padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6, bottom: 6), |
|
|
|
// decoration: BoxDecoration( |
|
|
|
// color: HexColor.fromHex(_model?.bgColor), |
|
|
|
// // color: Colors.white, |
|
|
|
// borderRadius: BorderRadius.only( |
|
|
|
// topLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), |
|
|
|
// topRight: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), |
|
|
|
// bottomRight: Radius.circular(ParseUtil.stringParseDouble(_model?.bottomRightRadius)), |
|
|
|
// bottomLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), |
|
|
|
// )), |
|
|
|
// child: GestureDetector( |
|
|
|
// onTap: () => _onClickListener(context), |
|
|
|
// behavior: HitTestBehavior.opaque, |
|
|
|
// child: Container( |
|
|
|
// decoration: BoxDecoration( |
|
|
|
// /// 背景颜色 |
|
|
|
// color: HexColor.fromHex(_model?.bulletinBgColor ?? '#FFEFDA'), |
|
|
|
// borderRadius: BorderRadius.circular(30), |
|
|
|
// ), |
|
|
|
// padding: const EdgeInsets.only(left: 10, right: 13, top: 10, bottom: 10), |
|
|
|
// child: Row( |
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
// children: <Widget>[ |
|
|
|
// _geLeftWidget(_model), |
|
|
|
// _getRightWidget(_model), |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /// 左边的视图 |
|
|
|
// Widget _geLeftWidget(UpgradeTipModel model) { |
|
|
|
// return Row( |
|
|
|
// children: <Widget>[ |
|
|
|
// /// 图标 |
|
|
|
// // Container(width: 15, height: 15, child: ,), |
|
|
|
// CachedNetworkImage( |
|
|
|
// imageUrl: model?.icon ?? '', |
|
|
|
// width: 15, |
|
|
|
// ), |
|
|
|
// |
|
|
|
// const SizedBox(width: 7.5), |
|
|
|
// |
|
|
|
// /// 文字 |
|
|
|
// Text(model?.bulletinText ?? '下载APP升级运营商,享受更多收益', style: TextStyle(color: HexColor.fromHex(model?.bulletinTextColor ?? '#C09023'), fontSize: 11)) |
|
|
|
// ], |
|
|
|
// ); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /// 右边的视图 |
|
|
|
// Widget _getRightWidget(UpgradeTipModel model) { |
|
|
|
// return Text(model?.goText ?? '前往下载', style: TextStyle(color: HexColor.fromHex(model?.bulletinTextColor ?? '#C09023'), fontSize: 11)); |
|
|
|
// // return Row( |
|
|
|
// // children: <Widget>[ |
|
|
|
// // Text(model?.go_text ??'前往下载', style: TextStyle(color: HexColor.fromHex('#C09023'), fontSize: 11)), |
|
|
|
// // const SizedBox(width: 4), |
|
|
|
// // Text('》', style: TextStyle(color: HexColor.fromHex('#C09023'), fontSize: 11)) |
|
|
|
// // ], |
|
|
|
// // ); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
class UpgradeTipWidget extends StatefulWidget { |
|
|
|
final Map<String, dynamic> data; |
|
|
|
UpgradeTipModel _model; |
|
|
|
|
|
|
@@ -19,28 +108,51 @@ class UpgradeTipWidget extends StatelessWidget { |
|
|
|
Logger.log('UpgradeTipWidget e = $e'); |
|
|
|
} |
|
|
|
} |
|
|
|
@override |
|
|
|
_UpgradeTipWidgetState createState() => _UpgradeTipWidgetState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _UpgradeTipWidgetState extends State<UpgradeTipWidget> { |
|
|
|
|
|
|
|
|
|
|
|
bool _isiOSReview = false; |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
_settingIosReview(); |
|
|
|
super.initState(); |
|
|
|
} |
|
|
|
void _settingIosReview() async { |
|
|
|
String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); |
|
|
|
setState(() { |
|
|
|
if (is_ios_review == '1') { |
|
|
|
_isiOSReview = true; |
|
|
|
print('状态头*****'); |
|
|
|
print(_isiOSReview); |
|
|
|
print('状态头*****'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
/// 点击事件 |
|
|
|
void _onClickListener(context) { |
|
|
|
if (!EmptyUtil.isEmpty(_model) && !EmptyUtil.isEmpty(_model?.goSkip)) { |
|
|
|
RouterUtil.route(_model?.goSkip, _model?.goSkip?.toJson(), context); |
|
|
|
if (!EmptyUtil.isEmpty(widget._model) && !EmptyUtil.isEmpty(widget._model?.goSkip)) { |
|
|
|
RouterUtil.route(widget._model?.goSkip, widget._model?.goSkip?.toJson(), context); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Container( |
|
|
|
return _isiOSReview ? Container() : Container( |
|
|
|
width: double.infinity, |
|
|
|
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(_model?.topMargin), left: ParseUtil.stringParseDouble(_model?.leftRightMargin), right: ParseUtil.stringParseDouble(_model?.leftRightMargin)), |
|
|
|
margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(widget._model?.topMargin), left: ParseUtil.stringParseDouble(widget._model?.leftRightMargin), right: ParseUtil.stringParseDouble(widget._model?.leftRightMargin)), |
|
|
|
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6, bottom: 6), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex(_model?.bgColor), |
|
|
|
// color: Colors.white, |
|
|
|
color: HexColor.fromHex(widget._model?.bgColor), |
|
|
|
// color: Colors.white, |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), |
|
|
|
topRight: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), |
|
|
|
bottomRight: Radius.circular(ParseUtil.stringParseDouble(_model?.bottomRightRadius)), |
|
|
|
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), |
|
|
|
topLeft: Radius.circular(ParseUtil.stringParseDouble(widget._model?.topLeftRadius)), |
|
|
|
topRight: Radius.circular(ParseUtil.stringParseDouble(widget._model?.topLeftRadius)), |
|
|
|
bottomRight: Radius.circular(ParseUtil.stringParseDouble(widget._model?.bottomRightRadius)), |
|
|
|
bottomLeft: Radius.circular(ParseUtil.stringParseDouble(widget._model?.topLeftRadius)), |
|
|
|
)), |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () => _onClickListener(context), |
|
|
@@ -48,15 +160,15 @@ class UpgradeTipWidget extends StatelessWidget { |
|
|
|
child: Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
/// 背景颜色 |
|
|
|
color: HexColor.fromHex(_model?.bulletinBgColor ?? '#FFEFDA'), |
|
|
|
color: HexColor.fromHex(widget._model?.bulletinBgColor ?? '#FFEFDA'), |
|
|
|
borderRadius: BorderRadius.circular(30), |
|
|
|
), |
|
|
|
padding: const EdgeInsets.only(left: 10, right: 13, top: 10, bottom: 10), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: <Widget>[ |
|
|
|
_geLeftWidget(_model), |
|
|
|
_getRightWidget(_model), |
|
|
|
_geLeftWidget(widget._model), |
|
|
|
_getRightWidget(widget._model), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|