feat: UI pages
This commit is contained in:
1 parent
fbcd33ea2b
commit
197c3e9b88
41 files changed
+1270
-274
No files matched your search
@@ -20,7 +20,8 @@ class DailyQuestWidget extends StatelessWidget {
|
||||
double height = 281.h;
|
||||
double width = 345.w;
|
||||
return SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 15.w),
|
||||
width: width,
|
||||
height: height,
|
||||
child: Stack(
|
||||
@@ -66,6 +67,7 @@ class DailyQuestWidget extends StatelessWidget {
|
||||
),
|
||||
child: HelpImg.network(drama.imageUrl, width: 300.w, height: 160.h, fit: BoxFit.cover),
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -86,7 +88,8 @@ class DailyQuestWidget extends StatelessWidget {
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
SizedBox(height: 3.h),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/utils/models/drama/skywood_category.dart';
|
||||
|
||||
class HomeCateWidget extends StatelessWidget {
|
||||
|
||||
const HomeCateWidget({super.key,
|
||||
required this.categories,
|
||||
});
|
||||
|
||||
final List<SkywoodCategory> categories;
|
||||
|
||||
@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);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCateItem(SkywoodCategory category, int index) {
|
||||
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),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
|
||||
import '../../../utils/models/drama/skywood_drama.dart';
|
||||
|
||||
class HotCartridgeWidget extends StatelessWidget {
|
||||
|
||||
const HotCartridgeWidget({super.key,
|
||||
required this.dramaList,
|
||||
});
|
||||
|
||||
final List<SkywoodDrama> dramaList;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverGrid.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3, // 每行 2 列
|
||||
crossAxisSpacing: 12, // 列间距
|
||||
mainAxisSpacing: 5, // 行间距
|
||||
childAspectRatio: 110 / 174, // 宽高比
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return _buildItem(dramaList[index], index);
|
||||
}, itemCount: dramaList.length>6 ? 6 : dramaList.length);
|
||||
}
|
||||
|
||||
Widget _buildItem(SkywoodDrama drama, int index) {
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 110.w, height: 174.h,
|
||||
),
|
||||
Positioned(
|
||||
top: 1, left: 5.w, right: 5.w,
|
||||
child: HelpImg.network(drama.imageUrl, width: 100.w, height: 130.h),
|
||||
),
|
||||
HelpImg.asset(index<3?ConstImg.hotBg1:ConstImg.hotBg2, width: 110.w, height: 174.h)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:skywood/global/const/common_color.dart';
|
||||
|
||||
import '../../../utils/tools/help_img.dart';
|
||||
import '../../../utils/tools/sky_time_tool.dart';
|
||||
import '../../../utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
class LikeNumWidget extends StatelessWidget {
|
||||
|
||||
const LikeNumWidget({super.key, required this.watchTotal,
|
||||
this.tColor,
|
||||
});
|
||||
|
||||
final int watchTotal;
|
||||
final Color? tColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
// Icon(Icons.heart_broken, size: 15, color: Colors.redAccent,),
|
||||
HelpImg.asset(ConstImg.heart, width: 18.w, height: 18.w),
|
||||
const SizedBox(width: 3),
|
||||
SkyText(text: SkyTimeTool.formatNum(watchTotal),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: tColor ?? CommonColor.black,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/pages/home/widgets/like_num_widget.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
import '../../../utils/models/drama/skywood_drama.dart';
|
||||
|
||||
class RankListWidget extends StatelessWidget {
|
||||
|
||||
const RankListWidget({super.key,
|
||||
required this.dramaList,
|
||||
});
|
||||
|
||||
final List<SkywoodDrama> dramaList;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
HelpImg.asset(ConstImg.homeRankBg, width: 325.w, height: 481.h),
|
||||
Positioned(
|
||||
left: 24.5.w, right: 24.5.w,
|
||||
top: 44.5.h, bottom: 34.5.h,
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.only(right: 10.w),
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) => _itemBuilder(index),
|
||||
separatorBuilder: (context, index) {
|
||||
return Divider(
|
||||
height: 1, thickness: 0.5,
|
||||
color: CommonColor.withValue('7A67C1'),
|
||||
);
|
||||
},
|
||||
itemCount: dramaList.length>6 ? 6:dramaList.length,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _itemBuilder(int index) {
|
||||
SkywoodDrama drama = dramaList[index];
|
||||
return SizedBox(
|
||||
height: 65.h, width: 296.w,
|
||||
child: Row(
|
||||
children: [
|
||||
_rankIndex(index),
|
||||
HelpImg.network(drama.imageUrl, width: 40.w, height: 52.h, fit: BoxFit.cover),
|
||||
const SizedBox(width: 7),
|
||||
Expanded(child: SkyText(text: drama.name,
|
||||
fontSize: 13.w,
|
||||
fontFamily: 'Inter',
|
||||
fontWeight: FontWeight.w500,
|
||||
lineHeight: 1.23,
|
||||
color: CommonColor.black,
|
||||
maxLines: 2,
|
||||
)),
|
||||
SizedBox(width: 8.w),
|
||||
LikeNumWidget(watchTotal: drama.watchTotal)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _rankIndex(int index) {
|
||||
return SizedBox(
|
||||
width: 40.w,
|
||||
child: SkyText(text: formatNumber(index + 1),
|
||||
fontSize: 15,
|
||||
color: CommonColor.black,
|
||||
fontFamily: 'Anton',
|
||||
fontWeight: FontWeight.bold,
|
||||
lineHeight: 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String formatNumber(int number) {
|
||||
return number.toString().padLeft(2, '0');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user