From 214dd1225dd9fe974b4d3cc46b971021a5ba517e Mon Sep 17 00:00:00 2001 From: zengyi Date: Wed, 24 Sep 2025 15:43:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:p30=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/kt_pages/kt_explore/view.dart | 17 ++- lib/kt_pages/kt_home/view.dart | 30 ++-- lib/kt_pages/kt_short_video/view.dart | 207 ++++++++++++++------------ 3 files changed, 143 insertions(+), 111 deletions(-) diff --git a/lib/kt_pages/kt_explore/view.dart b/lib/kt_pages/kt_explore/view.dart index 45c9725..a7a9138 100644 --- a/lib/kt_pages/kt_explore/view.dart +++ b/lib/kt_pages/kt_explore/view.dart @@ -29,7 +29,7 @@ class _KtExplorePageState extends State super.build(context); return GetBuilder( builder: (ctrl) { - if(Get.find().curIndex != 1) return Container(); + if (Get.find().curIndex != 1) return Container(); if (state.loadStatus == KtLoadStatusType.loadNoData || state.loadStatus == KtLoadStatusType.loadFailed) { return KtStatusWidget( @@ -174,6 +174,20 @@ class _KtExplorePageState extends State ), ), ), + if (videoPlayerController.value.isInitialized) + GestureDetector( + onTap: () { + videoPlayerController.value.isPlaying + ? videoPlayerController.pause() + : videoPlayerController.play(); + setState(() {}); + }, + child: Container( + width: ScreenUtil().screenWidth, + height: ScreenUtil().screenHeight, + color: Colors.transparent, + ), + ), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end, @@ -263,6 +277,7 @@ class _KtExplorePageState extends State child: Image.asset('ic_play.png'.ktIcon, width: 62.w), ), ), + ], ), ), diff --git a/lib/kt_pages/kt_home/view.dart b/lib/kt_pages/kt_home/view.dart index 9b382f1..dff0739 100644 --- a/lib/kt_pages/kt_home/view.dart +++ b/lib/kt_pages/kt_home/view.dart @@ -96,7 +96,7 @@ class _KtHomePageState extends State child: Text( 'Get Hooked in Seconds', style: TextStyle( - fontSize: 12.sp, + fontSize: 11.sp, fontWeight: FontWeight.w600, fontStyle: FontStyle.italic, color: Colors.white, @@ -166,7 +166,7 @@ class _KtHomePageState extends State ), ], ), - SizedBox(width: 17.w), + SizedBox(width: 15.w), Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -184,7 +184,7 @@ class _KtHomePageState extends State child: Row( children: [ Image.asset('ic_star.png'.ktIcon, width: 14.w), - SizedBox(width: 4.w), + SizedBox(width: 3.w), SizedBox( width: 162.w, child: Text( @@ -257,7 +257,7 @@ class _KtHomePageState extends State SizedBox(width: 4.w), ], ), - SizedBox(height: 9.w), + SizedBox(height: 8.w), SizedBox( height: 117.w, child: ListView.separated( @@ -555,14 +555,20 @@ class _KtHomePageState extends State ) : null, ), - child: Text( - item.categoryName ?? '', - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF1E1E20), - fontWeight: state.selCategoryId == item.categoryId - ? FontWeight.w600 - : FontWeight.w400, + child: SizedBox( + width: ((ScreenUtil().screenWidth - 42.w) / 3) - 4.w, + child: Text( + textAlign: TextAlign.center, + item.categoryName ?? '', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF1E1E20), + fontWeight: state.selCategoryId == item.categoryId + ? FontWeight.w600 + : FontWeight.w400, + ), ), ), ), diff --git a/lib/kt_pages/kt_short_video/view.dart b/lib/kt_pages/kt_short_video/view.dart index 6b9e796..5d6f244 100644 --- a/lib/kt_pages/kt_short_video/view.dart +++ b/lib/kt_pages/kt_short_video/view.dart @@ -1,3 +1,4 @@ +import 'dart:io'; import 'dart:ui'; import 'package:flutter/material.dart'; @@ -8,6 +9,7 @@ import 'package:get/get.dart'; import 'package:video_player/video_player.dart'; import 'package:visibility_detector/visibility_detector.dart'; +import '../../kt_model/kt_video_detail_bean.dart'; import '../../kt_widgets/kt_network_image.dart'; import '../../kt_widgets/kt_status_widget.dart'; import '../../kt_widgets/kt_video_progress_bar.dart'; @@ -200,7 +202,19 @@ class _VideoPlayPageState extends State if (!isAllOver) Center(child: CircularProgressIndicator()), ], ), - + if (controller != null && controller.value.isInitialized && !isAllOver) + GestureDetector( + onTap: () { + // if (episode.isLock == true) return; + controller.value.isPlaying ? controller.pause() : controller.play(); + setState(() {}); + }, + child: Container( + width: ScreenUtil().screenWidth, + height: ScreenUtil().screenHeight, + color: Colors.transparent, + ), + ), // if (episode.isLock == true) // Container( // width: ScreenUtil().screenWidth, @@ -262,108 +276,105 @@ class _VideoPlayPageState extends State Positioned( bottom: 0, left: 0.w, - child: Container( - width: ScreenUtil().screenWidth, - padding: EdgeInsets.fromLTRB(15.w, 40.w, 15.w, 40.w), - alignment: Alignment.bottomCenter, - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xFF001D1F).withValues(alpha: 0), - Color(0xFF001D1F), - ], - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: ScreenUtil().screenWidth - 100.w, - child: Text( - state.video?.shortPlayInfo?.name ?? '', - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 16.sp, - color: Colors.white, - fontWeight: FontWeight.w500, - ), - ), - ), - if (logic.controllers[index] != null) - CustomVideoProgressBar( - controller: logic.controllers[index]!, - width: ScreenUtil().screenWidth, - ), - SizedBox(height: 16.w), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - onTap: showEpSelDialog, - child: Container( - width: 300.w, - padding: EdgeInsets.symmetric( - horizontal: 12.w, - vertical: 9.w, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50.w), - color: Colors.white.withValues(alpha: .1), - ), - child: Row( - children: [ - Image.asset('ic_ep.png'.ktIcon, width: 16.sp), - SizedBox(width: 6.w), - Text( - 'EP.${index + 1}', - style: TextStyle( - fontSize: 13.sp, - color: Colors.white, - ), - ), - const Spacer(), - Text( - 'All ${state.video?.shortPlayInfo?.episodeTotal ?? 0} Episodes', - style: TextStyle( - fontSize: 13.sp, - color: Colors.white, - ), - ), - ], - ), - ), - ), - GetBuilder( - id: 'video-like', - builder: (c) { - return GestureDetector( - onTap: () => logic.likeVideo(), - child: Column( - children: [ - Image.asset( - state.video?.shortPlayInfo?.isCollect == true - ? 'ic_collect_sel.png'.ktIcon - : 'ic_collect_unsel.png'.ktIcon, - width: 32.w, - ), - ], - ), - ); - }, - ), - ], - ), - ], - ), - ), + child: Platform.isAndroid + ? SafeArea(child: bottomView(index)) + : bottomView(index), ), ], ); } + Widget bottomView(int index) { + return Container( + width: ScreenUtil().screenWidth, + padding: EdgeInsets.fromLTRB(15.w, 40.w, 15.w, 50.w), + alignment: Alignment.bottomCenter, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [Color(0xFF001D1F).withValues(alpha: 0), Color(0xFF001D1F)], + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: ScreenUtil().screenWidth - 100.w, + child: Text( + state.video?.shortPlayInfo?.name ?? '', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 16.sp, + color: Colors.white, + fontWeight: FontWeight.w500, + ), + ), + ), + if (logic.controllers[index] != null) + CustomVideoProgressBar( + controller: logic.controllers[index]!, + width: ScreenUtil().screenWidth, + ), + SizedBox(height: 16.w), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + onTap: showEpSelDialog, + child: Container( + width: 300.w, + padding: EdgeInsets.symmetric( + horizontal: 12.w, + vertical: 9.w, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(50.w), + color: Colors.white.withValues(alpha: .1), + ), + child: Row( + children: [ + Image.asset('ic_ep.png'.ktIcon, width: 16.sp), + SizedBox(width: 6.w), + Text( + 'EP.${index + 1}', + style: TextStyle(fontSize: 13.sp, color: Colors.white), + ), + const Spacer(), + Text( + 'All ${state.video?.shortPlayInfo?.episodeTotal ?? 0} Episodes', + style: TextStyle(fontSize: 13.sp, color: Colors.white), + ), + ], + ), + ), + ), + GetBuilder( + id: 'video-like', + builder: (c) { + return GestureDetector( + onTap: () => logic.likeVideo(), + child: Column( + children: [ + Image.asset( + state.video?.shortPlayInfo?.isCollect == true + ? 'ic_collect_sel.png'.ktIcon + : 'ic_collect_unsel.png'.ktIcon, + width: 32.w, + ), + ], + ), + ); + }, + ), + ], + ), + ], + ), + ); + } + showFeatureDialog() { return showModalBottomSheet( context: context,