78 lines
2.4 KiB
Dart
78 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:hgdj/assets_tool/app_colors.dart';
|
|
import 'package:hgdj/tools_base/indicator/custom_tab_indicator.dart';
|
|
import 'package:hgdj/tools_base/loading/loading_center_widget.dart';
|
|
import 'package:hgdj/tools_base/widget/keep_alive_widget.dart';
|
|
|
|
import 'live_main_logic.dart';
|
|
import 'live_sub_page.dart';
|
|
|
|
//直播首页
|
|
class LiveMainPage extends StatelessWidget {
|
|
static bool broadcast = false; //开启直播模块开关
|
|
static bool jumpLiveLink = false; //直播内链跳转初始化
|
|
|
|
const LiveMainPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<LiveMainLogic>(
|
|
init: LiveMainLogic(),
|
|
builder: (logic) {
|
|
if (logic.liveMainModel == null) return const LoadingCenterWidget();
|
|
return Column(
|
|
children: [
|
|
_buildTabBar(logic),
|
|
Expanded(
|
|
child: TabBarView(
|
|
controller: logic.tabController,
|
|
children: List.generate(
|
|
logic.liveTabs.length,
|
|
(index) =>
|
|
LiveSubPage(tagData: logic.liveTabs[index]).keepAlive,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
//国家分类
|
|
Widget _buildTabBar(LiveMainLogic logic) {
|
|
return SizedBox(
|
|
height: 44,
|
|
child: TabBar(
|
|
controller: logic.tabController,
|
|
tabs: List.generate(
|
|
logic.liveTabs.length,
|
|
(index) => Padding(
|
|
padding: const EdgeInsets.only(bottom: 7),
|
|
child: Text(logic.liveTabs[index].title ?? ''),
|
|
),
|
|
),
|
|
labelPadding: const EdgeInsets.symmetric(horizontal: 9),
|
|
tabAlignment: TabAlignment.start,
|
|
isScrollable: true,
|
|
labelColor: Colors.white.withValues(alpha: .9),
|
|
labelStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
|
unselectedLabelColor: Colors.white.withValues(alpha: .45),
|
|
unselectedLabelStyle:
|
|
const TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
|
|
indicatorPadding: const EdgeInsets.only(top: -4),
|
|
indicator: CustomIndicator(
|
|
height: 2,
|
|
width: 16,
|
|
borderRadius: const BorderRadius.only(
|
|
topLeft: Radius.circular(1),
|
|
topRight: Radius.circular(1),
|
|
),
|
|
color: AppColors.actionRed,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|