skywood/lib/pages/home/widgets/daily_quest_widget.dart

107 lines
3.2 KiB
Dart

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';
import '../../../utils/tools/help_img.dart';
class DailyQuestWidget extends StatelessWidget {
const DailyQuestWidget({super.key,
required this.dramaList,
});
final List<SkywoodDrama> dramaList;
@override
Widget build(BuildContext context) {
double height = 281.h;
double width = 345.w;
return SliverToBoxAdapter(
child: Container(
padding: EdgeInsets.only(left: 15.w),
width: width,
height: height,
child: Stack(
children: [
HelpImg.asset(ConstImg.homeCardBg, height: height, width: width,fit: BoxFit.fill),
Positioned(
top: 20.h, bottom: 19.h, left: 22.5.w,
width: 300.w,
child: Column(
children: [
_buildFirstDrama(),
_buildDramaList()
],
),
),
],
),
),
);
}
Widget _buildDramaList() {
if (dramaList.length < 2) return SizedBox.shrink();
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
spacing: 5.w,
children: List.generate(dramaList.length-1, (index) {
final drama = dramaList[index+1];
return InkWell(
onTap: () {
HelpNav.to(DramaDetailPage(dramaBean: drama));
},
child: HelpImg.network(drama.horizontallyImg, width: 95.w, height: 50.h, fit: BoxFit.cover),
);
})
),
);
}
Widget _buildFirstDrama() {
if (dramaList.isEmpty) return SizedBox.shrink();
SkywoodDrama drama = dramaList[0];
return Column(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(color: CommonColor.black, width: 1),
),
child: HelpImg.network(drama.horizontallyImg, width: 300.w, height: 160.h, fit: BoxFit.cover),
),
SizedBox(height: 4.h),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: SkyText(text: drama.name,
fontSize: 14,
fontFamily: 'Inter',
fontWeight: FontWeight.w500,
)),
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(drama.watchTotal),
fontSize: 12,
fontWeight: FontWeight.w400,
)
],
)
],
),
SizedBox(height: 3.h),
],
).addInkWell(onTap: () {
HelpNav.to(DramaDetailPage(dramaBean: drama));
});
}
}