fix:首页布局问题
This commit is contained in:
parent
3f710173d3
commit
7120208013
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter_kinetra/kt_pages/kt_explore/state.dart';
|
import 'package:flutter_kinetra/kt_pages/kt_explore/state.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:easy_refresh/easy_refresh.dart';
|
import 'package:easy_refresh/easy_refresh.dart';
|
||||||
@ -7,6 +9,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_short_video_bean.dart';
|
import '../../kt_model/kt_short_video_bean.dart';
|
||||||
|
import '../../kt_utils/kt_device_info_utils.dart';
|
||||||
import '../../kt_widgets/kt_status_widget.dart';
|
import '../../kt_widgets/kt_status_widget.dart';
|
||||||
|
|
||||||
class KtExploreLogic extends GetxController {
|
class KtExploreLogic extends GetxController {
|
||||||
@ -145,10 +148,17 @@ class KtExploreLogic extends GetxController {
|
|||||||
if (index < 0 || index >= state.videoList.length) return;
|
if (index < 0 || index >= state.videoList.length) return;
|
||||||
if (state.controllers[index] != null) return;
|
if (state.controllers[index] != null) return;
|
||||||
final episode = state.videoList[index];
|
final episode = state.videoList[index];
|
||||||
final controller = VideoPlayerController.networkUrl(
|
VideoPlayerController controller =
|
||||||
Uri.parse(episode.videoInfo!.videoUrl!),
|
Platform.isAndroid && KtDeviceInfoUtil().osVersion == '10'
|
||||||
formatHint: VideoFormat.hls,
|
? VideoPlayerController.networkUrl(
|
||||||
);
|
Uri.parse(episode.videoInfo!.videoUrl!),
|
||||||
|
formatHint: VideoFormat.hls,
|
||||||
|
viewType: VideoViewType.platformView,
|
||||||
|
)
|
||||||
|
: VideoPlayerController.networkUrl(
|
||||||
|
Uri.parse(episode.videoInfo!.videoUrl!),
|
||||||
|
formatHint: VideoFormat.hls,
|
||||||
|
);
|
||||||
|
|
||||||
state.controllers[index] = controller;
|
state.controllers[index] = controller;
|
||||||
|
|
||||||
|
@ -1030,146 +1030,144 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
),
|
),
|
||||||
SizedBox(height: 10.w),
|
SizedBox(height: 10.w),
|
||||||
if (state.topPickList.length > 3)
|
if (state.topPickList.length > 3)
|
||||||
Expanded(
|
ListView.separated(
|
||||||
child: ListView.separated(
|
padding: EdgeInsets.zero,
|
||||||
padding: EdgeInsets.zero,
|
shrinkWrap: true,
|
||||||
shrinkWrap: true,
|
physics: NeverScrollableScrollPhysics(),
|
||||||
physics: NeverScrollableScrollPhysics(),
|
itemCount: state.topPickList.length - 3,
|
||||||
itemCount: state.topPickList.length - 3,
|
itemBuilder: (BuildContext context, int index) {
|
||||||
itemBuilder: (BuildContext context, int index) {
|
KtShortVideoBean video = state.topPickList[index + 3];
|
||||||
KtShortVideoBean video = state.topPickList[index + 3];
|
return GestureDetector(
|
||||||
return GestureDetector(
|
onTap: () => Get.toNamed(
|
||||||
onTap: () => Get.toNamed(
|
KtRoutes.shortVideo,
|
||||||
KtRoutes.shortVideo,
|
arguments: {
|
||||||
arguments: {
|
'shortPlayId': video.shortPlayId,
|
||||||
'shortPlayId': video.shortPlayId,
|
'imageUrl': video.imageUrl ?? '',
|
||||||
'imageUrl': video.imageUrl ?? '',
|
},
|
||||||
},
|
),
|
||||||
|
child: Container(
|
||||||
|
width: ScreenUtil().screenWidth - 30.w,
|
||||||
|
padding: EdgeInsets.all(10.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFFF5F5F5),
|
||||||
|
borderRadius: BorderRadius.circular(14.w),
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Row(
|
||||||
width: ScreenUtil().screenWidth - 30.w,
|
children: [
|
||||||
padding: EdgeInsets.all(10.w),
|
Stack(
|
||||||
decoration: BoxDecoration(
|
clipBehavior: Clip.none,
|
||||||
color: Color(0xFFF5F5F5),
|
alignment: Alignment.topLeft,
|
||||||
borderRadius: BorderRadius.circular(14.w),
|
children: [
|
||||||
),
|
KtNetworkImage(
|
||||||
child: Row(
|
imageUrl: video.imageUrl ?? '',
|
||||||
children: [
|
width: 100.w,
|
||||||
Stack(
|
height: 127.w,
|
||||||
clipBehavior: Clip.none,
|
borderRadius: BorderRadius.circular(12.w),
|
||||||
alignment: Alignment.topLeft,
|
),
|
||||||
children: [
|
Container(
|
||||||
KtNetworkImage(
|
width: 24.w,
|
||||||
imageUrl: video.imageUrl ?? '',
|
height: 24.w,
|
||||||
width: 100.w,
|
alignment: Alignment.center,
|
||||||
height: 127.w,
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12.w),
|
image: DecorationImage(
|
||||||
|
image: AssetImage('top_other.png'.ktIcon),
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Container(
|
child: Text(
|
||||||
width: 24.w,
|
'${index + 4}',
|
||||||
height: 24.w,
|
style: TextStyle(
|
||||||
alignment: Alignment.center,
|
fontSize: 12.sp,
|
||||||
decoration: BoxDecoration(
|
color: Colors.black,
|
||||||
image: DecorationImage(
|
fontWeight: FontWeight.w800,
|
||||||
image: AssetImage('top_other.png'.ktIcon),
|
fontStyle: FontStyle.italic,
|
||||||
fit: BoxFit.fill,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Text(
|
),
|
||||||
'${index + 4}',
|
),
|
||||||
style: TextStyle(
|
],
|
||||||
fontSize: 12.sp,
|
),
|
||||||
color: Colors.black,
|
SizedBox(width: 12.w),
|
||||||
fontWeight: FontWeight.w800,
|
SizedBox(
|
||||||
fontStyle: FontStyle.italic,
|
width: 200.w,
|
||||||
),
|
height: 127.w,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
video.name ?? '',
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFF1E1E20),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
video.categoryList?.first.name ?? '',
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Color(0xFF79C900),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
video.description ?? '',
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10.sp,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Color(0xFF5E5E5E),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 14.w,
|
||||||
|
vertical: 7.w,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFF1E1E20),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
100,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'ic_top_play.png'.ktIcon,
|
||||||
|
width: 16.w,
|
||||||
|
),
|
||||||
|
SizedBox(width: 4.w),
|
||||||
|
Text(
|
||||||
|
'Play',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFFA7F62F),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 12.w),
|
),
|
||||||
SizedBox(
|
],
|
||||||
width: 200.w,
|
|
||||||
height: 127.w,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
video.name ?? '',
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Color(0xFF1E1E20),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
video.categoryList?.first.name ?? '',
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12.sp,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
color: Color(0xFF79C900),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
video.description ?? '',
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 10.sp,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
color: Color(0xFF5E5E5E),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 14.w,
|
|
||||||
vertical: 7.w,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(0xFF1E1E20),
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
100,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'ic_top_play.png'.ktIcon,
|
|
||||||
width: 16.w,
|
|
||||||
),
|
|
||||||
SizedBox(width: 4.w),
|
|
||||||
Text(
|
|
||||||
'Play',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Color(0xFFA7F62F),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
separatorBuilder: (_, __) => SizedBox(height: 10.w),
|
},
|
||||||
),
|
separatorBuilder: (_, __) => SizedBox(height: 10.w),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user