Merge branch 'android-no-pay'

# Conflicts:
#	lib/kt_pages/kt_short_video/logic.dart
This commit is contained in:
zengyi 2025-09-23 16:45:14 +08:00
commit f22c893932
6 changed files with 276 additions and 287 deletions

View File

@ -3,10 +3,12 @@ import 'package:flutter/services.dart';
import 'package:flutter_kinetra/kt_pages/kt_actor/kt_actor_page.dart'; import 'package:flutter_kinetra/kt_pages/kt_actor/kt_actor_page.dart';
import 'package:flutter_kinetra/kt_utils/kt_string_extend.dart'; import 'package:flutter_kinetra/kt_utils/kt_string_extend.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../kt_explore/view.dart'; import '../kt_explore/view.dart';
import '../kt_home/view.dart'; import '../kt_home/view.dart';
import '../kt_mine/view.dart'; import '../kt_mine/view.dart';
import '../kt_my_list/logic.dart';
import '../kt_my_list/view.dart'; import '../kt_my_list/view.dart';
class KtMainPage extends StatefulWidget { class KtMainPage extends StatefulWidget {
@ -103,13 +105,8 @@ class _KtMainPageState extends State<KtMainPage>
onTap: (index) { onTap: (index) {
_currentIndex = index; _currentIndex = index;
_controller.jumpToPage(index); _controller.jumpToPage(index);
// final recommendLogic = Get.put(RecommendLogic()); final myListLogic = Get.put(MyListLogic());
// if (index != 1) { myListLogic.initData();
// recommendLogic.videoCtrl?.pause();
// } else {
// recommendLogic.videoCtrl?.play();
// }
// recommendLogic.update();
}, },
items: [ items: [
..._tabsTitle.map( ..._tabsTitle.map(

View File

@ -125,25 +125,7 @@ class MyListLogic extends GetxController {
"video_id": video.shortPlayVideoId, "video_id": video.shortPlayVideoId,
}; };
if (video.isCollect == 1) { if (video.isCollect == 1) {
Get.dialog( cancelCollect(video.shortPlayId!);
KtDialog(
title: 'Remove from your list?',
subTitle: 'This drama will be removed from your saved list.',
rightBtnText: 'Remove',
rightBtnIcon: 'ic_dialog_delete.png',
rightBtnFunc: () async {
ApiResponse res = await KtHttpClient().request(
KtApis.deleteFavoriteVideo,
data: params,
);
if (res.success) {
video.isCollect = 0;
getCollectList(refresh: true);
update();
}
},
),
);
} else { } else {
ApiResponse res = await KtHttpClient().request( ApiResponse res = await KtHttpClient().request(
KtApis.collectVideo, KtApis.collectVideo,
@ -170,7 +152,7 @@ class MyListLogic extends GetxController {
queryParameters: {'short_play_id': id}, queryParameters: {'short_play_id': id},
); );
if (res.success) { if (res.success) {
state.favoriteList.removeWhere((item) => id == item.shortPlayId); // state.favoriteList.removeWhere((item) => id == item.shortPlayId);
state.chestList.removeWhere((item) => id == item.shortPlayId); state.chestList.removeWhere((item) => id == item.shortPlayId);
state.historyList state.historyList
.firstWhereOrNull((item) => id == item.shortPlayId) .firstWhereOrNull((item) => id == item.shortPlayId)

View File

@ -26,7 +26,7 @@ class _KtMyListPageState extends State<KtMyListPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<MyListLogic>( return GetBuilder<MyListLogic>(
builder: (ctrl) { builder: (ctrl) {
if (state.loadStatus == KtLoadStatusType.loading) return Container(); // if (state.loadStatus == KtLoadStatusType.loading) return Center(child: CircularProgressIndicator());
return Container( return Container(
width: ScreenUtil().screenWidth, width: ScreenUtil().screenWidth,
height: ScreenUtil().screenHeight, height: ScreenUtil().screenHeight,
@ -39,286 +39,286 @@ class _KtMyListPageState extends State<KtMyListPage> {
), ),
child: state.chestList.isEmpty && state.historyList.isEmpty child: state.chestList.isEmpty && state.historyList.isEmpty
? KtStatusWidget( ? KtStatusWidget(
type: KtErrorStatusType.nothingYet, type: KtErrorStatusType.nothingYet,
onPressed: logic.initData, onPressed: logic.initData,
) )
: SmartRefresher( : SmartRefresher(
controller: logic.refreshCtrl, controller: logic.refreshCtrl,
enablePullUp: true, enablePullUp: true,
enablePullDown: true, enablePullDown: true,
onRefresh: () => logic.initData(), onRefresh: () => logic.initData(),
onLoading: () => logic.getHistoryList(loadMore: true), onLoading: () => logic.getHistoryList(loadMore: true),
child: Column( child: Column(
children: [ children: [
if (state.chestList.isNotEmpty) if (state.chestList.isNotEmpty)
Container( Container(
width: ScreenUtil().screenWidth - 30.w, width: ScreenUtil().screenWidth - 30.w,
padding: EdgeInsets.fromLTRB(6.w, 53.w, 6.w, 6.w), padding: EdgeInsets.fromLTRB(6.w, 53.w, 6.w, 6.w),
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage('collect_bg.png'.ktIcon), image: AssetImage('collect_bg.png'.ktIcon),
fit: BoxFit.fill, fit: BoxFit.fill,
),
),
child: Column(
children: [
Row(
children: [
SizedBox(width: 6.w),
Text(
'My Treasure Chest',
style: TextStyle(
fontSize: 18.sp,
color: Colors.white,
fontWeight: FontWeight.w800,
fontStyle: FontStyle.italic,
),
), ),
), const Spacer(),
child: Column( GestureDetector(
children: [ onTap: () => Get.to(KtMyChestPage()),
Row( child: Row(
children: [ children: [
SizedBox(width: 6.w),
Text( Text(
'My Treasure Chest', 'View All',
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 12.sp,
color: Colors.white, color: Color(0xFFD6D6D6),
fontWeight: FontWeight.w800,
fontStyle: FontStyle.italic,
), ),
), ),
const Spacer(), Image.asset(
GestureDetector( 'ic_right_white.png'.ktIcon,
onTap: () => Get.to(KtMyChestPage()), width: 10.w,
child: Row(
children: [
Text(
'View All',
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFFD6D6D6),
),
),
Image.asset(
'ic_right_white.png'.ktIcon,
width: 10.w,
),
SizedBox(width: 6.w),
],
),
), ),
SizedBox(width: 6.w),
], ],
), ),
SizedBox(height: 15.w), ),
Container( ],
height: 145.w,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14.w),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
...state.chestList.map(
(video) => Container(
margin: EdgeInsets.symmetric(
horizontal: 5.w,
),
child: Stack(
children: [
GestureDetector(
onTap: () => Get.toNamed(
KtRoutes.shortVideo,
arguments: {
'shortPlayId':
video.shortPlayId,
'imageUrl':
video.imageUrl ?? '',
},
),
child: KtNetworkImage(
imageUrl: video.imageUrl ?? '',
width: 100.w,
height: 133.w,
borderRadius:
BorderRadius.circular(6.w),
),
),
Positioned(
right: 4.w,
top: 4.w,
child: GestureDetector(
onTap: () =>
logic.cancelCollect(
video.shortPlayId!,
),
child: Image.asset(
'ic_collect_sel.png'.ktIcon,
width: 28.w,
),
),
),
],
),
),
),
],
),
),
],
),
), ),
SizedBox(height: 15.w), SizedBox(height: 15.w),
Expanded( Container(
child: Container( height: 145.w,
width: ScreenUtil().screenWidth,
padding: EdgeInsets.all(15.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.circular(14.w),
top: Radius.circular(20.w),
),
), ),
child: Column( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( ...state.chestList.map(
'Continue Watching', (video) => Container(
style: TextStyle( margin: EdgeInsets.symmetric(
fontSize: 18.sp, horizontal: 5.w,
color: Color(0xFF1E1E20), ),
fontWeight: FontWeight.w800, child: Stack(
fontStyle: FontStyle.italic, children: [
), GestureDetector(
), onTap: () => Get.toNamed(
Expanded( KtRoutes.shortVideo,
child: ListView.separated( arguments: {
padding: EdgeInsets.only(top: 10.w), 'shortPlayId':
// shrinkWrap: true, video.shortPlayId,
// physics: NeverScrollableScrollPhysics(), 'imageUrl':
itemBuilder: (context, index) { video.imageUrl ?? '',
KtHistoryVideoBean video = },
state.historyList[index]; ),
return GestureDetector( child: KtNetworkImage(
onTap: () => Get.toNamed( imageUrl: video.imageUrl ?? '',
KtRoutes.shortVideo, width: 100.w,
arguments: { height: 133.w,
'shortPlayId': video.shortPlayId, borderRadius:
'imageUrl': video.imageUrl ?? '', BorderRadius.circular(6.w),
},
),
child: Container(
color: Colors.transparent,
child: Row(
children: [
KtNetworkImage(
imageUrl: video.imageUrl ?? '',
width: 74.w,
height: 98.w,
borderRadius:
BorderRadius.circular(8.w),
),
SizedBox(width: 13.w),
SizedBox(
width: 200.w,
height: 98.w,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
video.name ?? '',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13.sp,
color: Color(0xFF1E1E20),
fontWeight:
FontWeight.w500,
),
),
SizedBox(height: 6.w),
Text(
video.category?.first ?? '',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF79C900),
fontWeight:
FontWeight.w400,
),
),
SizedBox(height: 20.w),
Row(
children: [
SizedBox(
width: 26.w,
height: 26.w,
child: CircularProgressIndicator(
value:
(video.currentEpisode ??
0) /
(video.episodeTotal! >
0
? video
.episodeTotal!
: 1),
backgroundColor:
Color(0xFFD9D9D9),
valueColor:
AlwaysStoppedAnimation<
Color
>(
Color(
0xFFA7F62F,
),
),
strokeWidth: 3.w,
),
),
SizedBox(width: 5.w),
Text(
"${((video.currentEpisode ?? 0) / (video.episodeTotal! > 0 ? video.episodeTotal! : 1) * 100).toStringAsFixed(0)}%",
style: TextStyle(
fontSize: 12.sp,
color: Color(
0xFF1E1E20,
),
fontWeight:
FontWeight.w400,
),
),
],
),
],
),
),
const Spacer(),
GestureDetector(
onTap: () =>
logic.likeVideo(video),
child: Column(
children: [
Image.asset(
video.isCollect == 1
? 'ic_collect_sel.png'
.ktIcon
: 'ic_collect_unsel.png'
.ktIcon,
width: 32.w,
),
],
),
),
],
), ),
), ),
); Positioned(
}, right: 4.w,
separatorBuilder: (_, __) => top: 4.w,
SizedBox(height: 12.w), child: GestureDetector(
itemCount: state.historyList.length, onTap: () =>
logic.cancelCollect(
video.shortPlayId!,
),
child: Image.asset(
'ic_collect_sel.png'.ktIcon,
width: 28.w,
),
),
),
],
),
), ),
), ),
], ],
), ),
), ),
],
),
),
SizedBox(height: 15.w),
Expanded(
child: Container(
width: ScreenUtil().screenWidth,
padding: EdgeInsets.all(15.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
top: Radius.circular(20.w),
), ),
], ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Continue Watching',
style: TextStyle(
fontSize: 18.sp,
color: Color(0xFF1E1E20),
fontWeight: FontWeight.w800,
fontStyle: FontStyle.italic,
),
),
Expanded(
child: ListView.separated(
padding: EdgeInsets.only(top: 10.w),
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
KtHistoryVideoBean video =
state.historyList[index];
return GestureDetector(
onTap: () => Get.toNamed(
KtRoutes.shortVideo,
arguments: {
'shortPlayId': video.shortPlayId,
'imageUrl': video.imageUrl ?? '',
},
),
child: Container(
color: Colors.transparent,
child: Row(
children: [
KtNetworkImage(
imageUrl: video.imageUrl ?? '',
width: 74.w,
height: 98.w,
borderRadius:
BorderRadius.circular(8.w),
),
SizedBox(width: 13.w),
SizedBox(
width: 200.w,
height: 98.w,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
video.name ?? '',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13.sp,
color: Color(0xFF1E1E20),
fontWeight:
FontWeight.w500,
),
),
SizedBox(height: 6.w),
Text(
video.category?.first ?? '',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF79C900),
fontWeight:
FontWeight.w400,
),
),
SizedBox(height: 20.w),
Row(
children: [
SizedBox(
width: 26.w,
height: 26.w,
child: CircularProgressIndicator(
value:
(video.currentEpisode ??
0) /
(video.episodeTotal! >
0
? video
.episodeTotal!
: 1),
backgroundColor:
Color(0xFFD9D9D9),
valueColor:
AlwaysStoppedAnimation<
Color
>(
Color(
0xFFA7F62F,
),
),
strokeWidth: 3.w,
),
),
SizedBox(width: 5.w),
Text(
"${((video.currentEpisode ?? 0) / (video.episodeTotal! > 0 ? video.episodeTotal! : 1) * 100).toStringAsFixed(0)}%",
style: TextStyle(
fontSize: 12.sp,
color: Color(
0xFF1E1E20,
),
fontWeight:
FontWeight.w400,
),
),
],
),
],
),
),
const Spacer(),
GestureDetector(
onTap: () =>
logic.likeVideo(video),
child: Column(
children: [
Image.asset(
video.isCollect == 1
? 'ic_collect_sel.png'
.ktIcon
: 'ic_collect_unsel.png'
.ktIcon,
width: 32.w,
),
],
),
),
],
),
),
);
},
separatorBuilder: (_, __) =>
SizedBox(height: 12.w),
itemCount: state.historyList.length,
),
),
],
),
), ),
), ),
],
),
),
); );
}, },
); );

