feat: 搜索页的数据,缺省页

This commit is contained in:
chengsiwen committed 2026-07-06 20:56:12 +08:00
1 parent 9b0fe51fa4
commit b5bce6edcf
18 files changed
+1101 -171

No files matched your search

+9 -3
View File
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:novyronst/common/model/ny_category_model.dart';
import 'package:novyronst/pages/widgets/cut_corner_clipper.dart';
import 'package:novyronst/pages/widgets/ny_progress_widget.dart';
import 'package:novyronst/pages/widgets/ny_tag_widget.dart';
@@ -10,7 +11,11 @@ import 'package:novyronst/tools/widgets/novy_img_bg.dart';
class HomeFirstView extends StatefulWidget {
const HomeFirstView({super.key});
const HomeFirstView({super.key,
required this.categories,
});
final List<NyCategoryModel> categories;
@override
State<StatefulWidget> createState() {
@@ -46,14 +51,15 @@ class _HomeFirstViewState extends State<HomeFirstView> {
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(3, (index) {
children: List.generate(widget.categories.length, (index) {
final _item = widget.categories[index];
return Container(
margin: const EdgeInsets.only(right: 8),
child: NovyImgBg(imgBg: ConstImage.cateBg,
height: 52,
child: Stack(
children:[
NovyText('ClassPp', color: ConstColor.btGreen,
NovyText(_item.name, color: ConstColor.btGreen,
fontSize: 21,
textAlign: TextAlign.center,
fontFamily: ConstFont.montBlack,
+111 -24
View File
@@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:novyronst/common/const/const_color.dart';
import 'package:novyronst/common/const/const_string.dart';
import 'package:novyronst/common/help/help_image.dart';
import 'package:novyronst/common/model/ny_drama_model.dart';
import 'package:novyronst/tools/widgets/novy_com_widget.dart';
import '../../../tools/util/app_screen.dart';
@@ -10,7 +13,12 @@ import '../../widgets/ny_tag_widget.dart';
class HomeRankWidget extends StatelessWidget {
const HomeRankWidget({super.key});
const HomeRankWidget({
super.key,
required this.dramaRanks,
});
final List<NyDramaModel> dramaRanks;
@override
Widget build(BuildContext context) {
@@ -20,7 +28,7 @@ class HomeRankWidget extends StatelessWidget {
cutSize: 40,
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
child: dramaRanks.isEmpty ? SizedBox(height: 20,) : Column(
children: [
_buildRankList(),
const SizedBox(height: 5),
@@ -37,6 +45,7 @@ class HomeRankWidget extends StatelessWidget {
}
Row _buildRankList() {
return Row(
children: [
_firstVideoView(),
@@ -47,38 +56,116 @@ class HomeRankWidget extends StatelessWidget {
}
Widget _firstVideoView() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 160.w, height: 240.w,
decoration: BoxDecoration(
color: Colors.red,
)
),
const SizedBox(height: 10),
NovyText('Star of the ocean', fontSize: 15,
color: Colors.black,
fontFamily: ConstFont.montMedium,
),
const SizedBox(height: 5),
NyTagWidget(text: 'Safiray'),
const SizedBox(height: 8),
],
NyDramaModel _item = dramaRanks.first;
String _tag = "Safiray";
if (_item.categoryList!=null && _item.categoryList!.isNotEmpty) {
_tag = _item.categoryList!.first.name;
}
return SizedBox(
width: 160.w,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
SizedBox(
width: 160.w, height: 240.w,
child: HelpImage.network(_item.imageUrl, fit: BoxFit.cover),
),
Positioned(
top: -10, left: 1,
child: _colorsText(1),
)
],
),
const SizedBox(height: 10),
NovyText(_item.name, fontSize: 15,
color: Colors.black,
fontFamily: ConstFont.montMedium,
),
const SizedBox(height: 5),
Row(
children: [
NyTagWidget(text: _tag),
],
),
const SizedBox(height: 8),
],
),
);
}
Widget _otherVideoView() {
int _count = dramaRanks.length - 1;
if (_count > 3) _count = 3;
return Column(
children: List.generate(3, (index) {
children: List.generate(_count, (index) {
NyDramaModel _item = dramaRanks[index + 1];
String _tag = "";
if (_item.categoryList!=null && _item.categoryList!.isNotEmpty) {
_tag = _item.categoryList!.first.name;
}
return Container(
margin: const EdgeInsets.only(bottom: 8),
width: 160.w, height: 93.w,
decoration: BoxDecoration(
color: Colors.grey,
)
child: Row(
children: [
HelpImage.network(_item.imageUrl, width: 62.w, height: 93.w),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_colorsText(index + 2),
const SizedBox(height: 8),
NovyText(_item.name, fontSize: 13,
color: Colors.black,
),
const SizedBox(height: 5),
_tag.isNotEmpty ? NyTagWidget(text: _tag) : SizedBox()
],
),
)
],
),
);
})
);
}
_colorsText(int index) {
if (index == 4) {
return Text(
'$index',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.grey.withAlpha(127),
fontStyle: FontStyle.italic,
),
);
}
return ShaderMask(
shaderCallback: (Rect bounds) {
return LinearGradient(
colors: [
ConstColor.withValue('#3ED71F'),
ConstColor.withValue('#FFFF65'),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
).createShader(bounds);
},
child: Text(
'$index',
style: TextStyle(
fontSize: index==1 ? 40: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
fontStyle: FontStyle.italic,
),
),
);
}
}
@@ -8,28 +8,6 @@ import 'package:novyronst/tools/widgets/novy_com_widget.dart';
class HomeRemainingSections extends StatelessWidget {
const HomeRemainingSections({super.key});
static const List<_DramaItem> _rankingItems = [
_DramaItem(
title: 'Star Of The Ocean',
category: 'Period Drama',
palette: [Color(0xFF6E4968), Color(0xFFE5A3B8)],
),
_DramaItem(
title: 'Not Your Bride',
category: 'Period Drama',
palette: [Color(0xFF262431), Color(0xFFE0A15F)],
),
_DramaItem(
title: 'Not Your Bride',
category: 'Period Drama',
palette: [Color(0xFF261B16), Color(0xFFD9C2A2)],
),
_DramaItem(
title: 'Not Your Bride',
category: 'Period Drama',
palette: [Color(0xFF223E36), Color(0xFFFFC568)],
),
];
static const _ActorInfo _actor = _ActorInfo(
name: 'Cheng Zi',
@@ -84,8 +62,7 @@ class HomeRemainingSections extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(16, 10, 16, 92),
child: Column(
children: [
const _RankingSection(items: _rankingItems),
const SizedBox(height: 18),
const SizedBox(height: 10),
const _ActorSection(actor: _actor, items: _seriesItems),
const SizedBox(height: 18),
..._categoryTitles.map((title) {
@@ -100,51 +77,6 @@ class HomeRemainingSections extends StatelessWidget {
}
}
class _RankingSection extends StatelessWidget {
const _RankingSection({required this.items});
final List<_DramaItem> items;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.black, width: 2),
),
child: Column(
children: [
SizedBox(
height: 230,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(flex: 6, child: _TopRankingPoster(item: items.first)),
const SizedBox(width: 8),
Expanded(
flex: 5,
child: Column(
children: List.generate(3, (index) {
return Expanded(
child: _RankingListItem(
rank: index + 2,
item: items[index + 1],
),
);
}),
),
),
],
),
),
const SizedBox(height: 5),
const _GreenActionButton(text: 'View more rankings'),
],
),
);
}
}
class _TopRankingPoster extends StatelessWidget {
const _TopRankingPoster({required this.item});
+16 -7
View File
@@ -94,9 +94,13 @@ class _SearchViewState extends State<HomeSearchView> {
class SeSearchView extends StatefulWidget {
const SeSearchView({super.key,
this.onClickSearch,
required this.controller,
this.focusNode,
});
final Function(String)? onClickSearch;
final TextEditingController controller;
final FocusNode? focusNode;
@override
State<StatefulWidget> createState() {
@@ -106,7 +110,12 @@ class SeSearchView extends StatefulWidget {
class _SeSearchViewState extends State<SeSearchView> {
final _searchController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
@@ -123,8 +132,8 @@ class _SeSearchViewState extends State<SeSearchView> {
Icon(Icons.search, color: Colors.white, size: 24),
Expanded(child: CupertinoTextField(
controller: _searchController,
// focusNode: widget.focusNode,
controller: widget.controller,
focusNode: widget.focusNode,
decoration: BoxDecoration(),
placeholder: 'What are...... ',
placeholderStyle: TextStyle(
@@ -137,8 +146,8 @@ class _SeSearchViewState extends State<SeSearchView> {
),
textInputAction: TextInputAction.search,
onEditingComplete: () {
if (_searchController.text.trim().isNotEmpty) {
widget.onClickSearch?.call(_searchController.text);
if (widget.controller.text.trim().isNotEmpty) {
widget.onClickSearch?.call(widget.controller.text);
}
},
),),
@@ -146,8 +155,8 @@ class _SeSearchViewState extends State<SeSearchView> {
HelpImage.asset(ConstImage.homeSearch,
width: 78, height: 36, fit: BoxFit.fill
).addInkWell(onTap: () {
if (_searchController.text.trim().isNotEmpty) {
widget.onClickSearch?.call(_searchController.text);
if (widget.controller.text.trim().isNotEmpty) {
widget.onClickSearch?.call(widget.controller.text);
}
})