feat: 播放处理,个人中心,
This commit is contained in:
1 parent
e59ac2177b
commit
4ccea08472
37 files changed
+1425
-115
No files matched your search
@@ -1,6 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/global/client/play_client.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/pages/home/players/page/drama_detail_page.dart';
|
||||
import 'package:skywood/pages/widgets/pixel_widgets.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_app_bar.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
@@ -25,12 +29,24 @@ class _ResultPageState extends State<ResultPage> {
|
||||
List<String> _searchHistory = [];
|
||||
final _searchController = TextEditingController();
|
||||
final _searchFocus = FocusNode();
|
||||
List<SkywoodDrama> _searchResult = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_searchController.text = widget.keyword;
|
||||
_search();
|
||||
}
|
||||
|
||||
void _search() {
|
||||
String keyword = _searchController.text;
|
||||
if (keyword.trim().isEmpty) return;
|
||||
PlayClient.search(keyword: keyword).then((valuer) {
|
||||
setState(() {
|
||||
_searchResult = valuer;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -56,9 +72,14 @@ class _ResultPageState extends State<ResultPage> {
|
||||
),
|
||||
),
|
||||
body: ListView.separated(
|
||||
itemBuilder: (context, index) => ResultItemView(),
|
||||
itemBuilder: (context, index) => ResultItemView(
|
||||
drama: _searchResult[index],
|
||||
onTap: () {
|
||||
HelpNav.to(DramaDetailPage(dramaBean: _searchResult[index]));
|
||||
},
|
||||
),
|
||||
separatorBuilder: (context, index) => SizedBox(height: 12),
|
||||
itemCount: 2
|
||||
itemCount: _searchResult.length
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -66,29 +87,41 @@ class _ResultPageState extends State<ResultPage> {
|
||||
|
||||
class ResultItemView extends StatelessWidget {
|
||||
|
||||
const ResultItemView({super.key});
|
||||
const ResultItemView({super.key,
|
||||
required this.drama,
|
||||
this.onTap
|
||||
});
|
||||
|
||||
final SkywoodDrama drama;
|
||||
final Function()? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String tag = 'Satisfying';
|
||||
if (drama.categoryList!.isNotEmpty) {
|
||||
tag = drama.categoryList![0].name;
|
||||
}
|
||||
return Container(
|
||||
height: 140.h,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
PosterImage(width: 105.w, height: 140.h),
|
||||
HelpImg.networkRadius(drama.imageUrl, width: 105.w, height: 140.h,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SkyText(text: 'Love in the City of Twilight',
|
||||
SkyText(text: drama.name,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: CommonColor.black,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_tagView(),
|
||||
_tagView(tag),
|
||||
const SizedBox(height: 12),
|
||||
SkyText(text: 'Haunted by fading memories, a man navigates a labyrinth of dreams and reality ds dsajkj',
|
||||
SkyText(text: '${drama.description}',
|
||||
fontSize: 11,
|
||||
color: CommonColor.withValue('4D4047'),
|
||||
maxLines: 2,
|
||||
@@ -98,14 +131,14 @@ class ResultItemView extends StatelessWidget {
|
||||
children: [
|
||||
_tipView(true, text: '10.0'),
|
||||
const SizedBox(width: 15),
|
||||
_tipView(false, text: '10.2k'),
|
||||
_tipView(false, text: SkyTimeTool.formatNum(drama.watchTotal, unit: 'k')),
|
||||
],
|
||||
)
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
).addInkWell(onTap: onTap);
|
||||
}
|
||||
|
||||
Widget _tipView(bool isStar, {required String text}) {
|
||||
@@ -119,7 +152,7 @@ class ResultItemView extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _tagView() {
|
||||
Widget _tagView(String tag) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(top: 3, left: 6, right: 6, bottom: 4),
|
||||
decoration: ShapeDecoration(
|
||||
@@ -139,7 +172,7 @@ class ResultItemView extends StatelessWidget {
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(
|
||||
'Satisfying',
|
||||
tag,
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF040408) /* 主题黑 */,
|
||||
fontSize: 10,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/global/client/play_client.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/pages/home/players/page/drama_detail_page.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';
|
||||
@@ -174,39 +175,23 @@ class _MainRootState extends State<SearchPage> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: group.map((drama) {
|
||||
return _TrendingItem(drama: drama);
|
||||
return _TrendingItem(drama: drama, onTap: () {
|
||||
HelpNav.to(DramaDetailPage(dramaBean: 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.drama});
|
||||
const _TrendingItem({required this.drama,
|
||||
this.onTap
|
||||
});
|
||||
|
||||
final SkywoodDrama drama;
|
||||
final Function()? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -261,6 +246,6 @@ class _TrendingItem extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
).addInkWell(onTap: onTap);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user