feat: 首页,播放页,搜索页,收藏UI
This commit is contained in:
1 parent
197c3e9b88
commit
e59ac2177b
19 files changed
+475
-81
No files matched your search
@@ -29,8 +29,8 @@ class _MainRootState extends State<HomePage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// _getHomeData();
|
||||
// _getDramaCate();
|
||||
_getHomeData();
|
||||
_getDramaCate();
|
||||
}
|
||||
|
||||
void _getHomeData() {
|
||||
@@ -97,12 +97,14 @@ class _MainRootState extends State<HomePage> {
|
||||
),
|
||||
_buildTitleImg(ConstImg.homeTitleHotCate),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15.w),
|
||||
sliver: HomeCateWidget(
|
||||
categories: _categories,
|
||||
padding: EdgeInsets.only(left: 15.w, right: 15.w, top: 20.h),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: HomeCateWidget(
|
||||
categories: _categories,
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildSpace(height: 100),
|
||||
_buildSpace(height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/global/client/play_client.dart';
|
||||
import 'package:skywood/pages/home/players/widget/player_bottom_widget.dart';
|
||||
import 'package:skywood/utils/models/drama/skywood_drama.dart';
|
||||
import 'package:skywood/utils/models/drama/skywood_home.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_app_bar.dart';
|
||||
|
||||
class DramaDetailPage extends StatefulWidget {
|
||||
const DramaDetailPage({super.key,
|
||||
required this.dramaBean,
|
||||
});
|
||||
|
||||
final SkywoodDrama dramaBean;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _DramaDetailPageState();
|
||||
}
|
||||
}
|
||||
|
||||
class _DramaDetailPageState extends State<DramaDetailPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// _getDetailDrama();
|
||||
}
|
||||
|
||||
// void _getDetailDrama() {
|
||||
// PlayClient.getVideoDetail(
|
||||
// shortPlayId: widget.shortPlayId,
|
||||
// shortPlayVideoId: widget.shortPlayVideoId
|
||||
// ).then((value) {});
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
appBar: SkyAppBar(
|
||||
title: widget.dramaBean.name,
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
body: _bodyWidget(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _bodyWidget() {
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(width: double.infinity, height: double.infinity),
|
||||
Positioned(
|
||||
bottom: 0, left: 0, right: 0,
|
||||
child: PlayerBottomWidget(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,95 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
class PlayerBottomWidget extends StatefulWidget {
|
||||
|
||||
const PlayerBottomWidget({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _PlayerBottomWidgetState();
|
||||
}
|
||||
}
|
||||
|
||||
class _PlayerBottomWidgetState extends State<PlayerBottomWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
HelpImg.asset(ConstImg.unlike, width: 40, height: 40),
|
||||
const SizedBox(height: 24),
|
||||
Container(
|
||||
height: 36,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
color: Colors.white.withAlpha(30),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
HelpImg.asset(ConstImg.playLt, width: 17, height: 17),
|
||||
const SizedBox(width: 10),
|
||||
SkyText(text: 'EP.1', fontSize: 13, color: Colors.white,),
|
||||
SkyText(text: ' / EP.50', fontSize: 13, color: Colors.white.withAlpha(126)),
|
||||
],
|
||||
),
|
||||
Icon(Icons.arrow_forward_ios, color: Colors.white, size: 13,),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildProgressBar(),
|
||||
const SizedBox(height: 7),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SkyText(text: '00:09', fontSize: 13, color: Colors.white),
|
||||
SkyText(text: ' / 10:20', fontSize: 13, color: Colors.white.withAlpha(126)),
|
||||
],
|
||||
),
|
||||
SkyText(text: 'x1.0', fontSize: 13, color: Colors.white),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProgressBar() {
|
||||
return SizedBox(
|
||||
width: double.infinity, height: 3,
|
||||
child: SliderTheme(
|
||||
data: SliderThemeData(
|
||||
trackHeight: 3, // ✅ 进度条高度 3
|
||||
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 1),
|
||||
overlayShape: const RoundSliderOverlayShape(overlayRadius: 3),
|
||||
activeTrackColor: Colors.white, // ✅ 已播放 = 白色
|
||||
inactiveTrackColor: Colors.white.withAlpha(126), // ✅ 未播放 = 灰色
|
||||
thumbColor: Colors.white,
|
||||
overlayColor: Colors.white.withOpacity(0.3),
|
||||
),
|
||||
child: Slider(
|
||||
padding: EdgeInsets.zero,
|
||||
value: 0.5,
|
||||
min: 0,
|
||||
max: 1,
|
||||
onChanged: (value) {
|
||||
// _controller.seekTo(Duration(milliseconds: value.toInt()));
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:skywood/global/const/common_color.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/pages/home/players/page/drama_detail_page.dart';
|
||||
import 'package:skywood/utils/models/drama/skywood_drama.dart';
|
||||
import 'package:skywood/utils/tools/sky_time_tool.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
@@ -91,6 +93,9 @@ class DailyQuestWidget extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 3.h),
|
||||
],
|
||||
);
|
||||
).addInkWell(onTap: () {
|
||||
|
||||
HelpNav.to(DramaDetailPage(dramaBean: drama));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/utils/models/drama/skywood_category.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
class HomeCateWidget extends StatelessWidget {
|
||||
|
||||
@@ -12,15 +13,20 @@ class HomeCateWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverGrid.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2, // 🔥 上下2行
|
||||
crossAxisSpacing: 10, // 行间距(垂直方向)
|
||||
mainAxisSpacing: 10, // 列间距(水平方向)
|
||||
childAspectRatio: 0.7, // 宽高比(宽度/高度)
|
||||
), itemBuilder: (context, index) {
|
||||
return _buildCateItem(categories[index], index);
|
||||
}
|
||||
return SizedBox(
|
||||
height: 270, width: double.infinity,
|
||||
child: GridView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2, // 🔥 上下2行
|
||||
crossAxisSpacing: 14, // 行间距(垂直方向)
|
||||
mainAxisSpacing: 10, // 列间距(水平方向)
|
||||
childAspectRatio: 140 / 131.0, // 宽高比(宽度/高度)
|
||||
),
|
||||
itemCount: categories.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildCateItem(categories[index], index);}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,8 +34,69 @@ class HomeCateWidget extends StatelessWidget {
|
||||
String imgName = index%3 == 0 ? ConstImg.purpleBg : (index%3 == 1 ? ConstImg.yellowBg : ConstImg.redBg);
|
||||
return Stack(
|
||||
children: [
|
||||
HelpImg.asset(imgName, width: 140.w, height: 131.h, fit: BoxFit.cover),
|
||||
HelpImg.asset(imgName, width: 140.w, height: 131.w, fit: BoxFit.fill),
|
||||
Positioned(
|
||||
bottom: 24.h, left: 10.w, right: 10.w,
|
||||
child: _customText(category.name,),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
_customText(String text) {
|
||||
return Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white, // 内部字体白色
|
||||
fontStyle: FontStyle.italic,
|
||||
fontFamily: 'Inter',
|
||||
fontWeight: FontWeight.w600,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black, // 描边颜色
|
||||
offset: Offset(1, 1), // 偏移量
|
||||
blurRadius: 0, // 不模糊,形成硬边描边
|
||||
),
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(-1, -1),
|
||||
blurRadius: 0,
|
||||
),
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(1, -1),
|
||||
blurRadius: 0,
|
||||
),
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(-1, 1),
|
||||
blurRadius: 0,
|
||||
),
|
||||
// 四个角再加一些,让描边更饱满
|
||||
// Shadow(
|
||||
// color: Colors.black,
|
||||
// offset: Offset(2, 0),
|
||||
// blurRadius: 0,
|
||||
// ),
|
||||
// Shadow(
|
||||
// color: Colors.black,
|
||||
// offset: Offset(-2, 0),
|
||||
// blurRadius: 0,
|
||||
// ),
|
||||
// Shadow(
|
||||
// color: Colors.black,
|
||||
// offset: Offset(0, 2),
|
||||
// blurRadius: 0,
|
||||
// ),
|
||||
// Shadow(
|
||||
// color: Colors.black,
|
||||
// offset: Offset(0, -2),
|
||||
// blurRadius: 0,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class HotCartridgeWidget extends StatelessWidget {
|
||||
),
|
||||
Positioned(
|
||||
top: 1, left: 5.w, right: 5.w,
|
||||
child: HelpImg.network(drama.imageUrl, width: 100.w, height: 130.h),
|
||||
child: HelpImg.network(drama.imageUrl, width: 100.w, height: 130.h, fit: BoxFit.cover),
|
||||
),
|
||||
HelpImg.asset(index<3?ConstImg.hotBg1:ConstImg.hotBg2, width: 110.w, height: 174.h)
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/global/client/play_client.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
|
||||
class CollectionPage extends StatefulWidget {
|
||||
@@ -13,6 +14,19 @@ class CollectionPage extends StatefulWidget {
|
||||
|
||||
class _CollectionPageState extends State<CollectionPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
_getCollection();
|
||||
}
|
||||
|
||||
void _getCollection() {
|
||||
PlayClient.getCollections().then((value) {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GridView.builder(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/global/client/play_client.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
@@ -14,6 +15,16 @@ class PlayLogPage extends StatefulWidget {
|
||||
|
||||
class _CollectionPageState extends State<PlayLogPage> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getHistory();
|
||||
}
|
||||
|
||||
void _getHistory() {
|
||||
PlayClient.getHistory().then((value) {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.separated(
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/global/client/play_client.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/pages/search/page/result_page.dart';
|
||||
import 'package:skywood/pages/search/widget/search_util.dart';
|
||||
import 'package:skywood/pages/search/widget/search_view.dart';
|
||||
import 'package:skywood/pages/widgets/pixel_widgets.dart';
|
||||
import 'package:skywood/utils/models/drama/skywood_drama.dart';
|
||||
import 'package:skywood/utils/tools/help_nav.dart';
|
||||
import 'package:skywood/utils/tools/sky_time_tool.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_app_bar.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_text_field.dart';
|
||||
|
||||
@@ -33,6 +36,7 @@ class _MainRootState extends State<SearchPage> {
|
||||
'Who Dared Touch My Bride',
|
||||
'Famous Families Fled',
|
||||
];
|
||||
List<SkywoodDrama> _searchHots = [];
|
||||
|
||||
Future<void> _loadSearchHistory() async {
|
||||
final list = await SearchUtil.getSearchList();
|
||||
@@ -61,6 +65,16 @@ class _MainRootState extends State<SearchPage> {
|
||||
super.initState();
|
||||
|
||||
_loadSearchHistory();
|
||||
_getSearchHots();
|
||||
}
|
||||
|
||||
void _getSearchHots() {
|
||||
PlayClient.getSearchHots().then((value) {
|
||||
print('object: ${value.length}');
|
||||
setState(() {
|
||||
_searchHots = value;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -129,76 +143,119 @@ class _MainRootState extends State<SearchPage> {
|
||||
}
|
||||
|
||||
Widget _buildTrendingList() {
|
||||
if (_searchHots.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
// 每4个一组
|
||||
final List<List<SkywoodDrama>> groupedData = [];
|
||||
for (int i = 0; i < _searchHots.length; i += 4) {
|
||||
final end = (i + 4 > _searchHots.length) ? _searchHots.length : i + 4;
|
||||
groupedData.add(_searchHots.sublist(i, end));
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
height: 446.h,
|
||||
child: SingleChildScrollView(
|
||||
height: 114 * 4 + 20, // 104 * 4 + 10 * 3
|
||||
child: ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: EdgeInsets.symmetric(horizontal: 15.w),
|
||||
child: Wrap(
|
||||
direction: Axis.vertical,
|
||||
spacing: 10.h,
|
||||
runSpacing: 10.w,
|
||||
children: _titles
|
||||
.map((title) => _TrendingItem(title: title))
|
||||
.toList(),
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final group = groupedData[index];
|
||||
return _buildGroup(group);
|
||||
},
|
||||
separatorBuilder: (context, index) => SizedBox(width: 10.w),
|
||||
itemCount: groupedData.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 一组卡片(垂直排列,最多4个)
|
||||
Widget _buildGroup(List<SkywoodDrama> group) {
|
||||
return SizedBox(
|
||||
width: 236,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: group.map((drama) {
|
||||
return _TrendingItem(drama: drama);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
// Widget _buildTrendingList() {
|
||||
// return Container(
|
||||
// height: 114 * 4, width: AppScreen.screenWidth,
|
||||
// color: Colors.green,
|
||||
// child: GridView.builder(
|
||||
// padding: EdgeInsets.only(left: 15.w),
|
||||
// scrollDirection: Axis.horizontal,
|
||||
// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// crossAxisCount: 4, // 上下4行
|
||||
// crossAxisSpacing: 10, // 行间距(垂直方向)
|
||||
// mainAxisSpacing: 10, // 列间距(水平方向)
|
||||
// childAspectRatio: 236 / 104.0, // 宽高比(宽度/高度)
|
||||
// ),
|
||||
// itemCount: _searchHots.length,
|
||||
// itemBuilder: (context, index) {
|
||||
// final drama = _searchHots[index];
|
||||
// return Container(width: 236, height: 104, color: index%2==0 ? Colors.orangeAccent : Colors.redAccent,);
|
||||
// return _TrendingItem(drama: drama);
|
||||
// }
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
class _TrendingItem extends StatelessWidget {
|
||||
const _TrendingItem({required this.title});
|
||||
const _TrendingItem({required this.drama});
|
||||
|
||||
final String title;
|
||||
final SkywoodDrama drama;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 236.w,
|
||||
height: 104.h,
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
// width: 236.w,
|
||||
// height: 104.w,
|
||||
child: Row(
|
||||
children: [
|
||||
const PosterImage(
|
||||
width: 80,
|
||||
height: 104,
|
||||
borderRadius: 4,
|
||||
showBorder: false,
|
||||
),
|
||||
SizedBox(width: 8.w),
|
||||
|
||||
HelpImg.network(drama.imageUrl, width: 80, height: 104, fit: BoxFit.cover),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: CommonColor.black,
|
||||
fontSize: 13.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 1.2,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
HelpImg.asset(ConstImg.hot, width: 15.w, height: 15.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text(
|
||||
'17.3K',
|
||||
style: TextStyle(
|
||||
color: const Color(0x80000000),
|
||||
fontSize: 13.w,
|
||||
height: 1,
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
child: SizedBox(
|
||||
height: 84,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
drama.name,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: CommonColor.black,
|
||||
fontSize: 13.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 1.2,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
HelpImg.asset(ConstImg.hot, width: 15.w, height: 15.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text(
|
||||
SkyTimeTool.formatNum(drama.watchTotal, unit: 'w'),
|
||||
style: TextStyle(
|
||||
color: const Color(0x80000000),
|
||||
fontSize: 13.w,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user