@@ -67,6 +67,11 @@ class _MainPageContainerState extends State<_MainPageContainer> | |||
// _refreshController.loadComplete(); | |||
} | |||
void _onRefresh() async{ | |||
await Duration(microseconds: 3); | |||
_refreshController.refreshCompleted(); | |||
} | |||
@override | |||
void didChangeAppLifecycleState(AppLifecycleState state) async { | |||
///智能粘贴板 | |||
@@ -77,6 +82,7 @@ class _MainPageContainerState extends State<_MainPageContainer> | |||
@override | |||
void dispose() { | |||
_controller.dispose(); | |||
_refreshController.dispose(); | |||
WidgetsBinding.instance.removeObserver(this); | |||
super.dispose(); | |||
} | |||
@@ -123,10 +129,11 @@ class _MainPageContainerState extends State<_MainPageContainer> | |||
context: context, | |||
child: SmartRefresher( | |||
enablePullDown: true, | |||
enablePullUp: false, | |||
enablePullUp: true, | |||
header: WaterDropHeader(), | |||
controller: _refreshController, | |||
onLoading: _onLoading, | |||
onRefresh: _onRefresh, | |||
child: Container( | |||
width: double.infinity, | |||
child: Stack( | |||
@@ -140,7 +140,7 @@ class _SearchResultItemPageContianerState extends State<SearchResultItemPageCont | |||
enablePullDown: true, | |||
enablePullUp: true, | |||
// footer: ClassicFooter(), | |||
// header: WaterDropHeader(), | |||
// header: MaterialClassicHeader(), | |||
controller: _refreshController, | |||
child: CustomScrollView( | |||
controller: _controller, | |||
@@ -0,0 +1,21 @@ | |||
import 'dart:async'; | |||
import 'package:bloc/bloc.dart'; | |||
import 'package:equatable/equatable.dart'; | |||
part 'team_details_event.dart'; | |||
part 'team_details_state.dart'; | |||
class TeamDetailsBloc extends Bloc<TeamDetailsEvent, TeamDetailsState> { | |||
// TeamDetailsBloc() : super(TeamDetailsInitial()); | |||
@override | |||
Stream<TeamDetailsState> mapEventToState( | |||
TeamDetailsEvent event, | |||
) async* { | |||
} | |||
@override | |||
TeamDetailsState get initialState => TeamDetailsInitial(); | |||
} |
@@ -0,0 +1,5 @@ | |||
part of 'team_details_bloc.dart'; | |||
abstract class TeamDetailsEvent extends Equatable { | |||
const TeamDetailsEvent(); | |||
} |
@@ -0,0 +1,4 @@ | |||
class TeamDetailsRepository{ | |||
} |
@@ -0,0 +1,10 @@ | |||
part of 'team_details_bloc.dart'; | |||
abstract class TeamDetailsState extends Equatable { | |||
const TeamDetailsState(); | |||
} | |||
class TeamDetailsInitial extends TeamDetailsState { | |||
@override | |||
List<Object> get props => []; | |||
} |
@@ -0,0 +1,36 @@ | |||
import 'package:flutter/material.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart' | |||
''; | |||
/// | |||
/// 我的团队 - 用户详情 | |||
/// | |||
class TeamDetailsPage extends StatefulWidget { | |||
@override | |||
_TeamDetailsPageState createState() => _TeamDetailsPageState(); | |||
} | |||
class _TeamDetailsPageState extends State<TeamDetailsPage> { | |||
@override | |||
Widget build(BuildContext context) { | |||
return _getMainWidget(); | |||
} | |||
/// 主视图 | |||
Widget _getMainWidget(){ | |||
return Scaffold( | |||
backgroundColor: HexColor.fromHex('#F9F9F9'), | |||
body: Container(), | |||
); | |||
} | |||
/// 推荐人 | |||
/// 推荐人的信息 | |||
/// 本月数据 & 上个月数据 | |||
} |
@@ -0,0 +1,25 @@ | |||
import 'dart:async'; | |||
import 'package:bloc/bloc.dart'; | |||
import 'package:equatable/equatable.dart'; | |||
part 'team_event.dart'; | |||
part 'team_state.dart'; | |||
class TeamBloc extends Bloc<TeamEvent, TeamState> { | |||
// TeamBloc() : super(TeamInitial()); | |||
@override | |||
TeamState get initialState => TeamInitial(); | |||
@override | |||
Stream<TeamState> mapEventToState( | |||
TeamEvent event, | |||
) async* { | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
part of 'team_bloc.dart'; | |||
abstract class TeamEvent extends Equatable { | |||
const TeamEvent(); | |||
} |
@@ -0,0 +1,4 @@ | |||
class TeamRepository{ | |||
} |
@@ -0,0 +1,10 @@ | |||
part of 'team_bloc.dart'; | |||
abstract class TeamState extends Equatable { | |||
const TeamState(); | |||
} | |||
class TeamInitial extends TeamState { | |||
@override | |||
List<Object> get props => []; | |||
} |
@@ -0,0 +1,249 @@ | |||
import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:tab_indicator_styler/tab_indicator_styler.dart'; | |||
import 'package:zhiying_base_widget/widgets/team/data/team_data_widet.dart'; | |||
import 'package:zhiying_base_widget/widgets/team/recommend/team_recommend_widget.dart'; | |||
import 'package:zhiying_comm/util/custom_sliver_persistent_header_delegate.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'dart:ui'; | |||
/// | |||
/// 我的团队 | |||
/// | |||
class TeamPage extends StatefulWidget { | |||
@override | |||
_TeamPageState createState() => _TeamPageState(); | |||
} | |||
class _TeamPageState extends State<TeamPage> { | |||
@override | |||
Widget build(BuildContext context) { | |||
return _getMainWidget(); | |||
} | |||
var tabTitle = [ | |||
'全部会员', | |||
'青铜会员', | |||
'白银会员', | |||
'黄金会员', | |||
]; | |||
TabController _controller; | |||
@override | |||
void initState() { | |||
_controller = TabController(length: tabTitle.length, vsync: ScrollableState()); | |||
super.initState(); | |||
} | |||
@override | |||
void dispose() { | |||
_controller?.dispose(); | |||
super.dispose(); | |||
} | |||
/// 主体视图 | |||
Widget _getMainWidget() { | |||
return Scaffold( | |||
backgroundColor: HexColor.fromHex('#F9F9F9'), | |||
body: NestedScrollView( | |||
headerSliverBuilder: (context, bool) { | |||
return [ | |||
/// 头部Bar | |||
SliverAppBar( | |||
// expandedHeight: 200.0, | |||
leading: IconButton( | |||
icon: Icon( | |||
Icons.arrow_back_ios, | |||
size: 22, | |||
color: HexColor.fromHex('#333333'), | |||
), | |||
onPressed: () => Navigator.maybePop(context), | |||
), | |||
backgroundColor: Colors.white, | |||
floating: true, | |||
pinned: true, | |||
title: Text( | |||
'我的团队', | |||
style: TextStyle(color: HexColor.fromHex('#333333'), fontWeight: FontWeight.bold, fontSize: 18), | |||
), | |||
centerTitle: true, | |||
elevation: 0, | |||
), | |||
/// 我的推荐人 | |||
SliverToBoxAdapter( | |||
child: TeamRecommendWidget(), | |||
), | |||
/// 数据 | |||
SliverToBoxAdapter( | |||
child: TeamDataWidget(), | |||
), | |||
SliverToBoxAdapter(child: SizedBox(height: 8)), | |||
/// 输入框 | |||
SliverPersistentHeader( | |||
delegate: CustomSliverPersistentHeaderDelegate( | |||
min: 34, | |||
max: 34, | |||
child: Container( | |||
width: double.infinity, | |||
height: double.infinity, | |||
padding: const EdgeInsets.only(top: 10, left: 12.5, right: 12.5), | |||
color: Colors.white, | |||
child: Row( | |||
children: <Widget>[ | |||
/// 输入框 | |||
Expanded( | |||
child: Container( | |||
height: 24, | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(30), | |||
color: HexColor.fromHex('#F7F7F7'), | |||
), | |||
padding: const EdgeInsets.only(top: 5, bottom: 4.5, left: 7.5, right: 7.5), | |||
width: double.infinity, | |||
child: Row( | |||
children: <Widget>[ | |||
Container(width: 11.5, height: 11.5, color: Colors.red,), | |||
Expanded(child: Container( | |||
color: Colors.transparent, | |||
child: TextField( | |||
style: TextStyle(fontSize: 11 , color: HexColor.fromHex('#000000'), textBaseline: TextBaseline.alphabetic), | |||
decoration: InputDecoration( | |||
focusedBorder: InputBorder.none, | |||
border: InputBorder.none, | |||
focusedErrorBorder: InputBorder.none, | |||
errorBorder: InputBorder.none, | |||
disabledBorder: InputBorder.none, | |||
enabledBorder: InputBorder.none, | |||
filled: true, | |||
isDense: true, | |||
contentPadding: const EdgeInsets.only(left: 6, bottom: 0, top: 0, right: 0), | |||
fillColor: Colors.transparent, | |||
hintStyle: TextStyle(fontSize: 11 , color: HexColor.fromHex('#999999'), textBaseline: TextBaseline.alphabetic), | |||
hintText: '输入需搜索的手机号/昵称', | |||
), | |||
), | |||
),), | |||
Container(width: 15, height: 15, color: Colors.red,) | |||
], | |||
), | |||
), | |||
), | |||
const SizedBox(width: 8), | |||
/// 确定按钮 | |||
Container( | |||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: HexColor.fromHex('#FF4242')), | |||
padding: const EdgeInsets.only(left: 15, right: 15, bottom: 6.5, top: 6.5), | |||
child: Text('搜索', style: TextStyle(color: HexColor.fromHex('#FFFFFF'), fontSize: 11),), | |||
) | |||
], | |||
), | |||
), | |||
), | |||
pinned: true, | |||
), | |||
/// 悬停TabBar | |||
SliverPersistentHeader( | |||
delegate: new _SliverTabBarDelegate( | |||
TabBar( | |||
isScrollable: false, | |||
labelStyle: TextStyle(fontWeight: FontWeight.bold, fontSize: 13), | |||
unselectedLabelStyle: TextStyle(fontSize: 13), | |||
indicator: MaterialIndicator( | |||
height: 2, | |||
topLeftRadius: 8, | |||
topRightRadius: 8, | |||
bottomLeftRadius: 8, | |||
bottomRightRadius: 8, | |||
color: HexColor.fromHex('#F94B47'), | |||
horizontalPadding: 30, | |||
), | |||
controller: _controller, | |||
tabs: tabTitle.map((f) => Tab(text: f)).toList(), | |||
indicatorColor: Colors.red, | |||
unselectedLabelColor: HexColor.fromHex('#999999'), | |||
labelColor: HexColor.fromHex('#000000'), | |||
), | |||
), | |||
pinned: true, | |||
), | |||
/// 筛选条件 | |||
SliverPersistentHeader( | |||
delegate: CustomSliverPersistentHeaderDelegate( | |||
max: 32.5, | |||
min: 32.5, | |||
child: Container( | |||
height: double.infinity, | |||
width: double.infinity, | |||
color: HexColor.fromHex('#FFFFFF'), | |||
child: Row( | |||
mainAxisAlignment: MainAxisAlignment.spaceAround, | |||
children: <Widget>[ | |||
Text('邀请人数', style: TextStyle(fontSize: 12, color: HexColor.fromHex('#999999')),), | |||
Text('邀请人数', style: TextStyle(fontSize: 12, color: HexColor.fromHex('#999999')),), | |||
Text('邀请人数', style: TextStyle(fontSize: 12, color: HexColor.fromHex('#999999')),), | |||
Text('邀请人数', style: TextStyle(fontSize: 12, color: HexColor.fromHex('#999999')),), | |||
], | |||
), | |||
)), | |||
pinned: true, | |||
), | |||
]; | |||
}, | |||
body: MediaQuery.removePadding( | |||
removeTop: true, | |||
context: context, | |||
child: TabBarView( | |||
controller: _controller, | |||
children: tabTitle | |||
.map((s) => ListView.builder( | |||
itemBuilder: (context, int) => Text("123"), | |||
itemCount: 100, | |||
)) | |||
.toList(), | |||
), | |||
), | |||
), | |||
); | |||
} | |||
} | |||
class _SliverTabBarDelegate extends SliverPersistentHeaderDelegate { | |||
final TabBar widget; | |||
const _SliverTabBarDelegate(this.widget) : assert(widget != null); | |||
@override | |||
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { | |||
return Container( | |||
color: Colors.white, | |||
child: Row( | |||
children: <Widget>[ | |||
const SizedBox(width: 30), | |||
Expanded( | |||
child: this.widget, | |||
), | |||
const SizedBox(width: 30), | |||
], | |||
), | |||
); | |||
} | |||
@override | |||
bool shouldRebuild(_SliverTabBarDelegate oldDelegate) { | |||
return false; | |||
} | |||
@override | |||
double get maxExtent => widget.preferredSize.height; | |||
@override | |||
double get minExtent => widget.preferredSize.height; | |||
} |
@@ -15,28 +15,28 @@ class _TestPageState extends State<TestPage> { | |||
@override | |||
void initState() { | |||
NetUtil.request('/api/v1/rec/featured?page=3', method: NetMethod.GET, | |||
onSuccess: (data) { | |||
List goods = data['good']; | |||
_styleModel = HomeGoodsStyleModel( | |||
listColumn: '1', | |||
// recommendList, | |||
providerNameColor: '#ffffff', | |||
providerNameBackgroundColor: '#ff4242', | |||
shopNameColor: '#ffffff', | |||
shopIcon: '', | |||
couponFontColor: '#ffffff', | |||
couponBgColor: '#ff4242', | |||
commissionFontColor: '#ffffff', | |||
commissionBgColor: '#ff4242', | |||
marketPriceColor: '#ffffff', | |||
currentPriceColor: '#ff4242', | |||
); | |||
_goods = goods.map((e) { | |||
return HomeGoodsModel.fromJson(Map<String, dynamic>.from(e)); | |||
}).toList(); | |||
setState(() {}); | |||
}); | |||
// NetUtil.request('/api/v1/rec/featured?page=3', method: NetMethod.GET, | |||
// onSuccess: (data) { | |||
// List goods = data['good']; | |||
// _styleModel = HomeGoodsStyleModel( | |||
// listColumn: '1', | |||
// // recommendList, | |||
// providerNameColor: '#ffffff', | |||
// providerNameBackgroundColor: '#ff4242', | |||
// shopNameColor: '#ffffff', | |||
// shopIcon: '', | |||
// couponFontColor: '#ffffff', | |||
// couponBgColor: '#ff4242', | |||
// commissionFontColor: '#ffffff', | |||
// commissionBgColor: '#ff4242', | |||
// marketPriceColor: '#ffffff', | |||
// currentPriceColor: '#ff4242', | |||
// ); | |||
// _goods = goods.map((e) { | |||
// return HomeGoodsModel.fromJson(Map<String, dynamic>.from(e)); | |||
// }).toList(); | |||
// setState(() {}); | |||
// }); | |||
super.initState(); | |||
} | |||
@@ -46,30 +46,32 @@ class _TestPageState extends State<TestPage> { | |||
appBar: AppBar( | |||
title: Text('测试'), | |||
), | |||
body: CustomScrollView( | |||
slivers: <Widget>[ | |||
SliverFixedExtentList( | |||
itemExtent: 200.0, | |||
delegate: new SliverChildBuilderDelegate( | |||
(BuildContext context, int index) { | |||
//创建列表项 | |||
return HomeGoodsItemSingle( | |||
_goods[index % _goods.length], _styleModel); | |||
}, | |||
childCount: (_goods?.length ?? 0) * 2000, //50个列表项 | |||
), | |||
), | |||
// SliverToBoxAdapter( | |||
// child: ListView.builder( | |||
// shrinkWrap: true, | |||
// physics: NeverScrollableScrollPhysics(), | |||
// itemCount: (_goods?.length ?? 0) * 20, | |||
// itemBuilder: (context, index) { | |||
// return HomeGoodsItemSingle( | |||
// _goods[index % _goods.length], _styleModel); | |||
// }), | |||
// ) | |||
], | |||
)); | |||
body: Container(), | |||
// body: CustomScrollView( | |||
// slivers: <Widget>[ | |||
// SliverFixedExtentList( | |||
// itemExtent: 200.0, | |||
// delegate: new SliverChildBuilderDelegate( | |||
// (BuildContext context, int index) { | |||
// //创建列表项 | |||
// return HomeGoodsItemSingle( | |||
// _goods[index % _goods.length], _styleModel); | |||
// }, | |||
// childCount: (_goods?.length ?? 0) * 2000, //50个列表项 | |||
// ), | |||
// ), | |||
// // SliverToBoxAdapter( | |||
// // child: ListView.builder( | |||
// // shrinkWrap: true, | |||
// // physics: NeverScrollableScrollPhysics(), | |||
// // itemCount: (_goods?.length ?? 0) * 20, | |||
// // itemBuilder: (context, index) { | |||
// // return HomeGoodsItemSingle( | |||
// // _goods[index % _goods.length], _styleModel); | |||
// // }), | |||
// // ) | |||
// ], | |||
// )); | |||
); | |||
} | |||
} |
@@ -16,6 +16,7 @@ import 'package:zhiying_base_widget/pages/security_page/security_mobile/security | |||
import 'package:zhiying_base_widget/pages/security_page/security_page.dart'; | |||
import 'package:zhiying_base_widget/pages/security_page/security_password/security_password.dart'; | |||
import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart'; | |||
import 'package:zhiying_base_widget/pages/team_page/team_page.dart'; | |||
import 'package:zhiying_base_widget/pages/test_page/test_page.dart'; | |||
import 'package:zhiying_base_widget/pages/webview/base_webview.dart'; | |||
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart'; | |||
@@ -136,6 +137,9 @@ class BaseWidgetRegister { | |||
PageFactory.regist( | |||
'pub.flutter.invite_friends', (model) => InvitedFriendsPage(model)); | |||
PageFactory.regist('pub.flutter.fav', (model) => FavoritePage()); | |||
/// 我的团队 | |||
PageFactory.regist('team_page', (model) => TeamPage()); | |||
} | |||
// 注册控件 | |||
@@ -77,7 +77,7 @@ class _HomeGoodsHeaderState extends State<_HomeGoodsHeader> | |||
_style = HomeGoodsStyleModel.fromJson(Map<String, dynamic>.from(json)); | |||
_tabController = | |||
TabController(length: _style.recommendList.length, vsync: this); | |||
TabController(length: _style?.recommendList?.length?? 0, vsync: this); | |||
if (_style.recommendList.first != null) { | |||
widget.eventBus | |||
.fire(HomeGoodsHeaderEvent(_style.recommendList.first.type)); | |||
@@ -14,8 +14,7 @@ class HomeGoodsItem extends StatelessWidget { | |||
final HomeGoodsStyleModel style; | |||
Map<String, dynamic> data; | |||
HomeGoodsItem(this.goods, this.style, {Key key, this.data}) | |||
: super(key: key) { | |||
HomeGoodsItem(this.goods, this.style, {Key key, this.data}) : 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)); | |||
@@ -34,10 +33,7 @@ class HomeGoodsItem extends StatelessWidget { | |||
onTap: () => _onJumpGoodsDetails(context, goods), | |||
child: Container( | |||
margin: EdgeInsets.only(top: 4, bottom: 4, left: 5, right: 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: Column( | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
@@ -66,7 +62,6 @@ class HomeGoodsItem extends StatelessWidget { | |||
_createShop(), | |||
Expanded(child: Container()), | |||
_createBottom(), | |||
_createCupone(), | |||
], | |||
), | |||
@@ -80,6 +75,18 @@ class HomeGoodsItem extends StatelessWidget { | |||
Widget _createTitle() { | |||
List<InlineSpan> list = List(); | |||
if (goods.providerName != null && goods.providerName != '') { | |||
HomeGoodsStyleModelProviders providers; | |||
int providersLength = style?.providers?.length ?? 0; | |||
if(providersLength > 0) { | |||
for (int i = 0; i < style.providers.length; i++) { | |||
HomeGoodsStyleModelProviders item = style.providers[i]; | |||
if (goods.provider == item.type) { | |||
providers = item; | |||
break; | |||
} | |||
} | |||
} | |||
list.add(WidgetSpan( | |||
child: Container( | |||
padding: EdgeInsets.only(left: 2, right: 2, top: 3, bottom: 3), | |||
@@ -89,21 +96,20 @@ class HomeGoodsItem extends StatelessWidget { | |||
style: TextStyle( | |||
fontSize: 9, | |||
height: 1, | |||
color: HexColor.fromHex(style.providerNameColor), | |||
// color: HexColor.fromHex(style.providerNameColor), | |||
color: HexColor.fromHex(providers?.providerNameColor), | |||
), | |||
), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(style.providerNameBackgroundColor), | |||
// color: HexColor.fromHex(style.providerNameBackgroundColor), | |||
color: HexColor.fromHex(providers?.providerBgColor), | |||
borderRadius: BorderRadius.circular(2.5)), | |||
), | |||
)); | |||
} | |||
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, | |||
@@ -131,10 +137,7 @@ class HomeGoodsItem extends StatelessWidget { | |||
child: Text( | |||
goods.shopName, | |||
maxLines: 1, | |||
style: TextStyle( | |||
color: HexColor.fromHex(style.shopNameColor), | |||
fontSize: 11, | |||
fontWeight: FontWeight.w400), | |||
style: TextStyle(color: HexColor.fromHex(style.shopNameColor), fontSize: 11, fontWeight: FontWeight.w400), | |||
)) | |||
], | |||
), | |||
@@ -144,42 +147,103 @@ class HomeGoodsItem extends StatelessWidget { | |||
Widget _createCupone() { | |||
List<Widget> widgets = List(); | |||
if (goods.coupon != null && goods.coupon != '') { | |||
var couponDe = style?.couponCommission?.coupon?.isImg == '1' | |||
? BoxDecoration( | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider(style?.couponCommission?.coupon?.couponBgImg ?? ''), | |||
), | |||
borderRadius: BorderRadius.circular(2.5), | |||
) | |||
: BoxDecoration( | |||
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
); | |||
widgets.add(Container( | |||
margin: EdgeInsets.only(right: 5), | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(style.couponBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
), | |||
child: Text( | |||
goods.coupon, | |||
textAlign: TextAlign.center, | |||
// decoration: BoxDecoration( | |||
// color: HexColor.fromHex(style.couponBgColor), | |||
// borderRadius: BorderRadius.circular(2.5), | |||
// ), | |||
// child: Text( | |||
// goods.coupon, | |||
// textAlign: TextAlign.center, | |||
// maxLines: 1, | |||
// style: TextStyle( | |||
// height: 1, | |||
// fontSize: 11, | |||
// // color: HexColor.fromHex(style.couponFontColor), | |||
// color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor), | |||
// ), | |||
// ), | |||
decoration: couponDe, | |||
child: RichText( | |||
maxLines: 1, | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style.couponFontColor), | |||
), | |||
textAlign: TextAlign.center, | |||
text: TextSpan( | |||
text: '${goods?.coupon ?? '0'}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor), | |||
), | |||
children: [ | |||
TextSpan( | |||
text: '${style?.couponCommission?.coupon?.couonText ?? '元劵'}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor), | |||
), | |||
) | |||
]), | |||
), | |||
)); | |||
} | |||
if (goods.commission != null || goods.commission != '') { | |||
var commissionDe = style?.couponCommission?.commission?.isImg == '1' | |||
? BoxDecoration( | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider(style?.couponCommission?.commission?.commissionBgImg ?? ''), | |||
), | |||
borderRadius: BorderRadius.circular(2.5), | |||
) | |||
: BoxDecoration( | |||
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
); | |||
widgets.add(Container( | |||
margin: EdgeInsets.only(right: 5), | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(style.commissionBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
), | |||
child: Text( | |||
goods.commission, | |||
textAlign: TextAlign.center, | |||
// decoration: BoxDecoration( | |||
// color: HexColor.fromHex(style.commissionBgColor), | |||
// borderRadius: BorderRadius.circular(2.5), | |||
// ), | |||
decoration: commissionDe, | |||
child: RichText( | |||
maxLines: 1, | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style.commissionFontColor), | |||
textAlign: TextAlign.center, | |||
text: TextSpan( | |||
text: '${style?.couponCommission?.commission?.commissionText ?? ''}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor), | |||
), | |||
children: [ | |||
TextSpan( | |||
text: '${goods?.commission ?? '0'}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor), | |||
), | |||
) | |||
] | |||
), | |||
), | |||
)); | |||
@@ -14,8 +14,7 @@ class HomeGoodsItemSingle extends StatelessWidget { | |||
final HomeGoodsStyleModel style; | |||
Map<String, dynamic> data; | |||
HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data}) | |||
: super(key: key) { | |||
HomeGoodsItemSingle(this.goods, this.style, {Key key, this.data}) : 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)); | |||
@@ -35,9 +34,7 @@ class HomeGoodsItemSingle extends StatelessWidget { | |||
child: Container( | |||
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), | |||
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>[ | |||
@@ -81,6 +78,18 @@ class HomeGoodsItemSingle extends StatelessWidget { | |||
Widget _createTitle() { | |||
List<InlineSpan> list = List(); | |||
if (goods.providerName != null && goods.providerName != '') { | |||
HomeGoodsStyleModelProviders providers; | |||
int providersLength = style?.providers?.length ?? 0; | |||
if (providersLength > 0) { | |||
for (int i = 0; i < style?.providers?.length ?? 0; i++) { | |||
HomeGoodsStyleModelProviders item = style.providers[i]; | |||
if (goods.provider == item.type) { | |||
providers = item; | |||
break; | |||
} | |||
} | |||
} | |||
list.add(WidgetSpan( | |||
child: Container( | |||
padding: EdgeInsets.only(left: 2, right: 2, top: 3, bottom: 3), | |||
@@ -90,21 +99,20 @@ class HomeGoodsItemSingle extends StatelessWidget { | |||
style: TextStyle( | |||
fontSize: 9, | |||
height: 1, | |||
color: HexColor.fromHex(style.providerNameColor), | |||
// color: HexColor.fromHex(style.providerNameColor), | |||
color: HexColor.fromHex(providers?.providerNameColor), | |||
), | |||
), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(style.providerNameBackgroundColor), | |||
// color: HexColor.fromHex(style.providerNameBackgroundColor), | |||
color: HexColor.fromHex(providers?.providerBgColor), | |||
borderRadius: BorderRadius.circular(2.5)), | |||
), | |||
)); | |||
} | |||
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, | |||
@@ -130,13 +138,10 @@ class HomeGoodsItemSingle extends StatelessWidget { | |||
), | |||
Expanded( | |||
child: Text( | |||
goods.shopName, | |||
maxLines: 1, | |||
style: TextStyle( | |||
color: HexColor.fromHex(style.shopNameColor), | |||
fontSize: 11, | |||
fontWeight: FontWeight.w400), | |||
)) | |||
goods.shopName, | |||
maxLines: 1, | |||
style: TextStyle(color: HexColor.fromHex(style.shopNameColor), fontSize: 11, fontWeight: FontWeight.w400), | |||
)) | |||
], | |||
), | |||
); | |||
@@ -145,45 +150,119 @@ class HomeGoodsItemSingle extends StatelessWidget { | |||
Widget _createCupone() { | |||
List<Widget> widgets = List(); | |||
if (goods.coupon != null && goods.coupon != '') { | |||
var couponDe = style?.couponCommission?.coupon?.isImg == '1' | |||
? BoxDecoration( | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider(style?.couponCommission?.coupon?.couponBgImg ?? ''), | |||
), | |||
borderRadius: BorderRadius.circular(2.5), | |||
) | |||
: BoxDecoration( | |||
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
); | |||
widgets.add(Container( | |||
margin: EdgeInsets.only(right: 5), | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(style.couponBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
), | |||
child: Text( | |||
goods.coupon, | |||
textAlign: TextAlign.center, | |||
// decoration: BoxDecoration( | |||
// color: HexColor.fromHex(style.couponBgColor), | |||
// borderRadius: BorderRadius.circular(2.5), | |||
// ), | |||
// child: Text( | |||
// goods.coupon, | |||
// textAlign: TextAlign.center, | |||
// maxLines: 1, | |||
// style: TextStyle( | |||
// height: 1, | |||
// fontSize: 11, | |||
// // color: HexColor.fromHex(style.couponFontColor), | |||
// color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor), | |||
// ), | |||
// ), | |||
decoration: couponDe, | |||
child: RichText( | |||
maxLines: 1, | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style.couponFontColor), | |||
), | |||
textAlign: TextAlign.center, | |||
text: TextSpan( | |||
text: '${goods?.coupon ?? '0'}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor), | |||
), | |||
children: [ | |||
TextSpan( | |||
text: '${style?.couponCommission?.coupon?.couonText ?? '元劵'}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.coupon?.couponFontColor), | |||
), | |||
) | |||
]), | |||
), | |||
)); | |||
} | |||
if (goods.commission != null || goods.commission != '') { | |||
widgets.add(Container( | |||
margin: EdgeInsets.only(right: 5), | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(style.commissionBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
), | |||
child: Text( | |||
goods.commission, | |||
textAlign: TextAlign.center, | |||
maxLines: 1, | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style.commissionFontColor), | |||
var commissionDe = style?.couponCommission?.commission?.isImg == '1' | |||
? BoxDecoration( | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider(style?.couponCommission?.commission?.commissionBgImg ?? ''), | |||
), | |||
borderRadius: BorderRadius.circular(2.5), | |||
) | |||
: BoxDecoration( | |||
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionBgColor), | |||
borderRadius: BorderRadius.circular(2.5), | |||
); | |||
widgets.add( | |||
Container( | |||
margin: EdgeInsets.only(right: 5), | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3), | |||
// decoration: BoxDecoration( | |||
// color: HexColor.fromHex(style.commissionBgColor), | |||
// borderRadius: BorderRadius.circular(2.5), | |||
// ), | |||
// child: Text( | |||
// goods.commission, | |||
// textAlign: TextAlign.center, | |||
// maxLines: 1, | |||
// style: TextStyle( | |||
// height: 1, | |||
// fontSize: 11, | |||
// // color: HexColor.fromHex(style.commissionFontColor), | |||
// color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor), | |||
// ), | |||
// ), | |||
decoration: commissionDe, | |||
child: RichText( | |||
maxLines: 1, | |||
textAlign: TextAlign.center, | |||
text: TextSpan( | |||
text: '${style?.couponCommission?.commission?.commissionText ?? ''}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor), | |||
), | |||
children: [ | |||
TextSpan( | |||
text: '${goods?.commission ?? '0'}', | |||
style: TextStyle( | |||
height: 1, | |||
fontSize: 11, | |||
color: HexColor.fromHex(style?.couponCommission?.commission?.commissionFontColor), | |||
), | |||
) | |||
] | |||
), | |||
), | |||
), | |||
)); | |||
); | |||
} | |||
return Container( | |||
@@ -1,69 +1,453 @@ | |||
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_header_model.dart'; | |||
class HomeGoodsStyleModel { | |||
String listColumn; | |||
List<HomeGoodsHeaderModel> recommendList; | |||
String providerNameColor; | |||
String providerNameBackgroundColor; | |||
List<String> hotRankIconList; | |||
String topMargin; | |||
String leftRighMargin; | |||
List<HomeGoodsStyleModelProviders> providers; | |||
String titleColor; | |||
String currentPriceColor; | |||
String marketPriceColor; | |||
String shopNameColor; | |||
String saleCountColor; | |||
String saleCountText; | |||
String shopIcon; | |||
String couponFontColor; | |||
String couponBgColor; | |||
String commissionFontColor; | |||
String commissionBgColor; | |||
String marketPriceColor; | |||
String currentPriceColor; | |||
HomeGoodsStyleModelCouponCommission couponCommission; | |||
HomeGoodsStyleModelHotRank hotRank; | |||
HomeGoodsStyleModel( | |||
{this.listColumn, | |||
this.recommendList, | |||
this.providerNameColor, | |||
this.providerNameBackgroundColor, | |||
this.shopNameColor, | |||
this.shopIcon, | |||
this.couponFontColor, | |||
this.couponBgColor, | |||
this.commissionFontColor, | |||
this.commissionBgColor, | |||
this.marketPriceColor, | |||
this.currentPriceColor}); | |||
HomeGoodsStyleModel({ | |||
this.listColumn, | |||
this.recommendList, | |||
this.hotRankIconList, | |||
this.topMargin, | |||
this.leftRighMargin, | |||
this.providers, | |||
this.titleColor, | |||
this.currentPriceColor, | |||
this.marketPriceColor, | |||
this.shopNameColor, | |||
this.saleCountColor, | |||
this.saleCountText, | |||
this.shopIcon, | |||
this.couponCommission, | |||
this.hotRank, | |||
}); | |||
HomeGoodsStyleModel.fromJson(Map<String, dynamic> json) { | |||
listColumn = json['list_column']; | |||
listColumn = json['list_column']?.toString(); | |||
if (json['recommend_list'] != null) { | |||
recommendList = new List<HomeGoodsHeaderModel>(); | |||
json['recommend_list'].forEach((v) { | |||
recommendList.add(new HomeGoodsHeaderModel.fromJson(v)); | |||
}); | |||
} | |||
providerNameColor = json['provider_name_color']; | |||
providerNameBackgroundColor = json['provider_name_background_color']; | |||
shopNameColor = json['shop_name_color']; | |||
shopIcon = json['shop_icon']; | |||
couponFontColor = json['coupon_font_color']; | |||
couponBgColor = json['coupon_bg_color']; | |||
commissionFontColor = json['commission_font_color']; | |||
commissionBgColor = json['commission_bg_color']; | |||
marketPriceColor = json['market_price_color']; | |||
currentPriceColor = json['current_price_color']; | |||
if(json['hot_rank_icon_list'] != null) { | |||
hotRankIconList = json['hot_rank_icon_list'].cast<String>(); | |||
} | |||
topMargin = json['top_margin']?.toString(); | |||
leftRighMargin = json['left_righ_margin']?.toString(); | |||
if (json['providers'] != null) { | |||
providers = new List<HomeGoodsStyleModelProviders>(); | |||
json['providers'].forEach((v) { | |||
providers.add(new HomeGoodsStyleModelProviders.fromJson(v)); | |||
}); | |||
} | |||
titleColor = json['title_color']?.toString(); | |||
currentPriceColor = json['current_price_color']?.toString(); | |||
marketPriceColor = json['market_price_color']?.toString(); | |||
shopNameColor = json['shop_name_color']?.toString(); | |||
saleCountColor = json['sale_count_color']?.toString(); | |||
saleCountText = json['sale_count_text']?.toString(); | |||
shopIcon = json['shop_icon']?.toString(); | |||
couponCommission = json['coupon_commission'] != null ? new HomeGoodsStyleModelCouponCommission.fromJson(json['coupon_commission']) : null; | |||
hotRank = json['hot_rank'] != null ? new HomeGoodsStyleModelHotRank.fromJson(json['hot_rank']) : null; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['list_column'] = this.listColumn; | |||
if (this.recommendList != null) { | |||
data['recommend_list'] = | |||
this.recommendList.map((v) => v.toJson()).toList(); | |||
data['recommend_list'] = this.recommendList.map((v) => v.toJson()).toList(); | |||
} | |||
data['provider_name_color'] = this.providerNameColor; | |||
data['provider_name_background_color'] = this.providerNameBackgroundColor; | |||
data['hot_rank_icon_list'] = this.hotRankIconList; | |||
data['top_margin'] = this.topMargin; | |||
data['left_righ_margin'] = this.leftRighMargin; | |||
if (this.providers != null) { | |||
data['providers'] = this.providers.map((v) => v.toJson()).toList(); | |||
} | |||
data['title_color'] = this.titleColor; | |||
data['current_price_color'] = this.currentPriceColor; | |||
data['market_price_color'] = this.marketPriceColor; | |||
data['shop_name_color'] = this.shopNameColor; | |||
data['sale_count_color'] = this.saleCountColor; | |||
data['sale_count_text'] = this.saleCountText; | |||
data['shop_icon'] = this.shopIcon; | |||
if (this.couponCommission != null) { | |||
data['coupon_commission'] = this.couponCommission.toJson(); | |||
} | |||
if (this.hotRank != null) { | |||
data['hot_rank'] = this.hotRank.toJson(); | |||
} | |||
return data; | |||
} | |||
} | |||
class HomeGoodsStyleModelProviders { | |||
String type; | |||
String providerNameColor; | |||
String providerBgColor; | |||
HomeGoodsStyleModelProviders({this.type, this.providerNameColor, this.providerBgColor}); | |||
HomeGoodsStyleModelProviders.fromJson(Map<String, dynamic> json) { | |||
type = json['type']?.toString(); | |||
providerNameColor = json['provider_name_color']?.toString(); | |||
providerBgColor = json['provider_bg_color']?.toString(); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['type'] = this.type; | |||
data['provider_name_color'] = this.providerNameColor; | |||
data['provider_bg_color'] = this.providerBgColor; | |||
return data; | |||
} | |||
} | |||
class HomeGoodsStyleModelCouponCommission { | |||
HomeGoodsStyleModelCoupon coupon; | |||
HomeGoodsStyleModelCommission commission; | |||
HomeGoodsStyleModelCouponCommission({this.coupon, this.commission}); | |||
HomeGoodsStyleModelCouponCommission.fromJson(Map<String, dynamic> json) { | |||
coupon = json['left'] != null ? new HomeGoodsStyleModelCoupon.fromJson(json['left']) : null; | |||
commission = json['right'] != null ? new HomeGoodsStyleModelCommission.fromJson(json['right']) : null; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
if (this.coupon != null) { | |||
data['left'] = this.coupon.toJson(); | |||
} | |||
if (this.commission != null) { | |||
data['right'] = this.commission.toJson(); | |||
} | |||
return data; | |||
} | |||
} | |||
class HomeGoodsStyleModelCoupon { | |||
String couonText; | |||
String couponFontColor; | |||
String couponBgColor; | |||
String couponBgImg; | |||
String isImg; | |||
HomeGoodsStyleModelCoupon({this.couonText, this.couponFontColor, this.couponBgColor, this.couponBgImg, this.isImg}); | |||
HomeGoodsStyleModelCoupon.fromJson(Map<String, dynamic> json) { | |||
couonText = json['couon_text']?.toString(); | |||
couponFontColor = json['coupon_font_color']?.toString(); | |||
couponBgColor = json['coupon_bg_color']?.toString(); | |||
couponBgImg = json['coupon_bg_img']?.toString(); | |||
isImg = json['is_img']?.toString(); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['couon_text'] = this.couonText; | |||
data['coupon_font_color'] = this.couponFontColor; | |||
data['coupon_bg_color'] = this.couponBgColor; | |||
data['coupon_bg_img'] = this.couponBgImg; | |||
data['is_img'] = this.isImg; | |||
return data; | |||
} | |||
} | |||
class HomeGoodsStyleModelCommission { | |||
String commissionText; | |||
String commissionFontColor; | |||
String commissionBgColor; | |||
String commissionBgImg; | |||
String isImg; | |||
HomeGoodsStyleModelCommission({this.commissionText, this.commissionFontColor, this.commissionBgColor, this.commissionBgImg, this.isImg}); | |||
HomeGoodsStyleModelCommission.fromJson(Map<String, dynamic> json) { | |||
commissionText = json['commission_text']?.toString(); | |||
commissionFontColor = json['commission_font_color']?.toString(); | |||
commissionBgColor = json['commission_bg_color']?.toString(); | |||
commissionBgImg = json['commission_bg_img']?.toString(); | |||
isImg = json['is_img']?.toString(); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['commission_text'] = this.commissionText; | |||
data['commission_font_color'] = this.commissionFontColor; | |||
data['commission_bg_color'] = this.commissionBgColor; | |||
data['market_price_color'] = this.marketPriceColor; | |||
data['current_price_color'] = this.currentPriceColor; | |||
data['commission_bg_img'] = this.commissionBgImg; | |||
data['is_img'] = this.isImg; | |||
return data; | |||
} | |||
} | |||
class HomeGoodsStyleModelHotRank { | |||
String isOpen; | |||
String bgColor; | |||
String fontColor; | |||
String hotSaleImg; | |||
String buyNowImg; | |||
HomeGoodsStyleModelHotRank({this.isOpen, this.bgColor, this.fontColor, this.hotSaleImg, this.buyNowImg}); | |||
HomeGoodsStyleModelHotRank.fromJson(Map<String, dynamic> json) { | |||
isOpen = json['is_open']?.toString(); | |||
bgColor = json['bg_color']?.toString(); | |||
fontColor = json['font_color']?.toString(); | |||
hotSaleImg = json['hot_sale_img']?.toString(); | |||
buyNowImg = json['buy_now_img']?.toString(); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['is_open'] = this.isOpen; | |||
data['bg_color'] = this.bgColor; | |||
data['font_color'] = this.fontColor; | |||
data['hot_sale_img'] = this.hotSaleImg; | |||
data['buy_now_img'] = this.buyNowImg; | |||
return data; | |||
} | |||
} | |||
} | |||
// class HomeGoodsStyleModel { | |||
// String listColumn; | |||
// List<HomeGoodsHeaderModel> recommendList; | |||
// String providerNameColor; | |||
// String providerNameBackgroundColor; | |||
// String shopNameColor; | |||
// String shopIcon; | |||
// String couponFontColor; | |||
// String couponBgColor; | |||
// String commissionFontColor; | |||
// String commissionBgColor; | |||
// String marketPriceColor; | |||
// String currentPriceColor; | |||
// | |||
// /// 2020-10-12日 新加 | |||
// String title_color; | |||
// String sale_count_color; | |||
// String sale_count_text; | |||
// String top_margin; | |||
// String left_righ_margin; | |||
// | |||
// HomeGoodsStyleModel({ | |||
// this.listColumn, | |||
// this.recommendList, | |||
// this.providerNameColor, | |||
// this.providerNameBackgroundColor, | |||
// this.shopNameColor, | |||
// this.shopIcon, | |||
// this.couponFontColor, | |||
// this.couponBgColor, | |||
// this.commissionFontColor, | |||
// this.commissionBgColor, | |||
// this.marketPriceColor, | |||
// this.currentPriceColor, | |||
// }); | |||
// | |||
// HomeGoodsStyleModel.fromJson(Map<String, dynamic> json) { | |||
// listColumn = json['list_column']?.toString(); | |||
// if (json['recommend_list'] != null) { | |||
// recommendList = new List<HomeGoodsHeaderModel>(); | |||
// json['recommend_list'].forEach((v) { | |||
// recommendList.add(new HomeGoodsHeaderModel.fromJson(v)); | |||
// }); | |||
// } | |||
// providerNameColor = json['provider_name_color']?.toString(); | |||
// providerNameBackgroundColor = json['provider_name_background_color']?.toString(); | |||
// shopNameColor = json['shop_name_color']?.toString(); | |||
// shopIcon = json['shop_icon']?.toString(); | |||
// couponFontColor = json['coupon_font_color']?.toString(); | |||
// couponBgColor = json['coupon_bg_color']?.toString(); | |||
// commissionFontColor = json['commission_font_color']?.toString(); | |||
// commissionBgColor = json['commission_bg_color']?.toString(); | |||
// marketPriceColor = json['market_price_color']?.toString(); | |||
// currentPriceColor = json['current_price_color']?.toString(); | |||
// } | |||
// | |||
// Map<String, dynamic> toJson() { | |||
// final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
// data['list_column'] = this.listColumn; | |||
// if (this.recommendList != null) { | |||
// data['recommend_list'] = this.recommendList.map((v) => v.toJson()).toList(); | |||
// } | |||
// data['provider_name_color'] = this.providerNameColor; | |||
// data['provider_name_background_color'] = this.providerNameBackgroundColor; | |||
// data['shop_name_color'] = this.shopNameColor; | |||
// data['shop_icon'] = this.shopIcon; | |||
// data['coupon_font_color'] = this.couponFontColor; | |||
// data['coupon_bg_color'] = this.couponBgColor; | |||
// data['commission_font_color'] = this.commissionFontColor; | |||
// data['commission_bg_color'] = this.commissionBgColor; | |||
// data['market_price_color'] = this.marketPriceColor; | |||
// data['current_price_color'] = this.currentPriceColor; | |||
// return data; | |||
// } | |||
// } | |||
// | |||
// class HomeGoodsStyleProvidersModel { | |||
// String type; | |||
// String provider_name_color; | |||
// String provider_bg_color; | |||
// | |||
// HomeGoodsStyleProvidersModel({ | |||
// this.type, | |||
// this.provider_name_color, | |||
// this.provider_bg_color, | |||
// }); | |||
// | |||
// factory HomeGoodsStyleProvidersModel.fromJson(Map<String, dynamic> json) { | |||
// return HomeGoodsStyleProvidersModel( | |||
// type: json['type']?.toString(), | |||
// provider_name_color: json['provider_name_color']?.toString(), | |||
// provider_bg_color: json['provider_bg_color']?.toString(), | |||
// ); | |||
// } | |||
// | |||
// Map<String, dynamic> toJson() { | |||
// final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
// data['type'] = this.type; | |||
// data['provider_name_color'] = this.provider_name_color; | |||
// data['provider_bg_color'] = this.provider_bg_color; | |||
// return data; | |||
// } | |||
// } | |||
// | |||
// class HomeGoodsStyleCouponCommissionModel { | |||
// HomeGoodsStyleCouonModel couonModel; | |||
// HomeGoodsStyleCommissionModel commissionModel; | |||
// | |||
// HomeGoodsStyleCouponCommissionModel({ | |||
// this.couonModel, | |||
// this.commissionModel, | |||
// }); | |||
// | |||
// factory HomeGoodsStyleCouponCommissionModel.fromJson(Map<String, dynamic> json) { | |||
// return HomeGoodsStyleCouponCommissionModel( | |||
// couonModel: json.containsKey('left') ? HomeGoodsStyleCouonModel.fromJson(json['left']) : null, | |||
// commissionModel: json.containsKey('right') ? HomeGoodsStyleCommissionModel.fromJson(json['left']) : null, | |||
// ); | |||
// } | |||
// } | |||
// | |||
// class HomeGoodsStyleCouonModel { | |||
// String couon_text; | |||
// String coupon_font_color; | |||
// String coupon_bg_color; | |||
// String coupon_bg_img; | |||
// String is_img; | |||
// | |||
// HomeGoodsStyleCouonModel({ | |||
// this.couon_text, | |||
// this.coupon_font_color, | |||
// this.coupon_bg_color, | |||
// this.coupon_bg_img, | |||
// this.is_img, | |||
// }); | |||
// | |||
// factory HomeGoodsStyleCouonModel.fromJson(Map<String, dynamic> json) { | |||
// return HomeGoodsStyleCouonModel( | |||
// couon_text: json['couon_text']?.toString(), | |||
// coupon_font_color: json['coupon_font_color']?.toString(), | |||
// coupon_bg_color: json['coupon_bg_color']?.toString(), | |||
// coupon_bg_img: json['coupon_bg_img']?.toString(), | |||
// is_img: json['is_img']?.toString(), | |||
// ); | |||
// } | |||
// | |||
// Map<String, dynamic> toJson() { | |||
// final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
// data['couon_text'] = this.couon_text; | |||
// data['coupon_font_color'] = this.coupon_font_color; | |||
// data['coupon_bg_color'] = this.coupon_bg_color; | |||
// data['coupon_bg_img'] = this.coupon_bg_img; | |||
// data['is_img'] = this.is_img; | |||
// return data; | |||
// } | |||
// } | |||
// | |||
// class HomeGoodsStyleCommissionModel { | |||
// String commission_text; | |||
// String commission_font_color; | |||
// String commission_bg_color; | |||
// String commission_bg_img; | |||
// String is_img; | |||
// | |||
// HomeGoodsStyleCommissionModel({ | |||
// this.commission_text, | |||
// this.commission_font_color, | |||
// this.commission_bg_color, | |||
// this.commission_bg_img, | |||
// this.is_img, | |||
// }); | |||
// | |||
// factory HomeGoodsStyleCommissionModel.fromJson(Map<String, dynamic> json) { | |||
// return HomeGoodsStyleCommissionModel( | |||
// commission_text: json['commission_text']?.toString(), | |||
// commission_font_color: json['commission_font_color']?.toString(), | |||
// commission_bg_color: json['commission_bg_color']?.toString(), | |||
// commission_bg_img: json['commission_bg_img']?.toString(), | |||
// is_img: json['is_img']?.toString(), | |||
// ); | |||
// } | |||
// | |||
// Map<String, dynamic> toJson() { | |||
// final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
// data['commission_text'] = this.commission_text; | |||
// data['commission_font_color'] = this.commission_font_color; | |||
// data['commission_bg_color'] = this.commission_bg_color; | |||
// data['commission_bg_img'] = this.commission_bg_img; | |||
// data['is_img'] = this.is_img; | |||
// return data; | |||
// } | |||
// } | |||
// | |||
// class HomeGoodsStyleHotRankModel { | |||
// String is_open; | |||
// String bg_color; | |||
// String font_color; | |||
// String hot_sale_img; | |||
// String buy_now_img; | |||
// | |||
// HomeGoodsStyleHotRankModel({ | |||
// this.is_open, | |||
// this.bg_color, | |||
// this.font_color, | |||
// this.hot_sale_img, | |||
// this.buy_now_img, | |||
// }); | |||
// | |||
// factory HomeGoodsStyleHotRankModel.fromJson(Map<String, dynamic> json) { | |||
// return HomeGoodsStyleHotRankModel( | |||
// is_open: json['is_open']?.toString(), | |||
// bg_color: json['bg_color']?.toString(), | |||
// font_color: json['font_color']?.toString(), | |||
// hot_sale_img: json['hot_sale_img']?.toString(), | |||
// buy_now_img: json['buy_now_img']?.toString(), | |||
// ); | |||
// } | |||
// | |||
// Map<String, dynamic> toJson() { | |||
// final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
// data['is_open'] = this.is_open; | |||
// data['bg_color'] = this.bg_color; | |||
// data['font_color'] = this.font_color; | |||
// data['hot_sale_img'] = this.hot_sale_img; | |||
// data['buy_now_img'] = this.buy_now_img; | |||
// return data; | |||
// } | |||
// } |
@@ -188,12 +188,14 @@ class _SearchInputWidgetState extends State<SearchInputWidget> { | |||
controller: _editingController, | |||
focusNode: _focusNode, | |||
cursorColor: Colors.transparent, | |||
style: TextStyle(fontSize: 14, color: HexColor.fromHex('#333333')), | |||
style: TextStyle(fontSize: 14, color: HexColor.fromHex('#333333'), textBaseline: TextBaseline.alphabetic), | |||
decoration: InputDecoration( | |||
filled: false, | |||
contentPadding: const EdgeInsets.only(left: 0, right: 0, bottom: 12, top: 0), | |||
filled: true, | |||
isDense: true, | |||
contentPadding: EdgeInsets.zero, | |||
// contentPadding: const EdgeInsets.only(left: 0, right: 0, bottom: 12, top: 0), | |||
// focusColor: Colors.transparent, | |||
// fillColor: Colors.transparent, | |||
fillColor: Colors.transparent, | |||
border: InputBorder.none, | |||
focusedBorder: InputBorder.none, | |||
focusedErrorBorder: InputBorder.none, | |||
@@ -201,7 +203,7 @@ class _SearchInputWidgetState extends State<SearchInputWidget> { | |||
disabledBorder: InputBorder.none, | |||
enabledBorder: InputBorder.none, | |||
hintText: model?.search_inpu_hint_text ?? '搜索更多优惠商品', | |||
hintStyle: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 14), | |||
hintStyle: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 14, textBaseline: TextBaseline.alphabetic), | |||
), | |||
), | |||
); | |||
@@ -4,33 +4,37 @@ import 'package:zhiying_comm/zhiying_comm.dart'; | |||
/// | |||
/// 我的团队 - 数据widget | |||
/// | |||
class TeamDataWidget extends StatefulWidget { | |||
@override | |||
_TeamDataWidgetState createState() => _TeamDataWidgetState(); | |||
} | |||
class _TeamDataWidgetState extends State<TeamDataWidget> { | |||
class TeamDataWidget extends StatelessWidget { | |||
@override | |||
Widget build(BuildContext context) { | |||
return _getMainWidget(); | |||
return Material( | |||
child: _getMainWidget(), | |||
); | |||
} | |||
/// 主视图 | |||
Widget _getMainWidget() { | |||
return Container( | |||
width: double.infinity, | |||
margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8), | |||
padding: const EdgeInsets.only(left: 10.5, right: 9.5), | |||
padding: const EdgeInsets.only(left: 10.5, right: 9.5, top: 8, bottom: 8), | |||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor.fromHex('#FFFFFF')), | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
children: <Widget>[ | |||
/// 直推人数 & 间推人数 | |||
Row( | |||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |||
crossAxisAlignment: CrossAxisAlignment.end, | |||
children: <Widget>[ | |||
/// 直推人数 | |||
_getCustomWidget(text: '直推人数', textColor: '#999999', textSize: 12, number: '2258', numberColor: '#333333', numberSize: 30, icon: 'sss'), | |||
/// 分割线 | |||
VerticalDivider(width: 40, thickness: 0.5, color: HexColor.fromHex('#F0F0F0')), | |||
// VerticalDivider(width: 0.5, thickness: 40, color: HexColor.fromHex('#F0F0F0')), | |||
SizedBox(height: 40, child: VerticalDivider(thickness: 0.5, color: HexColor.fromHex('#F0F0F0'), width: 0.5, )), | |||
/// 间推人数 | |||
_getCustomWidget(text: '间推人数', textColor: '#999999', textSize: 12, number: '469', numberColor: '#333333', numberSize: 30, icon: 'sss'), | |||
@@ -38,10 +42,11 @@ class _TeamDataWidgetState extends State<TeamDataWidget> { | |||
), | |||
/// 分割线 | |||
Divider(thickness: 0.5, height: double.infinity, color: HexColor.fromHex('#F0F0F0')), | |||
Divider(thickness: 0.5, height: 20, color: HexColor.fromHex('#F0F0F0')), | |||
/// 全部粉丝 & 今日新增 & 昨日新增 | |||
Row( | |||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |||
children: <Widget>[ | |||
/// 全部粉丝 | |||
_getCustomWidget( | |||
@@ -54,7 +59,8 @@ class _TeamDataWidgetState extends State<TeamDataWidget> { | |||
), | |||
/// 分割线 | |||
VerticalDivider(thickness: 0.5, width: 35, color: HexColor.fromHex('#F0F0F0')), | |||
// VerticalDivider(thickness: 0.5, width: 1, color: HexColor.fromHex('#F0F0F0')), | |||
SizedBox(height: 35, child: VerticalDivider(thickness: 0.5, color: HexColor.fromHex('#F0F0F0'), width: 0.5, )), | |||
/// 今日新增 | |||
_getCustomWidget( | |||
@@ -67,7 +73,8 @@ class _TeamDataWidgetState extends State<TeamDataWidget> { | |||
), | |||
/// 分割线 | |||
VerticalDivider(thickness: 0.5, width: 35, color: HexColor.fromHex('#F0F0F0')), | |||
// VerticalDivider(thickness: 0.5, width: 1, color: HexColor.fromHex('#F0F0F0')), | |||
SizedBox(height: 35, child: VerticalDivider(thickness: 0.5, color: HexColor.fromHex('#F0F0F0'), width: 0.5, )), | |||
/// 昨日新增 | |||
_getCustomWidget( | |||
@@ -88,9 +95,13 @@ class _TeamDataWidgetState extends State<TeamDataWidget> { | |||
/// 自定义Widget | |||
Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) { | |||
return Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
children: <Widget>[ | |||
/// Number | |||
Row( | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
children: <Widget>[ | |||
/// nummber\ | |||
Text(number, | |||
@@ -108,3 +119,4 @@ class _TeamDataWidgetState extends State<TeamDataWidget> { | |||
); | |||
} | |||
} | |||
@@ -0,0 +1,65 @@ | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:flutter/material.dart'; | |||
class TeamDetailsMonthDataWidget extends StatelessWidget { | |||
@override | |||
Widget build(BuildContext context) { | |||
return Container(); | |||
} | |||
/// content | |||
Widget _getContentWidget() { | |||
return Container( | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex('#FFFFFF'), | |||
borderRadius: BorderRadius.circular(10), | |||
), | |||
padding: const EdgeInsets.only(top: 31, bottom: 10), | |||
child: Row( | |||
children: <Widget>[ | |||
/// 今日贡献 | |||
_getLeftValueWidget(), | |||
/// 分割线 | |||
VerticalDivider(width: 19, thickness: 0.5, color: HexColor.fromHex('#D8D8D8')), | |||
/// 贡献收入 | |||
_getRightValueWidget(), | |||
], | |||
), | |||
); | |||
} | |||
/// 左边 | |||
Widget _getLeftValueWidget() { | |||
return _getCustomWidget(text: '自购订单(个)', textColor: '#999999', textSize: 11, number: '158.58', numberColor: '#333333', numberSize: 17, icon: 'sss'); | |||
} | |||
/// 右边 | |||
Widget _getRightValueWidget() { | |||
return _getCustomWidget(text: '预估收益(元)', textColor: '#999999', textSize: 11, number: '158.58', numberColor: '#333333', numberSize: 17, icon: 'sss'); | |||
} | |||
/// 自定义Widget | |||
Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) { | |||
return Column( | |||
children: <Widget>[ | |||
/// number | |||
Text(number, style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold)), | |||
/// text | |||
Row( | |||
children: <Widget>[ | |||
Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize)), | |||
/// icon | |||
Visibility(visible: !EmptyUtil.isEmpty(icon), child: Container(width: 11, height: 11, color: Colors.red)) | |||
], | |||
) | |||
], | |||
); | |||
} | |||
} |
@@ -12,35 +12,208 @@ class TeamFansItem extends StatefulWidget { | |||
class _TeamFansItemState extends State<TeamFansItem> { | |||
@override | |||
Widget build(BuildContext context) { | |||
return Container(); | |||
return _getMainWidget(); | |||
} | |||
/// 主体视图 | |||
Widget _getMainWidget() { | |||
return Container( | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex('#FFFFFF'), | |||
borderRadius: BorderRadius.circular(10) | |||
), | |||
decoration: BoxDecoration(color: HexColor.fromHex('#FFFFFF'), borderRadius: BorderRadius.circular(10)), | |||
margin: const EdgeInsets.only(left: 12.5, right: 12.5), | |||
padding: const EdgeInsets.only(left: 20, right: 20, top: 17.5, bottom: 15), | |||
child: Column( | |||
children: <Widget>[ | |||
// 粉丝头像信息等 | |||
_getFansInfoWidget(), | |||
// 微信号码 | |||
_getWXNumberInfoWidget(), | |||
// 数据信息 | |||
_getDataWidget(), | |||
], | |||
), | |||
); | |||
} | |||
/// 粉丝头像信息等 | |||
Widget _getFansInfoWidget() { | |||
return Row( | |||
children: <Widget>[ | |||
/// 头像 | |||
Container(width: 50, height: 50, color: Colors.red), | |||
const SizedBox(width: 10), | |||
/// 信息 | |||
Column( | |||
children: <Widget>[ | |||
/// 会员等级 关系 昵称 | |||
RichText( | |||
text: TextSpan(text: '', children: [ | |||
/// 等级 | |||
WidgetSpan(child: Container(width: 37, height: 13, color: Colors.red)), | |||
/// 会员关系 | |||
WidgetSpan(child: Container(width: 13, height: 13, color: Colors.red, margin: const EdgeInsets.only(left: 3, right: 3))), | |||
/// 会员名称 | |||
TextSpan(text: '温***哥', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 12, fontWeight: FontWeight.bold)) | |||
]), | |||
), | |||
/// 手机号码 | |||
RichText( | |||
text: TextSpan(text: '', children: [ | |||
/// 手机号码 | |||
TextSpan(text: '手机号:', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 11)), | |||
TextSpan(text: '124****6124', style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
/// 复制按钮 | |||
WidgetSpan(child: Container(width: 11, height: 11, color: Colors.red, margin: const EdgeInsets.only(left: 3))) | |||
]), | |||
), | |||
], | |||
) | |||
], | |||
); | |||
} | |||
/// 微信号码信息 | |||
Widget _getWXNumberInfoWidget() { | |||
return Container( | |||
padding: const EdgeInsets.only(left: 9, right: 10, bottom: 6.5, top: 6.5), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex('#F7F7F7'), | |||
borderRadius: BorderRadius.circular(10), | |||
), | |||
child: Row( | |||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||
children: <Widget>[ | |||
/// 微信号码 | |||
RichText( | |||
text: TextSpan(text: '微信号:', style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 11, fontWeight: FontWeight.bold), children: [ | |||
TextSpan( | |||
text: '54A78', | |||
style: TextStyle(fontWeight: FontWeight.bold, color: HexColor.fromHex('#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
WidgetSpan(child: Container(margin: const EdgeInsets.only(left: 5.5), color: Colors.red, width: 11, height: 11)) | |||
]), | |||
), | |||
/// 最近登陆时间 | |||
Text('最近登陆 2019-06-28', style: TextStyle(color: HexColor.fromHex('#909090'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')) | |||
], | |||
), | |||
); | |||
} | |||
/// 数据信息 | |||
Widget _getDataWidget() { | |||
return Row( | |||
children: <Widget>[ | |||
/// 左边数据 | |||
Column( | |||
children: <Widget>[ | |||
/// 邀请人数(人) | |||
_getCustomWidget( | |||
text: '邀请人数(人)', | |||
textColor: '#333333', | |||
textSize: 10, | |||
number: '1578', | |||
numberColor: '#FF4242', | |||
numberSize: 20, | |||
), | |||
/// 今日邀请 & 本月邀请 | |||
Row( | |||
children: <Widget>[ | |||
/// 今日邀请 | |||
_getCustomWidget( | |||
text: '今日邀请', | |||
textColor: '#909090', | |||
textSize: 10, | |||
number: '3258', | |||
numberColor: '#333333', | |||
numberSize: 15, | |||
), | |||
/// 本月邀请 | |||
_getCustomWidget( | |||
text: '本月邀请', | |||
textColor: '#909090', | |||
textSize: 10, | |||
number: '3258', | |||
numberColor: '#333333', | |||
numberSize: 15, | |||
), | |||
], | |||
) | |||
], | |||
), | |||
/// 分割线 | |||
VerticalDivider(width: 65.5, thickness: 0.5), | |||
/// 右边数据 | |||
Column( | |||
children: <Widget>[ | |||
/// 累计收益(¥) | |||
_getCustomWidget( | |||
text: '累计收益(¥)', | |||
textColor: '#333333', | |||
textSize: 10, | |||
number: '157.54', | |||
numberColor: '#FF4242', | |||
numberSize: 20, | |||
), | |||
/// 近7天收益 & 本月收益 | |||
Row( | |||
children: <Widget>[ | |||
/// 今日邀请 | |||
_getCustomWidget( | |||
text: '近7天收益', | |||
textColor: '#909090', | |||
textSize: 10, | |||
number: '4.12', | |||
numberColor: '#333333', | |||
numberSize: 15, | |||
), | |||
/// 本月邀请 | |||
_getCustomWidget( | |||
text: '本月收益', | |||
textColor: '#909090', | |||
textSize: 10, | |||
number: '528.14', | |||
numberColor: '#333333', | |||
numberSize: 15, | |||
), | |||
], | |||
) | |||
], | |||
) | |||
], | |||
); | |||
} | |||
/// 自定义Widget(数字加粗) | |||
Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) { | |||
return Column( | |||
children: <Widget>[ | |||
/// Number | |||
Row( | |||
children: <Widget>[ | |||
/// nummber\ | |||
Text(number, | |||
style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
const SizedBox(width: 3), | |||
/// icon | |||
Visibility(visible: !EmptyUtil.isEmpty(icon), child: Container(height: 7, width: 5, color: Colors.red)) | |||
], | |||
), | |||
/// Text | |||
Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize)) | |||
], | |||
); | |||
} | |||
} |
@@ -5,9 +5,9 @@ import 'package:zhiying_comm/zhiying_comm.dart'; | |||
/// 我的团队 - 我的推荐人 | |||
/// | |||
class TeamRecommendWidget extends StatefulWidget { | |||
final Map<String, dynamic> data; | |||
const TeamRecommendWidget(this.data); | |||
// final Map<String, dynamic> data; | |||
// | |||
// const TeamRecommendWidget(this.data); | |||
@override | |||
_TeamRecommendWidgetState createState() => _TeamRecommendWidgetState(); | |||
@@ -16,7 +16,10 @@ class TeamRecommendWidget extends StatefulWidget { | |||
class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
@override | |||
Widget build(BuildContext context) { | |||
return Container(); | |||
return Container( | |||
margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 10.5), | |||
child: _getMainWidget(), | |||
); | |||
} | |||
/// 按钮点击事件 | |||
@@ -25,12 +28,21 @@ class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
/// 主体Widget | |||
Widget _getMainWidget() { | |||
return Container( | |||
padding: const EdgeInsets.only(left: 10, bottom: 12, right: 10), | |||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white), | |||
child: Column( | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
/// 左上角的Icon | |||
_getLeftTopWidget(), | |||
const SizedBox(height: 6), | |||
/// 数据视图 | |||
Visibility( | |||
visible: true, | |||
replacement: _getInputCombWidget(), | |||
child: Padding(padding: const EdgeInsets.only(left: 10), child: _getDataWidget())), | |||
], | |||
), | |||
); | |||
@@ -38,38 +50,36 @@ class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
/// 我的推荐人IconWidget(左上角的ICON) | |||
Widget _getLeftTopWidget() { | |||
return Container(width: 73.5, height: 23.5, color: Colors.red); | |||
return Transform.translate(offset: Offset(0, -4.5), child: Container(width: 80, height: 28, color: Colors.red)); | |||
} | |||
/// 输入框 | |||
Widget _getInputWidget() { | |||
/// 没邀请人的Widget | |||
Widget _getInputCombWidget() { | |||
return Container( | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(30), | |||
color: HexColor.fromHex('#F7F7F7'), | |||
), | |||
margin: const EdgeInsets.only(left: 2.5, right: 2.5), | |||
width: double.infinity, | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
// crossAxisAlignment: CrossAxisAlignment.center, | |||
children: <Widget>[ | |||
/// 输入框 | |||
Row( | |||
children: <Widget>[ | |||
/// 输入框 | |||
Expanded( | |||
child: TextField( | |||
decoration: InputDecoration( | |||
border: InputBorder.none, | |||
focusedBorder: InputBorder.none, | |||
focusedErrorBorder: InputBorder.none, | |||
errorBorder: InputBorder.none, | |||
disabledBorder: InputBorder.none, | |||
enabledBorder: InputBorder.none, | |||
filled: true, | |||
fillColor: Colors.transparent), | |||
Container( | |||
height: 30, | |||
width: double.infinity, | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(30), | |||
color: HexColor.fromHex('#F7F7F7'), | |||
), | |||
padding: const EdgeInsets.only(top: 3.5, bottom: 3.5, right: 3, left: 13), | |||
child: Row( | |||
children: <Widget>[ | |||
Expanded( | |||
child: _getInputWidget(), | |||
), | |||
), | |||
/// 按钮 | |||
_getAddButtomWidget(), | |||
], | |||
/// 添加的按钮 | |||
_getAddButtomWidget(), | |||
], | |||
), | |||
), | |||
const SizedBox(height: 10.5), | |||
@@ -81,22 +91,60 @@ class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
); | |||
} | |||
/// 输入框的 | |||
Widget _getInputWidget(){ | |||
return TextField( | |||
style:TextStyle(color: HexColor.fromHex('#000000'), fontSize: 12, textBaseline: TextBaseline.alphabetic), | |||
decoration: InputDecoration( | |||
border: InputBorder.none, | |||
enabledBorder: InputBorder.none, | |||
disabledBorder: InputBorder.none, | |||
errorBorder: InputBorder.none, | |||
focusedErrorBorder: InputBorder.none, | |||
focusedBorder: InputBorder.none, | |||
hintText: '输入邀请人ID', | |||
isDense: true, | |||
filled: true, | |||
fillColor: Colors.transparent, | |||
contentPadding: EdgeInsets.zero, | |||
hintStyle: TextStyle(color: HexColor.fromHex('#909090'), fontSize: 12, textBaseline: TextBaseline.alphabetic), | |||
), | |||
); | |||
} | |||
/// 添加的按钮 | |||
Widget _getAddButtomWidget() { | |||
// return Material( | |||
// child: Container( | |||
// height: 24, | |||
// color: Colors.white, | |||
// child: RaisedButton( | |||
// padding: EdgeInsets.zero, | |||
// child: Text('添加', style: TextStyle(fontSize: 13)), | |||
// textColor: HexColor.fromHex('#FFFFFF'), | |||
// color: HexColor.fromHex('#F94B47'), | |||
// disabledColor: HexColor.fromHex('#F94B47'), | |||
// disabledTextColor: HexColor.fromHex('#FFFFFF'), | |||
// elevation: 5, | |||
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24 / 2)), | |||
// onPressed: () => _onClickListener(), | |||
// ), | |||
// ), | |||
// ); | |||
return Material( | |||
child: Container( | |||
height: 24, | |||
width: double.infinity, | |||
color: Colors.white, | |||
child: RaisedButton( | |||
child: Text('添加', style: TextStyle(fontSize: 13)), | |||
textColor: HexColor.fromHex('#FFFFFF'), | |||
color: HexColor.fromHex('#F94B47'), | |||
disabledColor: HexColor.fromHex('#F94B47'), | |||
disabledTextColor: HexColor.fromHex('#FFFFFF'), | |||
elevation: 5, | |||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24 / 2)), | |||
onPressed: () => _onClickListener(), | |||
child: InkWell( | |||
onTap: (){}, | |||
child: Container( | |||
padding: const EdgeInsets.only(left: 21, right: 21, top: 2.5, bottom: 2.5), | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(30), | |||
color: HexColor.fromHex('#F94B47') | |||
), | |||
child: Text('添加', style: TextStyle(fontSize: 13, color: HexColor.fromHex('#FFFFFF'))), | |||
), | |||
), | |||
); | |||
@@ -105,6 +153,7 @@ class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
/// 数据视图 | |||
Widget _getDataWidget() { | |||
return Row( | |||
mainAxisAlignment: MainAxisAlignment.start, | |||
children: <Widget>[ | |||
/// 头像widget | |||
_getAvatarWidget(), | |||
@@ -128,29 +177,45 @@ class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
/// 数据右边视图,头像右边的widget | |||
Widget _getDataRightWidget() { | |||
return Column( | |||
children: <Widget>[ | |||
/// 昵称 | |||
_getNickNameWidget(), | |||
return SizedBox( | |||
height: 55, | |||
child: Column( | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||
children: <Widget>[ | |||
/// 昵称 | |||
_getNickNameWidget(), | |||
/// 手机号 | |||
_getPhoneNumberWidget(), | |||
/// 手机号 | |||
_getPhoneNumberWidget(), | |||
/// 微信号 | |||
_getWXWidget() | |||
], | |||
/// 微信号 | |||
_getWXWidget() | |||
], | |||
), | |||
); | |||
} | |||
/// 昵称 | |||
Widget _getNickNameWidget() { | |||
// return RichText( | |||
// text: TextSpan(text: '毛毛虫', style: TextStyle(fontSize: 14, color: HexColor.fromHex('#000000'), fontWeight: FontWeight.bold), | |||
// children: [ | |||
// TextSpan(text: '邀请码:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'), fontWeight: FontWeight.w400)), | |||
// TextSpan(text: '123456', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'), fontWeight: FontWeight.w400)), | |||
// ] | |||
// ), | |||
// ); | |||
return Row( | |||
mainAxisAlignment: MainAxisAlignment.start, | |||
crossAxisAlignment: CrossAxisAlignment.center, | |||
children: <Widget>[ | |||
/// 昵称 | |||
Text('毛毛虫', style: TextStyle(fontSize: 14, color: HexColor.fromHex('#000000'), fontWeight: FontWeight.bold)), | |||
const SizedBox(width: 6), | |||
Text('邀请码:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'))), | |||
Text('123456', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'))), | |||
Text('123456', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'), fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
], | |||
); | |||
} | |||
@@ -160,7 +225,7 @@ class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
return Row( | |||
children: <Widget>[ | |||
Text('手机号:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), | |||
Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), | |||
Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'), fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
const SizedBox(width: 6), | |||
/// 拷贝按钮 | |||
@@ -174,7 +239,7 @@ class _TeamRecommendWidgetState extends State<TeamRecommendWidget> { | |||
return Row( | |||
children: <Widget>[ | |||
Text('微信号:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), | |||
Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), | |||
Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'), fontFamily: 'Din', package: 'zhiying_base_widget')), | |||
const SizedBox(width: 6), | |||
/// 拷贝按钮 | |||