@@ -1,15 +1,14 @@ | |||
import 'dart:convert'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:provider/provider.dart'; | |||
import 'package:pull_to_refresh/pull_to_refresh.dart'; | |||
import 'package:zhiying_base_widget/pages/hot_ranking_page/hot_ranking_page_sk.dart'; | |||
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart'; | |||
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart'; | |||
import 'package:zhiying_base_widget/utils/contants.dart'; | |||
import 'package:zhiying_comm/util/base_bloc.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:provider/provider.dart'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'hot_ranking_page_bloc.dart'; | |||
@@ -87,7 +86,7 @@ class __HotRankingPageContainerState extends State<_HotRankingPageContainer> { | |||
} | |||
for (var item in model) { | |||
WidgetModel widgetModel = | |||
WidgetModel.fromJson(Map<String, dynamic>.from(item)); | |||
WidgetModel.fromJson(Map<String, dynamic>.from(item)); | |||
if (item.containsKey("mod_name") && | |||
item['mod_name'] == "hot_rank_bg_img") { | |||
_bloc.backgroundImage = json.decode(item['data'])['bg_img']; | |||
@@ -98,11 +97,8 @@ class __HotRankingPageContainerState extends State<_HotRankingPageContainer> { | |||
children: <Widget>[ | |||
Container( | |||
height: 293.h, | |||
decoration: BoxDecoration( | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider( | |||
_bloc.backgroundImage ?? ""), | |||
fit: BoxFit.fill)), | |||
child: CachedNetworkImage( | |||
imageUrl: _bloc.backgroundImage ?? "", fit: BoxFit.fill), | |||
), | |||
Column( | |||
children: _createContent(context, model), | |||
@@ -124,7 +120,7 @@ class __HotRankingPageContainerState extends State<_HotRankingPageContainer> { | |||
} else { | |||
for (var item in model) { | |||
WidgetModel widgetModel = | |||
WidgetModel.fromJson(Map<String, dynamic>.from(item)); | |||
WidgetModel.fromJson(Map<String, dynamic>.from(item)); | |||
if (item.containsKey("mod_name") && | |||
item['mod_name'] == "hot_rank_tab_view") { | |||
list.add(Expanded( | |||
@@ -149,22 +145,14 @@ class _SilverAppBarDelegate extends SliverPersistentHeaderDelegate { | |||
final Widget child; | |||
@override | |||
double get minExtent => | |||
MediaQuery | |||
.of(context) | |||
.padding | |||
.top + 44; | |||
double get minExtent => MediaQuery.of(context).padding.top + 44; | |||
@override | |||
double get maxExtent => | |||
MediaQuery | |||
.of(context) | |||
.padding | |||
.top + 44; | |||
double get maxExtent => MediaQuery.of(context).padding.top + 44; | |||
@override | |||
Widget build(BuildContext context, double shrinkOffset, | |||
bool overlapsContent) { | |||
Widget build( | |||
BuildContext context, double shrinkOffset, bool overlapsContent) { | |||
return child; | |||
} | |||
@@ -146,10 +146,14 @@ class BaseWidgetRegister { | |||
/// 我的团队 | |||
PageFactory.regist('pub.flutter.my_team', (model) => TeamPage(model)); | |||
/// 用户详情 | |||
PageFactory.regist('pub.flutter.my_fan_detail', (model) => TeamDetailsPage(model)); | |||
PageFactory.regist( | |||
'pub.flutter.my_fan_detail', (model) => TeamDetailsPage(model)); | |||
/// 消息中心 | |||
PageFactory.regist('pub.flutter.message_notice', (model) => MessageNoticePage(model)); | |||
PageFactory.regist( | |||
'pub.flutter.message_notice', (model) => MessageNoticePage(model)); | |||
} | |||
// 注册控件 | |||
@@ -1,12 +1,11 @@ | |||
import 'dart:ui' as ui show ParagraphBuilder, PlaceholderAlignment; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | |||
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart'; | |||
import 'package:zhiying_base_widget/widgets/hot_ranking/hot_ranking_list/model/hot_ranking_list_data_model.dart'; | |||
import 'package:zhiying_base_widget/widgets/hot_ranking/hot_ranking_list/model/hot_ranking_list_model.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'dart:ui' as ui show ParagraphBuilder, PlaceholderAlignment; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
class HotRankingGoods extends StatelessWidget { | |||
Good good; | |||
@@ -27,7 +26,8 @@ class HotRankingGoods extends StatelessWidget { | |||
Providers providers = getProvider(good.provider); | |||
return GestureDetector( | |||
onTap: () { | |||
RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), good?.toJson(), context); | |||
RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), | |||
good?.toJson(), context); | |||
}, | |||
child: Stack( | |||
children: <Widget>[ | |||
@@ -43,10 +43,14 @@ class HotRankingGoods extends StatelessWidget { | |||
Container( | |||
width: 254.w, | |||
height: 254.w, | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(6), | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider(good.goodImage))), | |||
child: ClipRRect( | |||
borderRadius: BorderRadius.circular(6), | |||
child: CachedNetworkImage( | |||
imageUrl: good?.goodImage ?? '', | |||
), | |||
), | |||
decoration: | |||
BoxDecoration(borderRadius: BorderRadius.circular(6)), | |||
), | |||
Expanded( | |||
child: Container( | |||
@@ -65,24 +69,28 @@ class HotRankingGoods extends StatelessWidget { | |||
maxLines: 2, | |||
text: TextSpan(children: <InlineSpan>[ | |||
WidgetSpan( | |||
alignment: ui.PlaceholderAlignment.middle, | |||
alignment: | |||
ui.PlaceholderAlignment.middle, | |||
child: Container( | |||
padding: EdgeInsets.only( | |||
left: 4.w, right: 4.w, top: 1, bottom: 1), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex( | |||
providers.providerBgColor), | |||
borderRadius: | |||
BorderRadius.circular(2.5)), | |||
child: Text( | |||
good.providerName ?? "", | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
providers.providerNameColor, | |||
), | |||
fontSize: 18.sp), | |||
), | |||
)), | |||
left: 4.w, | |||
right: 4.w, | |||
top: 1, | |||
bottom: 1), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex( | |||
providers.providerBgColor), | |||
borderRadius: | |||
BorderRadius.circular(2.5)), | |||
child: Text( | |||
good.providerName ?? "", | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
providers.providerNameColor, | |||
), | |||
fontSize: 18.sp), | |||
), | |||
)), | |||
WidgetSpan( | |||
child: SizedBox( | |||
width: 4.h, | |||
@@ -211,7 +219,7 @@ class HotRankingGoods extends StatelessWidget { | |||
children: <Widget>[ | |||
Expanded( | |||
child: Container( | |||
alignment: Alignment.centerLeft, | |||
alignment: Alignment.centerLeft, | |||
height: 40.w, | |||
padding: EdgeInsets.only( | |||
left: 40.w, | |||
@@ -232,7 +240,8 @@ class HotRankingGoods extends StatelessWidget { | |||
width: 48.w, | |||
height: 48.w, | |||
child: CachedNetworkImage( | |||
imageUrl: styleModel.hotRank.hotSaleImg ?? "", | |||
imageUrl: | |||
styleModel?.hotRank?.hotSaleImg ?? "", | |||
width: 48.w, | |||
height: 48.w, | |||
placeholder: (context, _) => | |||
@@ -36,12 +36,12 @@ class _HotRankingState extends State<HotRankingList> | |||
_bloc = HotRankingListBloc(); | |||
_refreshController = RefreshController(); | |||
_pageBloc = BlocProvider.of<HotRankingPageBloc>(context); | |||
_scrollcontroller=ScrollController(); | |||
_scrollcontroller = ScrollController(); | |||
if (_pageBloc != null) { | |||
_pageBloc.event.listen((event) { | |||
if (event.containsKey('type') && event['type'] == "loadData") { | |||
_bloc.currentPage=1; | |||
_bloc.currentPage = 1; | |||
_bloc.loadData(event['type_id'], _bloc.currentPage, () {}); | |||
} | |||
}); | |||
@@ -50,16 +50,6 @@ class _HotRankingState extends State<HotRankingList> | |||
super.initState(); | |||
} | |||
_buildTabs() { | |||
List<Widget> listWidget = List(); | |||
for (int index = 0; index < 4; index++) { | |||
listWidget.add(Tab( | |||
text: "hahah", | |||
)); | |||
} | |||
return listWidget; | |||
} | |||
@override | |||
void dispose() { | |||
_tabController.dispose(); | |||
@@ -71,22 +61,6 @@ class _HotRankingState extends State<HotRankingList> | |||
_tabController = TabController(length: 4, vsync: this); | |||
} | |||
///构建TabView | |||
_buildTabView() { | |||
List<Widget> listWidget = List(); | |||
for (var index = 0; index < 4; index++) { | |||
listWidget.add(ListView.builder( | |||
padding: EdgeInsets.all(0), | |||
itemCount: 10, | |||
itemBuilder: (context, index) { | |||
return Container( | |||
child: HotRankingGoods(), | |||
); | |||
})); | |||
} | |||
return listWidget; | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
return StreamBuilder<HotRankingListDataModel>( | |||
@@ -96,9 +70,10 @@ class _HotRankingState extends State<HotRankingList> | |||
return HotRankingSkeleton(); | |||
} else { | |||
goods = snapshot.data.good; | |||
if(_bloc.currentPage==1){ | |||
Future.delayed(Duration(milliseconds: 100),(){ | |||
_scrollcontroller.animateTo(0, duration: Duration(milliseconds: 100), curve: Curves.ease); | |||
if (_bloc.currentPage == 1) { | |||
Future.delayed(Duration(milliseconds: 100), () { | |||
_scrollcontroller.animateTo(0, | |||
duration: Duration(milliseconds: 100), curve: Curves.ease); | |||
}); | |||
} | |||
return SmartRefresher( | |||
@@ -53,7 +53,7 @@ class MineDataWidget extends StatelessWidget { | |||
topLeft: Radius.circular(7.5), | |||
topRight: Radius.circular(7.5)), | |||
child: CachedNetworkImage( | |||
imageUrl: _style.accumulatedEarningsBgImg, | |||
imageUrl: _style.accumulatedEarningsBgImg ?? '', | |||
fit: BoxFit.cover, | |||
), | |||
), | |||
@@ -108,7 +108,7 @@ class MineDataWidget extends StatelessWidget { | |||
child: Stack( | |||
children: <Widget>[ | |||
CachedNetworkImage( | |||
imageUrl: _style.btnImg, | |||
imageUrl: _style?.btnImg ?? '', | |||
fit: BoxFit.cover, | |||
), | |||
Center( | |||
@@ -112,11 +112,12 @@ class _WalletDataState extends State<WalletData> { | |||
}, | |||
child: Container( | |||
decoration: BoxDecoration( | |||
color: Colors.red, | |||
borderRadius: BorderRadius.circular(10), | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider(""), | |||
fit: BoxFit.fill)), | |||
borderRadius: BorderRadius.circular(10), | |||
image: DecorationImage( | |||
image: CachedNetworkImageProvider( | |||
model.headerCashOutBtnImg ?? ''), | |||
fit: BoxFit.fill), | |||
), | |||
child: Padding( | |||
padding: EdgeInsets.only( | |||
left: 29.w, | |||