logo和名称替换
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/hj_page/live/live_item_widget.dart';
|
||||
import 'package:hgmj/hj_utils/screen.dart';
|
||||
import 'package:hgmj/tools_base/banner/ads_grid_view.dart';
|
||||
import 'package:hgmj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:hgmj/tools_base/refresh/pull_refresh.dart';
|
||||
import 'package:hgmj/tools_base/widget/card_swiper/src/swiper.dart';
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/hj_page/live/live_item_widget.dart';
|
||||
import 'package:wydj/hj_utils/screen.dart';
|
||||
import 'package:wydj/tools_base/banner/ads_grid_view.dart';
|
||||
import 'package:wydj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:wydj/tools_base/refresh/pull_refresh.dart';
|
||||
import 'package:wydj/tools_base/widget/card_swiper/src/swiper.dart';
|
||||
|
||||
import 'live_model.dart';
|
||||
import 'live_sub_logic.dart';
|
||||
@@ -28,7 +28,8 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(image: AssetImage('live_main_bg.webp'.livePath), fit: BoxFit.fill),
|
||||
image: DecorationImage(
|
||||
image: AssetImage('live_main_bg.webp'.livePath), fit: BoxFit.fill),
|
||||
),
|
||||
child: GetBuilder<LiveSubLogic>(
|
||||
init: LiveSubLogic(tagData: widget.tagData),
|
||||
@@ -47,7 +48,8 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
Widget _buildContent(LiveSubLogic logic) {
|
||||
//列表样式
|
||||
if (!logic.isRecom) {
|
||||
return CustomScrollView(slivers: [_buildAdBanner(), _buildAnchorGrid(logic)]);
|
||||
return CustomScrollView(
|
||||
slivers: [_buildAdBanner(), _buildAnchorGrid(logic)]);
|
||||
}
|
||||
//推荐样式
|
||||
if (logic.liveMainModel?.recom == null) return const LoadingCenterWidget();
|
||||
@@ -71,10 +73,12 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
//国家/标签主播列表
|
||||
Widget _buildAnchorGrid(LiveSubLogic logic) {
|
||||
if (logic.loading) {
|
||||
return const SliverToBoxAdapter(child: SizedBox(height: 200, child: LoadingCenterWidget()));
|
||||
return const SliverToBoxAdapter(
|
||||
child: SizedBox(height: 200, child: LoadingCenterWidget()));
|
||||
}
|
||||
if (logic.liveList.isEmpty) {
|
||||
return SliverToBoxAdapter(child: CErrorWidget(retryOnTap: () => logic.loadData()));
|
||||
return SliverToBoxAdapter(
|
||||
child: CErrorWidget(retryOnTap: () => logic.loadData()));
|
||||
}
|
||||
return SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
@@ -86,7 +90,8 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
childAspectRatio: 168 / 105,
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, index) => LiveItemWidget(showType: 5, anchor: logic.liveList[index]),
|
||||
(_, index) =>
|
||||
LiveItemWidget(showType: 5, anchor: logic.liveList[index]),
|
||||
childCount: logic.liveList.length,
|
||||
),
|
||||
),
|
||||
@@ -107,13 +112,47 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
Widget _buildRecomSection(LiveRecom recom) {
|
||||
switch (recom.recoShowType) {
|
||||
case 'nine_grid':
|
||||
return _buildGridSection(recom, bg: 'live_section_bg_1.webp', title: 'nine_grid_bg.webp', titleHeight: 45, crossAxisCount: 3, mainSpacing: 12, crossSpacing: 5, aspectRatio: 1, showType: 0);
|
||||
return _buildGridSection(recom,
|
||||
bg: 'live_section_bg_1.webp',
|
||||
title: 'nine_grid_bg.webp',
|
||||
titleHeight: 45,
|
||||
crossAxisCount: 3,
|
||||
mainSpacing: 12,
|
||||
crossSpacing: 5,
|
||||
aspectRatio: 1,
|
||||
showType: 0);
|
||||
case 'six_round':
|
||||
return _buildGridSection(recom, bg: 'live_section_bg_2.webp', title: 'six_round_bg.webp', titleHeight: 45, crossAxisCount: 2, mainSpacing: 0, crossSpacing: 6, aspectRatio: 168 / 85, showType: 1, bottomSpace: 10);
|
||||
return _buildGridSection(recom,
|
||||
bg: 'live_section_bg_2.webp',
|
||||
title: 'six_round_bg.webp',
|
||||
titleHeight: 45,
|
||||
crossAxisCount: 2,
|
||||
mainSpacing: 0,
|
||||
crossSpacing: 6,
|
||||
aspectRatio: 168 / 85,
|
||||
showType: 1,
|
||||
bottomSpace: 10);
|
||||
case 'four_grid':
|
||||
return _buildGridSectionHor(recom, bg: 'live_section_bg_3.webp', title: 'four_grid_bg.webp', titleHeight: 45, crossAxisCount: 2, mainSpacing: 12, crossSpacing: 7, aspectRatio: 1, showType: 2, bottomSpace: 18);
|
||||
return _buildGridSectionHor(recom,
|
||||
bg: 'live_section_bg_3.webp',
|
||||
title: 'four_grid_bg.webp',
|
||||
titleHeight: 45,
|
||||
crossAxisCount: 2,
|
||||
mainSpacing: 12,
|
||||
crossSpacing: 7,
|
||||
aspectRatio: 1,
|
||||
showType: 2,
|
||||
bottomSpace: 18);
|
||||
case 'six_grid':
|
||||
return _buildGridSection(recom, bg: 'live_section_bg_4.webp', title: 'six_grid_bg.webp', titleHeight: 36, crossAxisCount: 3, mainSpacing: 12, crossSpacing: 5, aspectRatio: 1, showType: 3);
|
||||
return _buildGridSection(recom,
|
||||
bg: 'live_section_bg_4.webp',
|
||||
title: 'six_grid_bg.webp',
|
||||
titleHeight: 36,
|
||||
crossAxisCount: 3,
|
||||
mainSpacing: 12,
|
||||
crossSpacing: 5,
|
||||
aspectRatio: 1,
|
||||
showType: 3);
|
||||
case 'horizontal_slide':
|
||||
return _buildHorizontalSlide(recom);
|
||||
case 'list':
|
||||
@@ -128,7 +167,9 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
return Stack(
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
Column(mainAxisSize: MainAxisSize.min, children: [178.sizeBoxH, section, 10.sizeBoxH]),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [178.sizeBoxH, section, 10.sizeBoxH]),
|
||||
Positioned(
|
||||
top: 20,
|
||||
child: GestureDetector(
|
||||
@@ -156,7 +197,8 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
final anchors = recom?.anchors;
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(image: AssetImage(bg.livePath), fit: BoxFit.fill),
|
||||
image:
|
||||
DecorationImage(image: AssetImage(bg.livePath), fit: BoxFit.fill),
|
||||
),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 34),
|
||||
@@ -177,7 +219,8 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
//index 仅 showType==2 用于渲染前三角标,其余样式忽略
|
||||
itemBuilder: (_, index) => LiveItemWidget(showType: showType, anchor: anchors?[index], index: index),
|
||||
itemBuilder: (_, index) => LiveItemWidget(
|
||||
showType: showType, anchor: anchors?[index], index: index),
|
||||
),
|
||||
if (bottomSpace > 0) bottomSpace.sizeBoxH,
|
||||
],
|
||||
@@ -187,21 +230,22 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
|
||||
//宫格类区块(九宫格/六圆形/四宫格/六宫格 共用)横向排序
|
||||
Widget _buildGridSectionHor(
|
||||
LiveRecom? recom, {
|
||||
required String bg,
|
||||
required String title,
|
||||
required double titleHeight,
|
||||
required int crossAxisCount,
|
||||
required double mainSpacing,
|
||||
required double crossSpacing,
|
||||
required double aspectRatio,
|
||||
required int showType,
|
||||
double bottomSpace = 0,
|
||||
}) {
|
||||
LiveRecom? recom, {
|
||||
required String bg,
|
||||
required String title,
|
||||
required double titleHeight,
|
||||
required int crossAxisCount,
|
||||
required double mainSpacing,
|
||||
required double crossSpacing,
|
||||
required double aspectRatio,
|
||||
required int showType,
|
||||
double bottomSpace = 0,
|
||||
}) {
|
||||
final anchors = recom?.anchors;
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(image: AssetImage(bg.livePath), fit: BoxFit.fill),
|
||||
image:
|
||||
DecorationImage(image: AssetImage(bg.livePath), fit: BoxFit.fill),
|
||||
),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 34),
|
||||
@@ -210,7 +254,7 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
final width = c.maxWidth;
|
||||
final itemWidth = (width - 12) / 2;
|
||||
|
||||
return Column(
|
||||
return Column(
|
||||
children: [
|
||||
18.sizeBoxH,
|
||||
Image.asset(title.livePath, height: titleHeight),
|
||||
@@ -231,7 +275,10 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
//index 仅 showType==2 用于渲染前三角标,其余样式忽略
|
||||
itemBuilder: (_, index) => LiveItemWidget(showType: showType, anchor: anchors?[index], index: index),
|
||||
itemBuilder: (_, index) => LiveItemWidget(
|
||||
showType: showType,
|
||||
anchor: anchors?[index],
|
||||
index: index),
|
||||
),
|
||||
),
|
||||
if (bottomSpace > 0) bottomSpace.sizeBoxH,
|
||||
@@ -274,7 +321,8 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
viewportFraction: 0.8,
|
||||
scale: 0.93,
|
||||
itemCount: anchors?.length ?? 0,
|
||||
itemBuilder: (c, index) => LiveItemWidget(showType: 4, anchor: anchors?[index]),
|
||||
itemBuilder: (c, index) =>
|
||||
LiveItemWidget(showType: 4, anchor: anchors?[index]),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -297,7 +345,8 @@ class _LiveSubPageState extends State<LiveSubPage> {
|
||||
itemCount: anchors?.length ?? 0,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (_, index) => LiveItemWidget(showType: 5, anchor: anchors?[index]),
|
||||
itemBuilder: (_, index) =>
|
||||
LiveItemWidget(showType: 5, anchor: anchors?[index]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user