@@ -5,6 +5,7 @@ import 'custom_page_event.dart'; | |||
import 'custom_page_repository.dart'; | |||
import 'custom_page_state.dart'; | |||
import 'package:zhiying_comm/util/empty_util.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
class CustomPageBloc extends Bloc<CustomPageEvent, CustomPageState> { | |||
// CommonBloc() : super(CommonInitial()); | |||
@@ -52,12 +53,16 @@ class CustomPageBloc extends Bloc<CustomPageEvent, CustomPageState> { | |||
} | |||
// 获取网络数据 | |||
var result = await repository.fetchInitData(); | |||
List<Map<String, dynamic>> mdata = result; | |||
for (int i = 0; i < mdata.length; i++) { | |||
Logger.log("页面数据: " + mdata[i].toString()); | |||
} | |||
if (!EmptyUtil.isEmpty(result) && result is List) { | |||
yield CustomPageLoadedState(model: result); | |||
} else { | |||
if(EmptyUtil.isEmpty(cache)) { | |||
if (EmptyUtil.isEmpty(cache)) { | |||
yield CustomPageInitErrorState(); | |||
}else{ | |||
} else { | |||
yield CustomPageErrorState(); | |||
} | |||
} | |||
@@ -34,6 +34,7 @@ class CustomPage extends StatefulWidget { | |||
class _CustomPageState extends State<CustomPage> { | |||
@override | |||
Widget build(BuildContext context) { | |||
Logger.log("数据: "+widget?.data.toString()); | |||
return MultiProvider( | |||
providers: [ | |||
ChangeNotifierProvider.value(value: MainPageBgNotifier()), | |||
@@ -20,6 +20,7 @@ class SearchPage extends StatelessWidget { | |||
@override | |||
Widget build(BuildContext context) { | |||
Logger.log("数据: "+data.toString()); | |||
return MultiProvider( | |||
providers: [ | |||
ChangeNotifierProvider.value(value: SearchTagNotifier()) | |||
@@ -358,10 +358,10 @@ class BaseWidgetRegister { | |||
WidgetFactory.regist('product_detail_bottom', DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model))); | |||
// ==================== 个人中心 | |||
WidgetFactory.regist('profile_appbar', MineNavCreater()); | |||
WidgetFactory.regist('appbar', MineNavCreater()); | |||
WidgetFactory.regist('profile_background', DefaultWidgetCreater((model) => MineNavBg(model))); | |||
WidgetFactory.regist('profile_header', DefaultWidgetCreater((model) => MineHeader(model))); | |||
WidgetFactory.regist('profile_earning', DefaultWidgetCreater((model) => MineData(model))); | |||
WidgetFactory.regist('member_info', DefaultWidgetCreater((model) => MineHeader(model))); | |||
WidgetFactory.regist('earning', DefaultWidgetCreater((model) => MineData(model))); | |||
WidgetFactory.regist('profile_functions', DefaultWidgetCreater((model) => MineQuickEntry(model))); | |||
WidgetFactory.regist('profile_my_functions', DefaultWidgetCreater((model) => MineQuickEntry(model))); | |||
// WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model))); | |||
@@ -146,10 +146,13 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> | |||
totalHeight = totalHeight + moduleTitleHeight; | |||
} | |||
double marginLeftRight = model?.isLeftRightMargin == "1" ? double.tryParse(model?.leftRightMargin ?? "0") : 0; | |||
double marginTop = model?.isTopMargin == "1" ? double.tryParse(model?.topMargin ?? "0") : 0; | |||
return Container( | |||
margin: EdgeInsets.only(top: double.tryParse(model?.topMargin), | |||
left: ParseUtil.stringParseDouble(model?.leftRightMargin), | |||
right: ParseUtil.stringParseDouble(model?.leftRightMargin)), | |||
margin: EdgeInsets.only(top: marginTop, | |||
left: marginLeftRight, | |||
right: marginLeftRight), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(model?.bgColor ?? ''), | |||
//color: Colors.green, | |||
@@ -30,7 +30,7 @@ class _MineDataState extends State<MineData> { | |||
MineDataModel style = | |||
MineDataModel.fromJson(Map<String, dynamic>.from(json)); | |||
List<MineProfileDataModel> list = style.gridView.map((item) { | |||
List<MineProfileDataModel> list = style.listStyle.map((item) { | |||
return MineProfileDataModel(name: item.name, value: '¥0'); | |||
}).toList(); | |||
MineProfileModel profile = MineProfileModel( | |||
@@ -11,33 +11,35 @@ import 'package:zhiying_comm/util/shared_prefe_util.dart'; | |||
class MineDataWidget extends StatefulWidget { | |||
final Map<String, dynamic> data; | |||
final MineProfileModel profile; | |||
// Map<String, dynamic> _json; | |||
// MineDataModel _style; | |||
MineDataWidget( | |||
this.profile, | |||
this.data, { | |||
Key key, | |||
}) : super(key: key) ; | |||
this.profile, | |||
this.data, { | |||
Key key, | |||
}) : super(key: key); | |||
@override | |||
_MineDataWidgetState createState() => _MineDataWidgetState(); | |||
} | |||
class _MineDataWidgetState extends State<MineDataWidget> { | |||
Map<String, dynamic> _json; | |||
MineDataModel _style; | |||
bool _isiOSReview = false; | |||
void initState(){ | |||
@override | |||
void initState() { | |||
_settingIosReview(); | |||
_settingData(); | |||
super.initState(); | |||
} | |||
void _settingIosReview() async { | |||
String is_ios_review = await SharedPreferencesUtil.getStringValue( | |||
GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); | |||
String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); | |||
setState(() { | |||
if (is_ios_review == '1') { | |||
_isiOSReview = true; | |||
@@ -45,30 +47,41 @@ class _MineDataWidgetState extends State<MineDataWidget> { | |||
} | |||
}); | |||
} | |||
void _settingData(){ | |||
setState(() { | |||
String d = widget.data['data']; | |||
_json = convert.jsonDecode(d); | |||
_style = MineDataModel.fromJson(Map<String, dynamic>.from(_json)); | |||
}); | |||
void _settingData() { | |||
setState(() { | |||
String d = widget.data['data']; | |||
_json = convert.jsonDecode(d); | |||
_style = MineDataModel.fromJson(Map<String, dynamic>.from(_json)); | |||
}); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
double marginLeftRight = _style?.isLeftRightMargin == "1" ? double.tryParse(_style?.leftRightMargin ?? "0") : 0; | |||
double marginTop = _style?.isTopMargin == "1" ? double.tryParse(_style?.topMargin ?? "0") : 0; | |||
return Container( | |||
margin: EdgeInsets.only(left: 12.5, right: 12.5), | |||
margin: EdgeInsets.only(left: marginLeftRight, right: marginLeftRight, top: marginTop), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(_style.gridViewBgColor), | |||
borderRadius: BorderRadius.circular(7.5)), | |||
color: HexColor.fromHex(_style.bg_color), | |||
borderRadius: BorderRadius.only( | |||
topRight: Radius.circular(double.tryParse(_style?.topRightRadius ?? "0")), | |||
topLeft: Radius.circular(double.tryParse(_style?.topLeftRadius ?? "0")), | |||
bottomRight: Radius.circular(double.tryParse(_style?.bottomRightRadius ?? "0")), | |||
bottomLeft: Radius.circular(double.tryParse(_style?.bottomLeftRadius ?? "0")), | |||
)), | |||
child: Column( | |||
children: <Widget>[ | |||
_createTop(context), | |||
_createTop( | |||
context, double.tryParse(_style?.topLeftRadius ?? "0"), double.tryParse(_style?.topRightRadius ?? "0")), | |||
_createCenter(), | |||
], | |||
), | |||
); | |||
} | |||
Widget _createTop(BuildContext context) { | |||
Widget _createTop(BuildContext context, double topLeft, double topRight) { | |||
return Container( | |||
width: double.infinity, | |||
height: 62, | |||
@@ -78,9 +91,7 @@ class _MineDataWidgetState extends State<MineDataWidget> { | |||
width: double.infinity, | |||
height: double.infinity, | |||
child: ClipRRect( | |||
borderRadius: BorderRadius.only( | |||
topLeft: Radius.circular(7.5), | |||
topRight: Radius.circular(7.5)), | |||
borderRadius: BorderRadius.only(topLeft: Radius.circular(topLeft), topRight: Radius.circular(topRight)), | |||
child: CachedNetworkImage( | |||
imageUrl: _style.accumulatedEarningsBgImg ?? '', | |||
fit: BoxFit.cover, | |||
@@ -95,37 +106,41 @@ class _MineDataWidgetState extends State<MineDataWidget> { | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
children: <Widget>[ | |||
Expanded( | |||
child: Container( | |||
margin: EdgeInsets.only(left: 15, right: 15), | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Text( | |||
_isiOSReview ? '' : '累计收益', | |||
style: TextStyle( | |||
fontSize: 11, | |||
fontWeight: FontWeight.w600, | |||
color: HexColor.fromHex( | |||
_style.accumulatedEarningsNameColor), | |||
child: GestureDetector( | |||
onTap: () { | |||
RouterUtil.route(_style.listStyle[0], _style.listStyle[0].toJson(), context); | |||
}, | |||
behavior: HitTestBehavior.opaque, | |||
child: Container( | |||
margin: EdgeInsets.only(left: 15, right: 15), | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Text( | |||
_isiOSReview ? '' : '累计收益', | |||
style: TextStyle( | |||
fontSize: 11, | |||
fontWeight: FontWeight.w600, | |||
color: HexColor.fromHex(_style?.listStyle[0]?.textColor ?? ""), | |||
), | |||
), | |||
), | |||
Text( | |||
'${widget.profile?.total?? '0.00'}', | |||
style: TextStyle( | |||
fontSize: 18, | |||
fontWeight: FontWeight.w800, | |||
color: HexColor.fromHex( | |||
_style.accumulatedEarningsNameColor), | |||
fontFamily: 'Din-Bold' | |||
'' | |||
'' | |||
'' | |||
'', | |||
package: 'zhiying_comm', | |||
Text( | |||
'${widget.profile?.total ?? '0.00'}', | |||
style: TextStyle( | |||
fontSize: 18, | |||
fontWeight: FontWeight.w800, | |||
color: HexColor.fromHex(_style?.listStyle[0]?.numColor ?? ""), | |||
fontFamily: 'Din-Bold' | |||
'' | |||
'' | |||
'' | |||
'', | |||
package: 'zhiying_comm', | |||
), | |||
), | |||
), | |||
], | |||
], | |||
), | |||
), | |||
), | |||
), | |||
@@ -137,22 +152,21 @@ class _MineDataWidgetState extends State<MineDataWidget> { | |||
child: Stack( | |||
children: <Widget>[ | |||
CachedNetworkImage( | |||
imageUrl: _style?.btnImg ?? '', | |||
imageUrl: _style?.cashBtn?.image ?? '', | |||
fit: BoxFit.cover, | |||
), | |||
Center( | |||
child: Text( | |||
_style.btnText, | |||
style: TextStyle( | |||
fontSize: 12, | |||
color: HexColor.fromHex(_style.btnTextColor)), | |||
_style.cashBtn.btnText, | |||
style: TextStyle(fontSize: 12, color: HexColor.fromHex(_style.cashBtn.btnTextColor)), | |||
), | |||
) | |||
], | |||
), | |||
), | |||
behavior: HitTestBehavior.opaque, | |||
onTap: () { | |||
RouterUtil.route(_style, _style.toJson(), context); | |||
RouterUtil.route(_style.cashBtn, _style.cashBtn.toJson(), context); | |||
}, | |||
) | |||
], | |||
@@ -177,7 +191,7 @@ class _MineDataWidgetState extends State<MineDataWidget> { | |||
int i = 0; | |||
for (; i < row; i++) { | |||
rows.add( | |||
_createrCenterItem(datas[i].name, datas[i].value), | |||
_createrCenterItem(datas[i].name, datas[i].value, i), | |||
); | |||
if (i % maxColumn == maxColumn - 1 || i == row - 1) { | |||
columns.add(Row( | |||
@@ -204,11 +218,9 @@ class _MineDataWidgetState extends State<MineDataWidget> { | |||
for (; i < datas.length; i++) { | |||
rows.add( | |||
_createBottomItem(datas[i].name, datas[i].value), | |||
_createBottomItem(datas[i].name, datas[i].value, i), | |||
); | |||
if ((i - row) % maxColumn == maxColumn - 1 || | |||
i == row - 1 || | |||
i == datas.length - 1) { | |||
if ((i - row) % maxColumn == maxColumn - 1 || i == row - 1 || i == datas.length - 1) { | |||
columns.add(Row( | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
@@ -229,75 +241,84 @@ class _MineDataWidgetState extends State<MineDataWidget> { | |||
children: columns, | |||
), | |||
); | |||
}else{ | |||
} else { | |||
return Container(); | |||
} | |||
} | |||
Widget _createrCenterItem(String name, String value) { | |||
Widget _createrCenterItem(String name, String value, int i) { | |||
return Expanded( | |||
child: Container( | |||
padding: EdgeInsets.only(left: 15, right: 15), | |||
height: 72, | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Text( | |||
name, | |||
style: TextStyle( | |||
fontSize: 11, | |||
color: HexColor.fromHex(_style.gridViewNameColor)), | |||
), | |||
Padding( | |||
padding: const EdgeInsets.only(top: 2), | |||
child: Text( | |||
value, | |||
style: TextStyle( | |||
fontSize: 18, | |||
color: HexColor.fromHex(_style.gridViewValueColor), | |||
fontFamily: 'Din-Bold', | |||
package: 'zhiying_comm'), | |||
child: GestureDetector( | |||
onTap: () { | |||
RouterUtil.route(_style.listStyle[i + 1], _style.listStyle[i + 1].toJson(), context); | |||
}, | |||
behavior: HitTestBehavior.opaque, | |||
child: Container( | |||
padding: EdgeInsets.only(left: 15, right: 15), | |||
height: 72, | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Text( | |||
name, | |||
style: TextStyle(fontSize: 11, color: HexColor.fromHex(_style.listStyle[i].textColor)), | |||
), | |||
), | |||
], | |||
Padding( | |||
padding: const EdgeInsets.only(top: 2), | |||
child: Text( | |||
value, | |||
style: TextStyle( | |||
fontSize: 18, | |||
color: HexColor.fromHex(_style.listStyle[i].numColor), | |||
fontFamily: 'Din-Bold', | |||
package: 'zhiying_comm'), | |||
), | |||
), | |||
], | |||
), | |||
), | |||
), | |||
); | |||
} | |||
Widget _createBottomItem(String name, String value) { | |||
Widget _createBottomItem(String name, String value, int i) { | |||
return Expanded( | |||
child: Container( | |||
padding: EdgeInsets.only(left: 15, right: 15), | |||
height: 46, | |||
child: Row( | |||
mainAxisAlignment: MainAxisAlignment.start, | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
children: <Widget>[ | |||
Text( | |||
name, | |||
style: TextStyle( | |||
fontSize: 12, | |||
color: HexColor.fromHex(_style.gridViewNameColor)), | |||
), | |||
Padding( | |||
padding: const EdgeInsets.only(left: 2), | |||
child: Text( | |||
value, | |||
style: TextStyle( | |||
fontSize: 12, | |||
color: HexColor.fromHex(_style.gridViewValueColor), | |||
fontFamily: 'Din-Bold', | |||
package: 'zhiying_comm'), | |||
child: GestureDetector( | |||
onTap: () { | |||
RouterUtil.route(_style.listStyle[i + 1], _style.listStyle[i + 1].toJson(), context); | |||
}, | |||
behavior: HitTestBehavior.opaque, | |||
child: Container( | |||
padding: EdgeInsets.only(left: 15, right: 15), | |||
height: 46, | |||
child: Row( | |||
mainAxisAlignment: MainAxisAlignment.start, | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
children: <Widget>[ | |||
Text( | |||
name, | |||
style: TextStyle(fontSize: 12, color: HexColor.fromHex(_style.listStyle[i].textColor)), | |||
), | |||
), | |||
], | |||
Padding( | |||
padding: const EdgeInsets.only(left: 2), | |||
child: Text( | |||
value, | |||
style: TextStyle( | |||
fontSize: 12, | |||
color: HexColor.fromHex(_style.listStyle[i].numColor), | |||
fontFamily: 'Din-Bold', | |||
package: 'zhiying_comm'), | |||
), | |||
), | |||
], | |||
), | |||
), | |||
), | |||
); | |||
} | |||
} | |||
///***/// | |||
// class MineDataWidget extends StatelessWidget { | |||
// final Map<String, dynamic> data; | |||
@@ -1,69 +1,181 @@ | |||
import 'package:zhiying_base_widget/widgets/mine/mine_header/model/mine_profile_model.dart'; | |||
import 'package:zhiying_comm/models/base/skip_model.dart'; | |||
class MineDataModel extends SkipModel { | |||
String accumulatedEarningsNameColor; | |||
String accumulatedEarningsColor; | |||
class MineDataModel extends SkipModel{ | |||
String accumulatedEarningsBgImg; | |||
String btnText; | |||
String btnTextColor; | |||
String btnImg; | |||
String gridViewBgColor; | |||
String gridViewNameColor; | |||
String gridViewValueColor; | |||
List<MineProfileDataModel> gridView; | |||
String bottomLeftRadius; | |||
String bottomRightRadius; | |||
CashBtn cashBtn; | |||
String desc; | |||
String isLeftRightMargin; | |||
String isNeedDownloadApp; | |||
String isShow; | |||
String isTopMargin; | |||
String leftRightMargin; | |||
List<ListStyle> listStyle; | |||
String moduleKey; | |||
String moduleType; | |||
String name; | |||
String topLeftRadius; | |||
String topMargin; | |||
String topRightRadius; | |||
String bg_color; | |||
MineDataModel( | |||
{this.accumulatedEarningsNameColor, | |||
this.accumulatedEarningsColor, | |||
this.accumulatedEarningsBgImg, | |||
this.btnText, | |||
this.btnTextColor, | |||
this.btnImg, | |||
this.gridViewBgColor, | |||
this.gridViewNameColor, | |||
this.gridViewValueColor, | |||
this.gridView}); | |||
{this.accumulatedEarningsBgImg, | |||
this.bottomLeftRadius, | |||
this.bottomRightRadius, | |||
this.cashBtn, | |||
this.desc, | |||
this.isLeftRightMargin, | |||
this.isNeedDownloadApp, | |||
this.isShow, | |||
this.isTopMargin, | |||
this.leftRightMargin, | |||
this.listStyle, | |||
this.moduleKey, | |||
this.moduleType, | |||
this.name, | |||
this.topLeftRadius, | |||
this.topMargin, | |||
this.topRightRadius, | |||
this.bg_color, | |||
}); | |||
MineDataModel.fromJson(Map<String, dynamic> json) { | |||
super.fromJson(json); | |||
accumulatedEarningsNameColor = json['accumulated_earnings_name_color']; | |||
accumulatedEarningsColor = json['accumulated_earnings_color']; | |||
accumulatedEarningsBgImg = json['accumulated_earnings_bg_img']; | |||
bottomLeftRadius = json['bottom_left_radius']; | |||
bottomRightRadius = json['bottom_right_radius']; | |||
cashBtn = json['cash_btn'] != null | |||
? new CashBtn.fromJson(json['cash_btn']) | |||
: null; | |||
desc = json['desc']; | |||
isLeftRightMargin = json['is_left_right_margin']; | |||
isNeedDownloadApp = json['is_need_download_app']; | |||
isShow = json['is_show']; | |||
isTopMargin = json['is_top_margin']; | |||
leftRightMargin = json['left_right_margin']; | |||
if (json['list_style'] != null) { | |||
listStyle = new List<ListStyle>(); | |||
json['list_style'].forEach((v) { | |||
listStyle.add(new ListStyle.fromJson(v)); | |||
}); | |||
} | |||
moduleKey = json['module_key']; | |||
moduleType = json['module_type']; | |||
name = json['name']; | |||
topLeftRadius = json['top_left_radius']; | |||
topMargin = json['top_margin']; | |||
topRightRadius = json['top_right_radius']; | |||
bg_color = json['bg_color']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['accumulated_earnings_bg_img'] = this.accumulatedEarningsBgImg; | |||
data['bottom_left_radius'] = this.bottomLeftRadius; | |||
data['bottom_right_radius'] = this.bottomRightRadius; | |||
if (this.cashBtn != null) { | |||
data['cash_btn'] = this.cashBtn.toJson(); | |||
} | |||
data['desc'] = this.desc; | |||
data['is_left_right_margin'] = this.isLeftRightMargin; | |||
data['is_need_download_app'] = this.isNeedDownloadApp; | |||
data['is_show'] = this.isShow; | |||
data['is_top_margin'] = this.isTopMargin; | |||
data['left_right_margin'] = this.leftRightMargin; | |||
if (this.listStyle != null) { | |||
data['list_style'] = this.listStyle.map((v) => v.toJson()).toList(); | |||
} | |||
data['module_key'] = this.moduleKey; | |||
data['module_type'] = this.moduleType; | |||
data['name'] = this.name; | |||
data['top_left_radius'] = this.topLeftRadius; | |||
data['top_margin'] = this.topMargin; | |||
data['top_right_radius'] = this.topRightRadius; | |||
data['bg_color'] = this.bg_color; | |||
return data; | |||
} | |||
} | |||
class CashBtn extends SkipModel{ | |||
String btnText; | |||
String btnTextColor; | |||
String image; | |||
String requiredLogin; | |||
String requiredTaobaoAuth; | |||
String skipIdentifier; | |||
CashBtn( | |||
{this.btnText, | |||
this.btnTextColor, | |||
this.image, | |||
this.requiredLogin, | |||
this.requiredTaobaoAuth, | |||
this.skipIdentifier}); | |||
CashBtn.fromJson(Map<String, dynamic> json) { | |||
btnText = json['btn_text']; | |||
btnTextColor = json['btn_text_color']; | |||
btnImg = json['btn_img']; | |||
image = json['image']; | |||
requiredLogin = json['required_login']; | |||
requiredTaobaoAuth = json['required_taobao_auth']; | |||
skipIdentifier = json['skip_identifier']; | |||
gridViewBgColor = json['grid_view_bg_color']; | |||
gridViewNameColor = json['grid_view_name_color']; | |||
gridViewValueColor = json['grid_view_value_color']; | |||
if (json['grid_view'] != null) { | |||
gridView = new List<MineProfileDataModel>(); | |||
json['grid_view'].forEach((v) { | |||
gridView.add(new MineProfileDataModel.fromJson(v)); | |||
}); | |||
} | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = super.toJson(); | |||
data['accumulated_earnings_name_color'] = this.accumulatedEarningsNameColor; | |||
data['accumulated_earnings_color'] = this.accumulatedEarningsColor; | |||
data['accumulated_earnings_bg_img'] = this.accumulatedEarningsBgImg; | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['btn_text'] = this.btnText; | |||
data['btn_text_color'] = this.btnTextColor; | |||
data['btn_img'] = this.btnImg; | |||
data['image'] = this.image; | |||
data['required_login'] = this.requiredLogin; | |||
data['required_taobao_auth'] = this.requiredTaobaoAuth; | |||
data['skip_identifier'] = this.skipIdentifier; | |||
data['grid_view_bg_color'] = this.gridViewBgColor; | |||
data['grid_view_name_color'] = this.gridViewNameColor; | |||
data['grid_view_value_color'] = this.gridViewValueColor; | |||
if (this.gridView != null) { | |||
data['grid_view'] = this.gridView.map((v) => v.toJson()).toList(); | |||
} | |||
return data; | |||
} | |||
} | |||
class ListStyle extends SkipModel{ | |||
String isShow; | |||
String name; | |||
String numColor; | |||
String requiredLogin; | |||
String requiredTaobaoAuth; | |||
String skipIdentifier; | |||
String textColor; | |||
String type; | |||
ListStyle( | |||
{this.isShow, | |||
this.name, | |||
this.numColor, | |||
this.requiredLogin, | |||
this.requiredTaobaoAuth, | |||
this.skipIdentifier, | |||
this.textColor, | |||
this.type}); | |||
ListStyle.fromJson(Map<String, dynamic> json) { | |||
isShow = json['is_show']; | |||
name = json['name']; | |||
numColor = json['num_color']; | |||
requiredLogin = json['required_login']; | |||
requiredTaobaoAuth = json['required_taobao_auth']; | |||
skipIdentifier = json['skip_identifier']; | |||
textColor = json['text_color']; | |||
type = json['type']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['is_show'] = this.isShow; | |||
data['name'] = this.name; | |||
data['num_color'] = this.numColor; | |||
data['required_login'] = this.requiredLogin; | |||
data['required_taobao_auth'] = this.requiredTaobaoAuth; | |||
data['skip_identifier'] = this.skipIdentifier; | |||
data['text_color'] = this.textColor; | |||
data['type'] = this.type; | |||
return data; | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
import 'dart:async'; | |||
import 'dart:convert'; | |||
import 'package:zhiying_base_widget/widgets/mine/mine_header/model/mine_profile_model.dart'; | |||
import 'package:zhiying_comm/util/base_bloc.dart'; | |||
@@ -21,6 +22,8 @@ class MineHeaderBloc extends BlocBase { | |||
void loadData() { | |||
NetUtil.request('/api/v1/user/profile', | |||
method: NetMethod.GET, onCache: (data) {}, onSuccess: (data) { | |||
Logger.log("我的数据:"+ json.encode(data)); | |||
_profile = MineProfileModel.fromJson(Map<String, dynamic>.from(data)); | |||
_profileController.add(_profile); | |||
}, onError: (err) { | |||
@@ -41,128 +41,119 @@ class _MineHeaderContainerState extends State<MineHeaderContainer> { | |||
@override | |||
Widget build(BuildContext context) { | |||
var width=MediaQuery.of(context).size.width; | |||
var width = MediaQuery.of(context).size.width; | |||
return StreamBuilder<MineProfileModel>( | |||
stream: _bloc.outData, | |||
builder: (BuildContext context, AsyncSnapshot snapshot) { | |||
MineProfileModel profile = snapshot.data; | |||
return profile == null | |||
? MineHeaderSkeleton() | |||
: Row( | |||
children: <Widget>[ | |||
GestureDetector( | |||
child: Container( | |||
margin: EdgeInsets.only( | |||
left: 20, top: 20, bottom: 20, right: 12), | |||
width: 56, | |||
height: 56, | |||
decoration: BoxDecoration( | |||
color: Color(0xfff3f3f3), | |||
borderRadius: BorderRadius.circular(28)), | |||
child: ClipRRect( | |||
borderRadius: BorderRadius.circular(28), | |||
child: CachedNetworkImage( | |||
imageUrl: profile?.avatar ?? '', | |||
fit: BoxFit.cover, | |||
: Container( | |||
child: Row( | |||
children: <Widget>[ | |||
GestureDetector( | |||
child: Container( | |||
margin: EdgeInsets.only(left: 20, top: 20, bottom: 20, right: 12), | |||
width: 56, | |||
height: 56, | |||
decoration: BoxDecoration(color: Color(0xfff3f3f3), borderRadius: BorderRadius.circular(28)), | |||
child: ClipRRect( | |||
borderRadius: BorderRadius.circular(28), | |||
child: CachedNetworkImage( | |||
imageUrl: profile?.avatar ?? '', | |||
fit: BoxFit.cover, | |||
), | |||
), | |||
), | |||
onTap: () async { | |||
await RouterUtil.route(SkipModel.fromJson(widget.json), widget.json, context); | |||
_bloc.loadData(); | |||
}, | |||
), | |||
onTap: () async { | |||
await RouterUtil.route(SkipModel.fromJson(widget.json), | |||
widget.json, context); | |||
_bloc.loadData(); | |||
}, | |||
), | |||
Expanded( | |||
child: Container( | |||
margin: EdgeInsets.only(right: 12), | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.start, | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Row( | |||
children: <Widget>[ | |||
Container( | |||
constraints: BoxConstraints(maxWidth: width-108-80), | |||
child: Text( | |||
profile?.username ?? '', | |||
maxLines: 1, | |||
overflow: TextOverflow.ellipsis, | |||
style: TextStyle( | |||
fontSize: 17, | |||
color: HexColor.fromHex( | |||
widget.staticModel.userNameColor)), | |||
Expanded( | |||
child: Container( | |||
margin: EdgeInsets.only(right: 12), | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.start, | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Row( | |||
children: <Widget>[ | |||
Container( | |||
constraints: BoxConstraints(maxWidth: width - 108 - 80), | |||
child: Text( | |||
profile?.username ?? '', | |||
maxLines: 1, | |||
overflow: TextOverflow.ellipsis, | |||
style: TextStyle( | |||
fontSize: 17, color: HexColor.fromHex(widget.staticModel.userNameColor)), | |||
), | |||
), | |||
), | |||
Container( | |||
height: 18, | |||
margin: EdgeInsets.only(left: 6), | |||
padding: EdgeInsets.only(left: 6, right: 6), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex( | |||
widget.staticModel.lvBgColor), | |||
borderRadius: BorderRadius.circular(9)), | |||
Container( | |||
height: 18, | |||
margin: EdgeInsets.only(left: 6), | |||
padding: EdgeInsets.only(left: 6, right: 6), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(widget.staticModel.bgColor), | |||
borderRadius: BorderRadius.circular(9)), | |||
child: Row( | |||
children: <Widget>[ | |||
Container( | |||
width: 12, | |||
height: 12, | |||
margin: EdgeInsets.only(right: 2), | |||
child: CachedNetworkImage( | |||
imageUrl: profile?.userLvIcon ?? '', | |||
fit: BoxFit.contain, | |||
), | |||
), | |||
Text( | |||
profile?.userLvName ?? '', | |||
style: TextStyle( | |||
fontSize: 10, color: HexColor.fromHex(widget.staticModel.lvNameColor)), | |||
) | |||
], | |||
), | |||
), | |||
], | |||
), | |||
GestureDetector( | |||
child: Container( | |||
margin: EdgeInsets.only(top: 8), | |||
child: Row( | |||
children: <Widget>[ | |||
Text( | |||
'邀请码:${profile.inviteCode}', | |||
maxLines: 1, | |||
style: TextStyle( | |||
fontSize: 13, | |||
color: HexColor.fromHex(widget.staticModel.userNameColor), | |||
fontFamily: 'Din', | |||
package: 'zhiying_comm', | |||
), | |||
), | |||
Container( | |||
width: 12, | |||
height: 12, | |||
margin: EdgeInsets.only(right: 2), | |||
margin: EdgeInsets.only(left: 2), | |||
child: CachedNetworkImage( | |||
imageUrl: profile?.userLvIcon?? '', | |||
imageUrl: widget.staticModel.coypeIcon, | |||
fit: BoxFit.contain, | |||
), | |||
), | |||
Text( | |||
profile?.userLvName?? '', | |||
style: TextStyle( | |||
fontSize: 10, | |||
color: HexColor.fromHex( | |||
widget.staticModel.lvNameColor)), | |||
) | |||
], | |||
), | |||
), | |||
], | |||
), | |||
GestureDetector( | |||
child: Container( | |||
margin: EdgeInsets.only(top: 8), | |||
child: Row( | |||
children: <Widget>[ | |||
Text( | |||
'邀请码:${profile.inviteCode}', | |||
maxLines: 1, | |||
style: TextStyle( | |||
fontSize: 13, | |||
color: HexColor.fromHex( | |||
widget.staticModel.userNameColor), | |||
fontFamily: 'Din', | |||
package: 'zhiying_comm', | |||
), | |||
), | |||
Container( | |||
width: 12, | |||
height: 12, | |||
margin: EdgeInsets.only(left: 2), | |||
child: CachedNetworkImage( | |||
imageUrl: widget.staticModel.coypeIcon, | |||
fit: BoxFit.contain, | |||
), | |||
), | |||
], | |||
), | |||
onTap: () { | |||
Fluttertoast.showToast(msg: '复制成功'); | |||
Clipboard.setData(ClipboardData(text: profile.inviteCode)); | |||
}, | |||
), | |||
onTap: () { | |||
Fluttertoast.showToast(msg: '复制成功'); | |||
Clipboard.setData( | |||
ClipboardData(text: profile.inviteCode)); | |||
}, | |||
), | |||
], | |||
), | |||
)) | |||
], | |||
], | |||
), | |||
)) | |||
], | |||
), | |||
); | |||
}); | |||
} | |||
@@ -35,7 +35,7 @@ class _MineStaticContainerState extends State<MineStaticContainer> { | |||
child: ClipRRect( | |||
borderRadius: BorderRadius.circular(28), | |||
child: CachedNetworkImage( | |||
imageUrl: widget.staticModel.nonLoginAvatar, | |||
imageUrl: widget.staticModel.nonLginAvatar, | |||
fit: BoxFit.cover)), | |||
), | |||
onTap: () { | |||
@@ -54,7 +54,7 @@ class _MineStaticContainerState extends State<MineStaticContainer> { | |||
widget.staticModel.loginName, | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
widget.staticModel?.loginColor ?? '#ffffff'), | |||
widget.staticModel?.userNameColor ?? '#ffffff'), | |||
fontSize: 17), | |||
), | |||
), | |||
@@ -65,7 +65,7 @@ class _MineStaticContainerState extends State<MineStaticContainer> { | |||
widget.staticModel.loginNameHelpText, | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
widget.staticModel?.loginColor ?? '#ffffff'), | |||
widget.staticModel?.userNameColor ?? '#ffffff'), | |||
fontSize: 13), | |||
)), | |||
], | |||
@@ -1,64 +1,128 @@ | |||
class MineHeaderModel { | |||
String lvBgColor; | |||
String lvNameColor; | |||
String nonLoginAvatar; | |||
String userNameColor; | |||
String invitedCodeText; | |||
String assistColor; | |||
String bgColor; | |||
String bgImage; | |||
String bottomLeftRadius; | |||
String bottomRightRadius; | |||
String coypeIcon; | |||
String desc; | |||
String invitedCodeColor; | |||
String loginColor; | |||
String isLeftRightMargin; | |||
String isShow; | |||
String isTopMargin; | |||
String leftRightMargin; | |||
String loginName; | |||
String loginNameHelpText; | |||
String coypeIcon; | |||
String requiredLogin; | |||
String requiredTaobaoAuth; | |||
String lvBgImage; | |||
String lvNameColor; | |||
String moduleKey; | |||
String moduleType; | |||
String name; | |||
String nonLginAvatar; | |||
int requiredLogin; | |||
int requiredTaobaoAuth; | |||
String skipIdentifier; | |||
String themeColor; | |||
String themeType; | |||
String topLeftRadius; | |||
String topMargin; | |||
String topRightRadius; | |||
String userNameColor; | |||
MineHeaderModel( | |||
{this.lvBgColor, | |||
this.lvNameColor, | |||
this.nonLoginAvatar, | |||
this.userNameColor, | |||
this.invitedCodeText, | |||
{this.assistColor, | |||
this.bgColor, | |||
this.bgImage, | |||
this.bottomLeftRadius, | |||
this.bottomRightRadius, | |||
this.coypeIcon, | |||
this.desc, | |||
this.invitedCodeColor, | |||
this.loginColor, | |||
this.isLeftRightMargin, | |||
this.isShow, | |||
this.isTopMargin, | |||
this.leftRightMargin, | |||
this.loginName, | |||
this.loginNameHelpText, | |||
this.coypeIcon, | |||
this.lvBgImage, | |||
this.lvNameColor, | |||
this.moduleKey, | |||
this.moduleType, | |||
this.name, | |||
this.nonLginAvatar, | |||
this.requiredLogin, | |||
this.requiredTaobaoAuth, | |||
this.skipIdentifier}); | |||
this.skipIdentifier, | |||
this.themeColor, | |||
this.themeType, | |||
this.topLeftRadius, | |||
this.topMargin, | |||
this.topRightRadius, | |||
this.userNameColor}); | |||
MineHeaderModel.fromJson(Map<String, dynamic> json) { | |||
lvBgColor = json['lv_bg_color']; | |||
lvNameColor = json['lv_name_color']; | |||
nonLoginAvatar = json['non_login_avatar']; | |||
userNameColor = json['user_name_color']; | |||
invitedCodeText = json['invited_code_text']; | |||
assistColor = json['assist_color']; | |||
bgColor = json['bg_color']; | |||
bgImage = json['bg_image']; | |||
bottomLeftRadius = json['bottom_left_radius']; | |||
bottomRightRadius = json['bottom_right_radius']; | |||
coypeIcon = json['coype_icon']; | |||
desc = json['desc']; | |||
invitedCodeColor = json['invited_code_color']; | |||
loginColor = json['login_color']; | |||
isLeftRightMargin = json['is_left_right_margin']; | |||
isShow = json['is_show']; | |||
isTopMargin = json['is_top_margin']; | |||
leftRightMargin = json['left_right_margin']; | |||
loginName = json['login_name']; | |||
loginNameHelpText = json['login_name_help_text']; | |||
coypeIcon = json['coype_icon']; | |||
lvBgImage = json['lv_bg_image']; | |||
lvNameColor = json['lv_name_color']; | |||
moduleKey = json['module_key']; | |||
moduleType = json['module_type']; | |||
name = json['name']; | |||
nonLginAvatar = json['non_lgin_avatar']; | |||
requiredLogin = json['required_login']; | |||
requiredTaobaoAuth = json['required_taobao_auth']; | |||
skipIdentifier = json['skip_identifier']; | |||
themeColor = json['theme_color']; | |||
themeType = json['theme_type']; | |||
topLeftRadius = json['top_left_radius']; | |||
topMargin = json['top_margin']; | |||
topRightRadius = json['top_right_radius']; | |||
userNameColor = json['user_name_color']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['lv_bg_color'] = this.lvBgColor; | |||
data['lv_name_color'] = this.lvNameColor; | |||
data['non_login_avatar'] = this.nonLoginAvatar; | |||
data['user_name_color'] = this.userNameColor; | |||
data['invited_code_text'] = this.invitedCodeText; | |||
data['assist_color'] = this.assistColor; | |||
data['bg_color'] = this.bgColor; | |||
data['bg_image'] = this.bgImage; | |||
data['bottom_left_radius'] = this.bottomLeftRadius; | |||
data['bottom_right_radius'] = this.bottomRightRadius; | |||
data['coype_icon'] = this.coypeIcon; | |||
data['desc'] = this.desc; | |||
data['invited_code_color'] = this.invitedCodeColor; | |||
data['login_color'] = this.loginColor; | |||
data['is_left_right_margin'] = this.isLeftRightMargin; | |||
data['is_show'] = this.isShow; | |||
data['is_top_margin'] = this.isTopMargin; | |||
data['left_right_margin'] = this.leftRightMargin; | |||
data['login_name'] = this.loginName; | |||
data['login_name_help_text'] = this.loginNameHelpText; | |||
data['coype_icon'] = this.coypeIcon; | |||
data['lv_bg_image'] = this.lvBgImage; | |||
data['lv_name_color'] = this.lvNameColor; | |||
data['module_key'] = this.moduleKey; | |||
data['module_type'] = this.moduleType; | |||
data['name'] = this.name; | |||
data['non_lgin_avatar'] = this.nonLginAvatar; | |||
data['required_login'] = this.requiredLogin; | |||
data['required_taobao_auth'] = this.requiredTaobaoAuth; | |||
data['skip_identifier'] = this.skipIdentifier; | |||
data['theme_color'] = this.themeColor; | |||
data['theme_type'] = this.themeType; | |||
data['top_left_radius'] = this.topLeftRadius; | |||
data['top_margin'] = this.topMargin; | |||
data['top_right_radius'] = this.topRightRadius; | |||
data['user_name_color'] = this.userNameColor; | |||
return data; | |||
} | |||
} | |||
@@ -22,8 +22,8 @@ class MineNavDelegate extends SliverPersistentHeaderDelegate { | |||
} else { | |||
_color = Colors.amber; | |||
} | |||
if (json.containsKey('app_bar_icons')) { | |||
List icons = json['app_bar_icons']; | |||
if (json.containsKey('list_style')) { | |||
List icons = json['list_style']; | |||
_icons = icons.map((icon) { | |||
SkipModel model = SkipModel.fromJson(Map<String, dynamic>.from(icon)); | |||
return MineNavIcon(icon['icon'], model); | |||
@@ -17,7 +17,6 @@ import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:provider/provider.dart'; | |||
import 'model/search_tab_model.dart'; | |||
class SearchTabWidget extends StatefulWidget { | |||
final Map<String, dynamic> data; | |||
SearchTabModel model; | |||
@@ -39,41 +38,49 @@ class _SearchTabWidgetState extends State<SearchTabWidget> { | |||
String _type = GlobalConfig.PROVIDER_TB; | |||
/// 联想列表的item点击事件 | |||
_onThinkItemClick(SearchThinkModel model){ | |||
_onThinkItemClick(SearchThinkModel model) { | |||
model.type = _type; | |||
RouterUtil.hideKeyboard(context); | |||
Provider.of<SearchTagNotifier>(context, listen: false).addTag(model?.keywords); | |||
BlocProvider.of<SearchThinkBloc>(context).add(SearchThinkShowBaseViewEvent()); | |||
Navigator.push(context, CupertinoPageRoute( | |||
builder: (_)=> SearchResultPage(model.toJson()..['tag'] = 'search_page') | |||
)); | |||
Navigator.push( | |||
context, CupertinoPageRoute(builder: (_) => SearchResultPage(model.toJson()..['tag'] = 'search_page'))); | |||
} | |||
@override | |||
void initState() { | |||
_tabController = TabController(length: widget?.model?.search_icon_list?.length ?? 0, vsync: ScrollableState())..addListener((){ | |||
// String type = ''; | |||
// try{ | |||
// type = widget.model.search_icon_list[_tabController.index].type; | |||
// }catch(_){} | |||
// if(!EmptyUtil.isEmpty(type)) { | |||
// BlocProvider.of<SearchThinkBloc>(context).add(SearchThinkChangeTypeEvent(type)); | |||
// } | |||
if(!_tabController.indexIsChanging){ | |||
Logger.log('_tabController.indexIsChanging = ${_tabController?.index}'); | |||
try{ | |||
_type = widget.model.search_icon_list[_tabController.index].type; | |||
Provider.of<SearchTagNotifier>(context, listen: false).setType(_type); | |||
}catch(e, s){ | |||
Logger.error(e,s); | |||
_tabController = TabController(length: widget?.model?.search_icon_list?.length ?? 0, vsync: ScrollableState()) | |||
..addListener(() { | |||
// String type = ''; | |||
// try{ | |||
// type = widget.model.search_icon_list[_tabController.index].type; | |||
// }catch(_){} | |||
// if(!EmptyUtil.isEmpty(type)) { | |||
// BlocProvider.of<SearchThinkBloc>(context).add(SearchThinkChangeTypeEvent(type)); | |||
// } | |||
if (!_tabController.indexIsChanging) { | |||
Logger.log('_tabController.indexIsChanging = ${_tabController?.index}'); | |||
try { | |||
_type = widget.model.search_icon_list[_tabController.index].type; | |||
Provider.of<SearchTagNotifier>(context, listen: false).setType(_type); | |||
} catch (e, s) { | |||
Logger.error(e, s); | |||
} | |||
} | |||
} | |||
}); | |||
}); | |||
WidgetsBinding.instance.addPostFrameCallback((_) => setTabSelect()); | |||
super.initState(); | |||
} | |||
setTabSelect() { | |||
for (int i = 0; i < widget.model.search_icon_list.length; i++) { | |||
print("tab选择的类型" + widget.model.search_icon_list[i].type); | |||
} | |||
// setState(() { | |||
// _tabController.animateTo(2); | |||
// }); | |||
} | |||
@override | |||
void dispose() { | |||
_tabController?.dispose(); | |||
@@ -103,8 +110,8 @@ class _SearchTabWidgetState extends State<SearchTabWidget> { | |||
TabBar( | |||
controller: _tabController, | |||
isScrollable: true, | |||
labelStyle: TextStyle( fontSize: 14, fontWeight: FontWeight.bold), | |||
unselectedLabelColor: HexColor.fromHex( model?.nameColor ?? '#999999'), | |||
labelStyle: TextStyle(fontSize: 14, fontWeight: FontWeight.bold), | |||
unselectedLabelColor: HexColor.fromHex(model?.nameColor ?? '#999999'), | |||
labelColor: HexColor.fromHex(model?.nameSelectColor ?? '#FF4242'), | |||
// indicatorSize: TabBarIndicatorSize.label, | |||
indicator: MaterialIndicator( | |||
@@ -118,12 +125,14 @@ class _SearchTabWidgetState extends State<SearchTabWidget> { | |||
), | |||
tabs: model.search_icon_list.map((item) { | |||
return MyTab( | |||
icon: CachedNetworkImage(imageUrl: item?.with_icon_color ?? '', width: 14,), | |||
icon: CachedNetworkImage( | |||
imageUrl: item?.with_icon_color ?? '', | |||
width: 14, | |||
), | |||
text: item.name, | |||
); | |||
}).toList(), | |||
), | |||
Expanded( | |||
child: _getItemWidget(model), | |||
), | |||
@@ -133,29 +142,26 @@ class _SearchTabWidgetState extends State<SearchTabWidget> { | |||
} | |||
/// 根据输入框,是否显示联想列表还是其它 | |||
Widget _getItemWidget(SearchTabModel model){ | |||
Widget _getItemWidget(SearchTabModel model) { | |||
return Stack( | |||
children: <Widget>[ | |||
_getTabBarView(model), | |||
BlocConsumer<SearchThinkBloc, SearchThinkState>( | |||
listener: (context, state){}, | |||
buildWhen: (prev, current){ | |||
if(current is SearchThinkErrorState){ | |||
listener: (context, state) {}, | |||
buildWhen: (prev, current) { | |||
if (current is SearchThinkErrorState) { | |||
return false; | |||
} | |||
return true; | |||
}, | |||
builder: (context, state){ | |||
builder: (context, state) { | |||
// return Visibility( | |||
// replacement: _getTabBarView(model), | |||
// | |||
// child: _getThinkListWidget(), | |||
// ); | |||
if(state is SearchThinkLoadedState){ | |||
if (state is SearchThinkLoadedState) { | |||
return _getThinkListWidget(state.model); | |||
} | |||
return Container(); | |||
@@ -166,10 +172,10 @@ class _SearchTabWidgetState extends State<SearchTabWidget> { | |||
} | |||
/// tabBarView | |||
Widget _getTabBarView(SearchTabModel model){ | |||
Widget _getTabBarView(SearchTabModel model) { | |||
return TabBarView( | |||
controller: _tabController, | |||
children: model.search_icon_list.map((item){ | |||
children: model.search_icon_list.map((item) { | |||
// TODO 这里需要和后台沟通改成页面的唯一标示 | |||
// return PageFactory.create('search_item_page', item.toJson()); | |||
return SearchItemPage(item.toJson()); | |||
@@ -177,31 +183,31 @@ class _SearchTabWidgetState extends State<SearchTabWidget> { | |||
); | |||
} | |||
/// 联想列表 | |||
Widget _getThinkListWidget(List<SearchThinkModel> model){ | |||
Widget _getThinkListWidget(List<SearchThinkModel> model) { | |||
return Container( | |||
color: Colors.white, | |||
height: double.infinity, | |||
child: ListView.builder(itemBuilder: (context, index){ | |||
SearchThinkModel item = model[index]; | |||
return GestureDetector( | |||
onTap: ()=> _onThinkItemClick(item), | |||
child: Container( | |||
decoration: BoxDecoration( | |||
border: Border(bottom: BorderSide(width: 0.5, color: HexColor.fromHex('#EEEEEE'))) | |||
child: ListView.builder( | |||
itemBuilder: (context, index) { | |||
SearchThinkModel item = model[index]; | |||
return GestureDetector( | |||
onTap: () => _onThinkItemClick(item), | |||
child: Container( | |||
decoration: | |||
BoxDecoration(border: Border(bottom: BorderSide(width: 0.5, color: HexColor.fromHex('#EEEEEE')))), | |||
padding: const EdgeInsets.only(top: 13, bottom: 13), | |||
child: Text( | |||
'${item?.keywords}', | |||
style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 14), | |||
), | |||
), | |||
padding: const EdgeInsets.only(top: 13, bottom: 13), | |||
child: Text('${item?.keywords}', style: TextStyle( color: HexColor.fromHex('#333333'), fontSize: 14),), | |||
), | |||
); | |||
}, | |||
); | |||
}, | |||
itemCount: model?.length ?? 0, | |||
padding: const EdgeInsets.only(left: 12.5, right: 12.5), | |||
shrinkWrap: true, | |||
), | |||
); | |||
} | |||
} |