Compare commits
6 Commits
main
...
android-no
Author | SHA1 | Date | |
---|---|---|---|
214dd1225d | |||
0fac8844dc | |||
96d6ef8f75 | |||
7120208013 | |||
3f710173d3 | |||
f53777f26f |
@ -1,9 +1,16 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
val signingProperties =
|
||||
project.rootProject.file("key.properties").takeIf { it.exists() }
|
||||
?.reader()
|
||||
?.use { Properties().apply { load(it) } }
|
||||
?: Properties()
|
||||
|
||||
android {
|
||||
namespace = "com.kinetra.adehok.app"
|
||||
@ -29,13 +36,44 @@ android {
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
|
||||
ndk {
|
||||
abiFilters.clear()
|
||||
abiFilters.add("armeabi-v7a")
|
||||
abiFilters.add("arm64-v8a")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
storeFile = file(signingProperties["storeFile"].toString())
|
||||
storePassword = signingProperties["storePassword"].toString()
|
||||
keyAlias = signingProperties["keyAlias"].toString()
|
||||
keyPassword = signingProperties["keyPassword"].toString()
|
||||
}
|
||||
}
|
||||
splits {
|
||||
abi {
|
||||
isEnable = false
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
|
||||
// 签名配置
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
|
||||
}
|
||||
debug {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_kinetra/kt_pages/kt_explore/state.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:easy_refresh/easy_refresh.dart';
|
||||
@ -7,7 +9,9 @@ import 'package:video_player/video_player.dart';
|
||||
import '../../dio_cilent/kt_apis.dart';
|
||||
import '../../dio_cilent/kt_request.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_main_page/view.dart';
|
||||
|
||||
class KtExploreLogic extends GetxController {
|
||||
final state = KtExploreState();
|
||||
@ -145,17 +149,25 @@ class KtExploreLogic extends GetxController {
|
||||
if (index < 0 || index >= state.videoList.length) return;
|
||||
if (state.controllers[index] != null) return;
|
||||
final episode = state.videoList[index];
|
||||
final controller = VideoPlayerController.networkUrl(
|
||||
Uri.parse(episode.videoInfo!.videoUrl!),
|
||||
formatHint: VideoFormat.hls,
|
||||
);
|
||||
VideoPlayerController controller =
|
||||
Platform.isAndroid && KtDeviceInfoUtil().osVersion == '10'
|
||||
? 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;
|
||||
|
||||
try {
|
||||
await controller.initialize();
|
||||
if (index == state.currentPage) {
|
||||
controller.play();
|
||||
final mainLogic = Get.find<KtMainLogic>();
|
||||
if(mainLogic.curIndex == 1) controller.play();
|
||||
update();
|
||||
}
|
||||
controller.addListener(() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:easy_refresh/easy_refresh.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_kinetra/kt_pages/kt_main_page/view.dart';
|
||||
import 'package:flutter_kinetra/kt_utils/kt_string_extend.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -28,6 +29,7 @@ class _KtExplorePageState extends State<KtExplorePage>
|
||||
super.build(context);
|
||||
return GetBuilder<KtExploreLogic>(
|
||||
builder: (ctrl) {
|
||||
if (Get.find<KtMainLogic>().curIndex != 1) return Container();
|
||||
if (state.loadStatus == KtLoadStatusType.loadNoData ||
|
||||
state.loadStatus == KtLoadStatusType.loadFailed) {
|
||||
return KtStatusWidget(
|
||||
@ -172,6 +174,20 @@ class _KtExplorePageState extends State<KtExplorePage>
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
@ -261,6 +277,7 @@ class _KtExplorePageState extends State<KtExplorePage>
|
||||
child: Image.asset('ic_play.png'.ktIcon, width: 62.w),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:easy_refresh/easy_refresh.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_kinetra/kt_model/kt_home_category_bean.dart';
|
||||
import 'package:flutter_kinetra/kt_pages/kt_home/state.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -133,6 +134,7 @@ class KtHomeLogic extends GetxController {
|
||||
}
|
||||
|
||||
getCategoryVideoList({bool isRefresh = false}) async {
|
||||
state.categoryLoadStatus = KtLoadStatusType.loading;
|
||||
if (isRefresh) {
|
||||
state.pageIndex = 1;
|
||||
state.categoryVideoList.clear();
|
||||
@ -154,6 +156,7 @@ class KtHomeLogic extends GetxController {
|
||||
easyRefreshController.finishRefresh();
|
||||
easyRefreshController.finishLoad();
|
||||
if (res.success) {
|
||||
state.categoryLoadStatus = KtLoadStatusType.loadSuccess;
|
||||
List<KtShortVideoBean> list = [
|
||||
...res.data['list']
|
||||
.map(
|
||||
@ -165,6 +168,13 @@ class KtHomeLogic extends GetxController {
|
||||
easyRefreshController.finishLoad(IndicatorResult.noMore);
|
||||
}
|
||||
state.categoryVideoList.addAll(list);
|
||||
if (state.categoryVideoList.isEmpty) {
|
||||
state.categoryLoadStatus = KtLoadStatusType.loadNoData;
|
||||
}
|
||||
|
||||
update();
|
||||
} else {
|
||||
state.categoryLoadStatus = KtLoadStatusType.loadFailed;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import '../../kt_widgets/kt_status_widget.dart';
|
||||
|
||||
class KtHomeState {
|
||||
KtLoadStatusType loadStatus = KtLoadStatusType.loading;
|
||||
KtLoadStatusType categoryLoadStatus = KtLoadStatusType.loading;
|
||||
List<KtShortVideoBean> topPickList = [];
|
||||
List<KtShortVideoBean> hotList = [];
|
||||
List<KtShortVideoBean> arrivalList = [];
|
||||
|
@ -19,10 +19,11 @@ class KtHomePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _KtHomePageState extends State<KtHomePage>
|
||||
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||
final logic = Get.put(KtHomeLogic());
|
||||
final state = Get.find<KtHomeLogic>().state;
|
||||
late TabController tabCtrl;
|
||||
TabController? categoryTabCtrl;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -95,7 +96,7 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
child: Text(
|
||||
'Get Hooked in Seconds',
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
fontSize: 11.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Colors.white,
|
||||
@ -132,24 +133,27 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Image.asset('text_bg.png'.ktIcon, height: 17.w),
|
||||
Text(
|
||||
'Trend Cyclone',
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color: Color(0xFF1E1E20),
|
||||
fontWeight: FontWeight.w800,
|
||||
GestureDetector(
|
||||
onTap: () => Get.toNamed(KtRoutes.search),
|
||||
child: Row(
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Image.asset('text_bg.png'.ktIcon, height: 17.w),
|
||||
Text(
|
||||
'Trend Cyclone',
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color: Color(0xFF1E1E20),
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Image.asset('ic_right.png'.ktIcon, width: 10.w),
|
||||
],
|
||||
],
|
||||
),
|
||||
Image.asset('ic_right.png'.ktIcon, width: 10.w),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5.w),
|
||||
Text(
|
||||
@ -162,7 +166,7 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 17.w),
|
||||
SizedBox(width: 15.w),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -180,7 +184,7 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
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(
|
||||
@ -253,7 +257,7 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
SizedBox(width: 4.w),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 9.w),
|
||||
SizedBox(height: 8.w),
|
||||
SizedBox(
|
||||
height: 117.w,
|
||||
child: ListView.separated(
|
||||
@ -532,9 +536,10 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
KtHomeCategoryBean item = state.categoryList[index];
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (state.selCategoryId == item.categoryId!) return;
|
||||
state.selCategoryId = item.categoryId!;
|
||||
categoryTabCtrl?.animateTo(state.categoryList.indexOf(item));
|
||||
logic.getCategoryVideoList(isRefresh: true);
|
||||
logic.update(['category-items']);
|
||||
},
|
||||
child: Container(
|
||||
width: (ScreenUtil().screenWidth - 42.w) / 3,
|
||||
@ -550,14 +555,20 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
)
|
||||
: 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -583,7 +594,21 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
// return [hotRisingView(), topChartView(), freshDropView()][state.typeList
|
||||
// .indexOf(state.selType)];
|
||||
} else {
|
||||
return categoryVideoView();
|
||||
categoryTabCtrl ??= TabController(
|
||||
length: state.categoryList.length,
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
return Expanded(
|
||||
child: TabBarView(
|
||||
controller: categoryTabCtrl,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
children: List.generate(
|
||||
state.categoryList.length,
|
||||
(index) => categoryVideoView(index),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1011,146 +1036,144 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
),
|
||||
SizedBox(height: 10.w),
|
||||
if (state.topPickList.length > 3)
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: state.topPickList.length - 3,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
KtShortVideoBean video = state.topPickList[index + 3];
|
||||
return GestureDetector(
|
||||
onTap: () => Get.toNamed(
|
||||
KtRoutes.shortVideo,
|
||||
arguments: {
|
||||
'shortPlayId': video.shortPlayId,
|
||||
'imageUrl': video.imageUrl ?? '',
|
||||
},
|
||||
ListView.separated(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: state.topPickList.length - 3,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
KtShortVideoBean video = state.topPickList[index + 3];
|
||||
return GestureDetector(
|
||||
onTap: () => Get.toNamed(
|
||||
KtRoutes.shortVideo,
|
||||
arguments: {
|
||||
'shortPlayId': video.shortPlayId,
|
||||
'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(
|
||||
width: ScreenUtil().screenWidth - 30.w,
|
||||
padding: EdgeInsets.all(10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF5F5F5),
|
||||
borderRadius: BorderRadius.circular(14.w),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
KtNetworkImage(
|
||||
imageUrl: video.imageUrl ?? '',
|
||||
width: 100.w,
|
||||
height: 127.w,
|
||||
borderRadius: BorderRadius.circular(12.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
KtNetworkImage(
|
||||
imageUrl: video.imageUrl ?? '',
|
||||
width: 100.w,
|
||||
height: 127.w,
|
||||
borderRadius: BorderRadius.circular(12.w),
|
||||
),
|
||||
Container(
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('top_other.png'.ktIcon),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('top_other.png'.ktIcon),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
child: Text(
|
||||
'${index + 4}',
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
child: Text(
|
||||
'${index + 4}',
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -1438,11 +1461,12 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget categoryVideoView() {
|
||||
Widget categoryVideoView(int index) {
|
||||
return GetBuilder<KtHomeLogic>(
|
||||
id: 'category-list',
|
||||
key: ValueKey('category-$index'),
|
||||
builder: (ctrl) {
|
||||
if (state.categoryVideoList.isEmpty) {
|
||||
if (state.categoryLoadStatus == KtLoadStatusType.loadNoData) {
|
||||
return KtStatusWidget(
|
||||
type: KtErrorStatusType.nothingYet,
|
||||
onPressed: logic.getCategoryVideoList,
|
||||
@ -1541,6 +1565,7 @@ class _KtHomePageState extends State<KtHomePage>
|
||||
@override
|
||||
void dispose() {
|
||||
tabCtrl.dispose();
|
||||
categoryTabCtrl?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_kinetra/kt_pages/kt_actor/kt_actor_page.dart';
|
||||
import 'package:flutter_kinetra/kt_pages/kt_explore/logic.dart';
|
||||
import 'package:flutter_kinetra/kt_utils/kt_string_extend.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../kt_utils/kt_keys.dart';
|
||||
import '../kt_explore/view.dart';
|
||||
import '../kt_home/view.dart';
|
||||
import '../kt_mine/view.dart';
|
||||
@ -21,11 +21,12 @@ class KtMainPage extends StatefulWidget {
|
||||
|
||||
class _KtMainPageState extends State<KtMainPage>
|
||||
with RouteAware, WidgetsBindingObserver {
|
||||
final logic = Get.put(KtMainLogic());
|
||||
final PageController _controller = PageController();
|
||||
static const List _tabsTitle = [
|
||||
{'icon': 'home', 'title': 'Home'},
|
||||
{'icon': 'explore', 'title': 'Explore'},
|
||||
{'icon': 'actor', 'title': 'Actor'},
|
||||
{'icon': 'actor', 'title': 'Actors'},
|
||||
{'icon': 'favorite', 'title': 'My List'},
|
||||
{'icon': 'mine', 'title': 'Profile'},
|
||||
];
|
||||
@ -79,61 +80,72 @@ class _KtMainPageState extends State<KtMainPage>
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
body: PageView.builder(
|
||||
controller: _controller,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
onPageChanged: (index) {
|
||||
_currentIndex = index;
|
||||
setState(() {});
|
||||
},
|
||||
itemBuilder: (context, index) => _getTab(index),
|
||||
itemCount: _tabsTitle.length,
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
selectedItemColor: Color(0xFF1E1E20),
|
||||
selectedLabelStyle: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
color: Color(0xFF95959C),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
type: BottomNavigationBarType.fixed,
|
||||
currentIndex: _currentIndex,
|
||||
onTap: (index) {
|
||||
_currentIndex = index;
|
||||
_controller.jumpToPage(index);
|
||||
final myListLogic = Get.put(MyListLogic());
|
||||
myListLogic.initData();
|
||||
},
|
||||
items: [
|
||||
..._tabsTitle.map(
|
||||
(item) => BottomNavigationBarItem(
|
||||
icon: Container(
|
||||
height: 24.w,
|
||||
margin: EdgeInsets.only(top: 4.w),
|
||||
alignment: Alignment.center,
|
||||
child: Image.asset(
|
||||
'ic_${item['icon']}_unsel.png'.ktIcon,
|
||||
width: 24.w,
|
||||
),
|
||||
),
|
||||
activeIcon: Container(
|
||||
margin: EdgeInsets.only(top: 4.w),
|
||||
child: Image.asset(
|
||||
'ic_${item['icon']}_sel.png'.ktIcon,
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
),
|
||||
),
|
||||
label: item['title'],
|
||||
),
|
||||
child: GetBuilder<KtMainLogic>(
|
||||
builder: (ctrl) {
|
||||
return Scaffold(
|
||||
body: PageView.builder(
|
||||
controller: _controller,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
onPageChanged: (index) {
|
||||
_currentIndex = index;
|
||||
logic.curIndex = index;
|
||||
setState(() {});
|
||||
},
|
||||
itemBuilder: (context, index) => _getTab(index),
|
||||
itemCount: _tabsTitle.length,
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
selectedItemColor: Color(0xFF1E1E20),
|
||||
selectedLabelStyle: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: 10.sp,
|
||||
color: Color(0xFF95959C),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
type: BottomNavigationBarType.fixed,
|
||||
currentIndex: _currentIndex,
|
||||
onTap: (index) {
|
||||
_currentIndex = index;
|
||||
logic.curIndex = index;
|
||||
_controller.jumpToPage(index);
|
||||
if (index == 3) {
|
||||
final myListLogic = Get.put(MyListLogic());
|
||||
myListLogic.initData();
|
||||
} else if (index == 1) {
|
||||
final exploreLogic = Get.put(KtExploreLogic());
|
||||
exploreLogic.update();
|
||||
}
|
||||
},
|
||||
items: [
|
||||
..._tabsTitle.map(
|
||||
(item) => BottomNavigationBarItem(
|
||||
icon: Container(
|
||||
height: 24.w,
|
||||
margin: EdgeInsets.only(top: 4.w),
|
||||
alignment: Alignment.center,
|
||||
child: Image.asset(
|
||||
'ic_${item['icon']}_unsel.png'.ktIcon,
|
||||
width: 24.w,
|
||||
),
|
||||
),
|
||||
activeIcon: Container(
|
||||
margin: EdgeInsets.only(top: 4.w),
|
||||
child: Image.asset(
|
||||
'ic_${item['icon']}_sel.png'.ktIcon,
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
),
|
||||
),
|
||||
label: item['title'],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -332,3 +344,7 @@ class _KtMainPageState extends State<KtMainPage>
|
||||
// EasyThrottle.throttle('restore', Duration(minutes: 5), () => BuyUtils.restorePay(showTips: false));
|
||||
// }
|
||||
}
|
||||
|
||||
class KtMainLogic extends GetxController {
|
||||
int curIndex = 0;
|
||||
}
|
||||
|
@ -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<VideoPlayPage>
|
||||
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<VideoPlayPage>
|
||||
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<VideoPlayLogic>(
|
||||
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<VideoPlayLogic>(
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user