| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:news_app/ui/video/video_rank_list_page.dart';
- import 'package:news_app/ui/video/video_recommend_list_page.dart';
- import '../../constant/color_res.dart';
- import '../../gen/assets.gen.dart';
- import '../search/search_bar_widget.dart';
- /// @author: bo.zeng
- /// @email: cnhbwds@gmail.com
- /// @date: 2025 2025/4/9 16:00
- /// @description:
- class MainVideoPage extends StatefulWidget {
- const MainVideoPage({super.key});
- @override
- State<MainVideoPage> createState() => _MainVideoPageState();
- }
- class _MainVideoPageState extends State<MainVideoPage>
- with AutomaticKeepAliveClientMixin {
- @override
- Widget build(BuildContext context) {
- super.build(context);
- return DefaultTabController(
- length: 2,
- child: Scaffold(
- appBar: AppBar(
- elevation: 0,
- // 移除阴影
- scrolledUnderElevation: 0,
- // 禁用滚动时的阴影变化
- backgroundColor: color5F59F7,
- centerTitle: true,
- title: Row(
- spacing: 10.w,
- children: [
- Image.asset(Assets.images.logo.path,width: 70.w,),
- Expanded(
- child: SearchBarWidget(tabIndex: 2,),
- )
- ],
- ),
- systemOverlayStyle: SystemUiOverlayStyle(
- statusBarColor: color5F59F7,
- statusBarIconBrightness: Brightness.light, // 状态栏图标颜色
- ),
- bottom: TabBar(
- tabAlignment: TabAlignment.center,
- isScrollable: false,
- indicatorColor: Colors.white,
- dividerHeight: 0,
- labelColor: Colors.white,
- // 选中标签颜色
- unselectedLabelColor: Colors.white,
- // 未选中标签颜色
- labelStyle: TextStyle(
- fontWeight: FontWeight.bold, // 选中标签加粗
- fontSize: 15.0.sp,
- ),
- unselectedLabelStyle: TextStyle(
- fontWeight: FontWeight.normal, // 未选中标签不加粗
- fontSize: 12.0.sp,
- ),
- tabs: [Tab(text: "推荐"), Tab(text: "视频榜")],
- ),
- ),
- body: Stack(
- children: [
- Positioned(
- child: Container(
- height: 100.h,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: [color5F59F7, color6592FD, Colors.white],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- ),
- ),
- TabBarView(
- children: [VideoRecommendListPage(), VideoRankListPage()],
- ),
- ],
- ),
- ),
- );
- }
- @override
- bool get wantKeepAlive => true;
- }
|