View File

@ -1,4 +1,6 @@
import 'package:easy_debounce/easy_throttle.dart'; import 'package:easy_debounce/easy_throttle.dart';
import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_kinetra/kt_pages/kt_mine/logic.dart'; import 'package:flutter_kinetra/kt_pages/kt_mine/logic.dart';
@ -12,6 +14,7 @@ import 'package:video_player/video_player.dart';
import '../../dio_cilent/kt_apis.dart'; import '../../dio_cilent/kt_apis.dart';
import '../../dio_cilent/kt_request.dart'; import '../../dio_cilent/kt_request.dart';
import '../../kt_model/kt_video_detail_bean.dart'; import '../../kt_model/kt_video_detail_bean.dart';
import '../../kt_utils/kt_device_info_utils.dart';
import '../../kt_widgets/kt_status_widget.dart'; import '../../kt_widgets/kt_status_widget.dart';
import '../../kt_widgets/kt_store_widget.dart'; import '../../kt_widgets/kt_store_widget.dart';
import '../kt_mine/kt_store/logic.dart'; import '../kt_mine/kt_store/logic.dart';
@ -222,10 +225,17 @@ class VideoPlayLogic extends GetxController {
if (controllers[index] != null) return; if (controllers[index] != null) return;
final episode = state.episodeList[index]; final episode = state.episodeList[index];
final controller = VideoPlayerController.networkUrl( VideoPlayerController controller =
Uri.parse(episode.videoUrl!), Platform.isAndroid && KtDeviceInfoUtil().osVersion == '10'
formatHint: VideoFormat.hls, ? VideoPlayerController.networkUrl(
); Uri.parse(episode.videoUrl!),
formatHint: VideoFormat.hls,
viewType: VideoViewType.platformView,
)
: VideoPlayerController.networkUrl(
Uri.parse(episode.videoUrl!),
formatHint: VideoFormat.hls,
);
controllers[index] = controller; controllers[index] = controller;