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 {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||||
id("dev.flutter.flutter-gradle-plugin")
|
id("dev.flutter.flutter-gradle-plugin")
|
||||||
}
|
}
|
||||||
|
val signingProperties =
|
||||||
|
project.rootProject.file("key.properties").takeIf { it.exists() }
|
||||||
|
?.reader()
|
||||||
|
?.use { Properties().apply { load(it) } }
|
||||||
|
?: Properties()
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.kinetra.adehok.app"
|
namespace = "com.kinetra.adehok.app"
|
||||||
@ -29,13 +36,44 @@ android {
|
|||||||
targetSdk = flutter.targetSdkVersion
|
targetSdk = flutter.targetSdkVersion
|
||||||
versionCode = flutter.versionCode
|
versionCode = flutter.versionCode
|
||||||
versionName = flutter.versionName
|
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 {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
// TODO: Add your own signing config for the release build.
|
isMinifyEnabled = true
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
isShrinkResources = true
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
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: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,7 +9,9 @@ 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';
|
||||||
|
import '../kt_main_page/view.dart';
|
||||||
|
|
||||||
class KtExploreLogic extends GetxController {
|
class KtExploreLogic extends GetxController {
|
||||||
final state = KtExploreState();
|
final state = KtExploreState();
|
||||||
@ -145,7 +149,14 @@ 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 =
|
||||||
|
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!),
|
Uri.parse(episode.videoInfo!.videoUrl!),
|
||||||
formatHint: VideoFormat.hls,
|
formatHint: VideoFormat.hls,
|
||||||
);
|
);
|
||||||
@ -155,7 +166,8 @@ class KtExploreLogic extends GetxController {
|
|||||||
try {
|
try {
|
||||||
await controller.initialize();
|
await controller.initialize();
|
||||||
if (index == state.currentPage) {
|
if (index == state.currentPage) {
|
||||||
controller.play();
|
final mainLogic = Get.find<KtMainLogic>();
|
||||||
|
if(mainLogic.curIndex == 1) controller.play();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
controller.addListener(() {
|
controller.addListener(() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:easy_refresh/easy_refresh.dart';
|
import 'package:easy_refresh/easy_refresh.dart';
|
||||||
import 'package:flutter/material.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_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 'package:get/get.dart';
|
||||||
@ -28,6 +29,7 @@ class _KtExplorePageState extends State<KtExplorePage>
|
|||||||
super.build(context);
|
super.build(context);
|
||||||
return GetBuilder<KtExploreLogic>(
|
return GetBuilder<KtExploreLogic>(
|
||||||
builder: (ctrl) {
|
builder: (ctrl) {
|
||||||
|
if (Get.find<KtMainLogic>().curIndex != 1) return Container();
|
||||||
if (state.loadStatus == KtLoadStatusType.loadNoData ||
|
if (state.loadStatus == KtLoadStatusType.loadNoData ||
|
||||||
state.loadStatus == KtLoadStatusType.loadFailed) {
|
state.loadStatus == KtLoadStatusType.loadFailed) {
|
||||||
return KtStatusWidget(
|
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(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
@ -261,6 +277,7 @@ class _KtExplorePageState extends State<KtExplorePage>
|
|||||||
child: Image.asset('ic_play.png'.ktIcon, width: 62.w),
|
child: Image.asset('ic_play.png'.ktIcon, width: 62.w),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:easy_refresh/easy_refresh.dart';
|
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_model/kt_home_category_bean.dart';
|
||||||
import 'package:flutter_kinetra/kt_pages/kt_home/state.dart';
|
import 'package:flutter_kinetra/kt_pages/kt_home/state.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -133,6 +134,7 @@ class KtHomeLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCategoryVideoList({bool isRefresh = false}) async {
|
getCategoryVideoList({bool isRefresh = false}) async {
|
||||||
|
state.categoryLoadStatus = KtLoadStatusType.loading;
|
||||||
if (isRefresh) {
|
if (isRefresh) {
|
||||||
state.pageIndex = 1;
|
state.pageIndex = 1;
|
||||||
state.categoryVideoList.clear();
|
state.categoryVideoList.clear();
|
||||||
@ -154,6 +156,7 @@ class KtHomeLogic extends GetxController {
|
|||||||
easyRefreshController.finishRefresh();
|
easyRefreshController.finishRefresh();
|
||||||
easyRefreshController.finishLoad();
|
easyRefreshController.finishLoad();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
state.categoryLoadStatus = KtLoadStatusType.loadSuccess;
|
||||||
List<KtShortVideoBean> list = [
|
List<KtShortVideoBean> list = [
|
||||||
...res.data['list']
|
...res.data['list']
|
||||||
.map(
|
.map(
|
||||||
@ -165,6 +168,13 @@ class KtHomeLogic extends GetxController {
|
|||||||
easyRefreshController.finishLoad(IndicatorResult.noMore);
|
easyRefreshController.finishLoad(IndicatorResult.noMore);
|
||||||
}
|
}
|
||||||
state.categoryVideoList.addAll(list);
|
state.categoryVideoList.addAll(list);
|
||||||
|
if (state.categoryVideoList.isEmpty) {
|
||||||
|
state.categoryLoadStatus = KtLoadStatusType.loadNoData;
|
||||||
|
}
|
||||||
|
|
||||||
|
update();
|
||||||
|
} else {
|
||||||
|
state.categoryLoadStatus = KtLoadStatusType.loadFailed;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import '../../kt_widgets/kt_status_widget.dart';
|
|||||||
|
|
||||||
class KtHomeState {
|
class KtHomeState {
|
||||||
KtLoadStatusType loadStatus = KtLoadStatusType.loading;
|
KtLoadStatusType loadStatus = KtLoadStatusType.loading;
|
||||||
|
KtLoadStatusType categoryLoadStatus = KtLoadStatusType.loading;
|
||||||
List<KtShortVideoBean> topPickList = [];
|
List<KtShortVideoBean> topPickList = [];
|
||||||
List<KtShortVideoBean> hotList = [];
|
List<KtShortVideoBean> hotList = [];
|
||||||
List<KtShortVideoBean> arrivalList = [];
|
List<KtShortVideoBean> arrivalList = [];
|
||||||
|
@ -19,10 +19,11 @@ class KtHomePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _KtHomePageState extends State<KtHomePage>
|
class _KtHomePageState extends State<KtHomePage>
|
||||||
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||||
final logic = Get.put(KtHomeLogic());
|
final logic = Get.put(KtHomeLogic());
|
||||||
final state = Get.find<KtHomeLogic>().state;
|
final state = Get.find<KtHomeLogic>().state;
|
||||||
late TabController tabCtrl;
|
late TabController tabCtrl;
|
||||||
|
TabController? categoryTabCtrl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -95,7 +96,7 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
child: Text(
|
child: Text(
|
||||||
'Get Hooked in Seconds',
|
'Get Hooked in Seconds',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12.sp,
|
fontSize: 11.sp,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -132,7 +133,9 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
GestureDetector(
|
||||||
|
onTap: () => Get.toNamed(KtRoutes.search),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Stack(
|
Stack(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
@ -151,6 +154,7 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
Image.asset('ic_right.png'.ktIcon, width: 10.w),
|
Image.asset('ic_right.png'.ktIcon, width: 10.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
SizedBox(height: 5.w),
|
SizedBox(height: 5.w),
|
||||||
Text(
|
Text(
|
||||||
'Everyone\'s Watching',
|
'Everyone\'s Watching',
|
||||||
@ -162,7 +166,7 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 17.w),
|
SizedBox(width: 15.w),
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -180,7 +184,7 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Image.asset('ic_star.png'.ktIcon, width: 14.w),
|
Image.asset('ic_star.png'.ktIcon, width: 14.w),
|
||||||
SizedBox(width: 4.w),
|
SizedBox(width: 3.w),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 162.w,
|
width: 162.w,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -253,7 +257,7 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
SizedBox(width: 4.w),
|
SizedBox(width: 4.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 9.w),
|
SizedBox(height: 8.w),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 117.w,
|
height: 117.w,
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
@ -532,9 +536,10 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
KtHomeCategoryBean item = state.categoryList[index];
|
KtHomeCategoryBean item = state.categoryList[index];
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
if (state.selCategoryId == item.categoryId!) return;
|
||||||
state.selCategoryId = item.categoryId!;
|
state.selCategoryId = item.categoryId!;
|
||||||
|
categoryTabCtrl?.animateTo(state.categoryList.indexOf(item));
|
||||||
logic.getCategoryVideoList(isRefresh: true);
|
logic.getCategoryVideoList(isRefresh: true);
|
||||||
logic.update(['category-items']);
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: (ScreenUtil().screenWidth - 42.w) / 3,
|
width: (ScreenUtil().screenWidth - 42.w) / 3,
|
||||||
@ -550,8 +555,13 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: ((ScreenUtil().screenWidth - 42.w) / 3) - 4.w,
|
||||||
child: Text(
|
child: Text(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
item.categoryName ?? '',
|
item.categoryName ?? '',
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.sp,
|
fontSize: 14.sp,
|
||||||
color: Color(0xFF1E1E20),
|
color: Color(0xFF1E1E20),
|
||||||
@ -561,6 +571,7 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (_, __) => SizedBox(width: 6.w),
|
separatorBuilder: (_, __) => SizedBox(width: 6.w),
|
||||||
@ -583,7 +594,21 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
// return [hotRisingView(), topChartView(), freshDropView()][state.typeList
|
// return [hotRisingView(), topChartView(), freshDropView()][state.typeList
|
||||||
// .indexOf(state.selType)];
|
// .indexOf(state.selType)];
|
||||||
} else {
|
} 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,8 +1036,7 @@ 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(),
|
||||||
@ -1151,7 +1175,6 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
},
|
},
|
||||||
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>(
|
return GetBuilder<KtHomeLogic>(
|
||||||
id: 'category-list',
|
id: 'category-list',
|
||||||
|
key: ValueKey('category-$index'),
|
||||||
builder: (ctrl) {
|
builder: (ctrl) {
|
||||||
if (state.categoryVideoList.isEmpty) {
|
if (state.categoryLoadStatus == KtLoadStatusType.loadNoData) {
|
||||||
return KtStatusWidget(
|
return KtStatusWidget(
|
||||||
type: KtErrorStatusType.nothingYet,
|
type: KtErrorStatusType.nothingYet,
|
||||||
onPressed: logic.getCategoryVideoList,
|
onPressed: logic.getCategoryVideoList,
|
||||||
@ -1541,6 +1565,7 @@ class _KtHomePageState extends State<KtHomePage>
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
tabCtrl.dispose();
|
tabCtrl.dispose();
|
||||||
|
categoryTabCtrl?.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.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_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_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 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../kt_utils/kt_keys.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';
|
||||||
@ -21,11 +21,12 @@ class KtMainPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _KtMainPageState extends State<KtMainPage>
|
class _KtMainPageState extends State<KtMainPage>
|
||||||
with RouteAware, WidgetsBindingObserver {
|
with RouteAware, WidgetsBindingObserver {
|
||||||
|
final logic = Get.put(KtMainLogic());
|
||||||
final PageController _controller = PageController();
|
final PageController _controller = PageController();
|
||||||
static const List _tabsTitle = [
|
static const List _tabsTitle = [
|
||||||
{'icon': 'home', 'title': 'Home'},
|
{'icon': 'home', 'title': 'Home'},
|
||||||
{'icon': 'explore', 'title': 'Explore'},
|
{'icon': 'explore', 'title': 'Explore'},
|
||||||
{'icon': 'actor', 'title': 'Actor'},
|
{'icon': 'actor', 'title': 'Actors'},
|
||||||
{'icon': 'favorite', 'title': 'My List'},
|
{'icon': 'favorite', 'title': 'My List'},
|
||||||
{'icon': 'mine', 'title': 'Profile'},
|
{'icon': 'mine', 'title': 'Profile'},
|
||||||
];
|
];
|
||||||
@ -79,12 +80,15 @@ class _KtMainPageState extends State<KtMainPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: GetBuilder<KtMainLogic>(
|
||||||
|
builder: (ctrl) {
|
||||||
|
return Scaffold(
|
||||||
body: PageView.builder(
|
body: PageView.builder(
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
onPageChanged: (index) {
|
onPageChanged: (index) {
|
||||||
_currentIndex = index;
|
_currentIndex = index;
|
||||||
|
logic.curIndex = index;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
itemBuilder: (context, index) => _getTab(index),
|
itemBuilder: (context, index) => _getTab(index),
|
||||||
@ -105,9 +109,15 @@ class _KtMainPageState extends State<KtMainPage>
|
|||||||
currentIndex: _currentIndex,
|
currentIndex: _currentIndex,
|
||||||
onTap: (index) {
|
onTap: (index) {
|
||||||
_currentIndex = index;
|
_currentIndex = index;
|
||||||
|
logic.curIndex = index;
|
||||||
_controller.jumpToPage(index);
|
_controller.jumpToPage(index);
|
||||||
|
if (index == 3) {
|
||||||
final myListLogic = Get.put(MyListLogic());
|
final myListLogic = Get.put(MyListLogic());
|
||||||
myListLogic.initData();
|
myListLogic.initData();
|
||||||
|
} else if (index == 1) {
|
||||||
|
final exploreLogic = Get.put(KtExploreLogic());
|
||||||
|
exploreLogic.update();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
items: [
|
items: [
|
||||||
..._tabsTitle.map(
|
..._tabsTitle.map(
|
||||||
@ -134,6 +144,8 @@ class _KtMainPageState extends State<KtMainPage>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -332,3 +344,7 @@ class _KtMainPageState extends State<KtMainPage>
|
|||||||
// EasyThrottle.throttle('restore', Duration(minutes: 5), () => BuyUtils.restorePay(showTips: false));
|
// 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 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -8,6 +9,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:video_player/video_player.dart';
|
import 'package:video_player/video_player.dart';
|
||||||
import 'package:visibility_detector/visibility_detector.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_network_image.dart';
|
||||||
import '../../kt_widgets/kt_status_widget.dart';
|
import '../../kt_widgets/kt_status_widget.dart';
|
||||||
import '../../kt_widgets/kt_video_progress_bar.dart';
|
import '../../kt_widgets/kt_video_progress_bar.dart';
|
||||||
@ -200,7 +202,19 @@ class _VideoPlayPageState extends State<VideoPlayPage>
|
|||||||
if (!isAllOver) Center(child: CircularProgressIndicator()),
|
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)
|
// if (episode.isLock == true)
|
||||||
// Container(
|
// Container(
|
||||||
// width: ScreenUtil().screenWidth,
|
// width: ScreenUtil().screenWidth,
|
||||||
@ -262,18 +276,24 @@ class _VideoPlayPageState extends State<VideoPlayPage>
|
|||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0.w,
|
left: 0.w,
|
||||||
child: Container(
|
child: Platform.isAndroid
|
||||||
|
? SafeArea(child: bottomView(index))
|
||||||
|
: bottomView(index),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget bottomView(int index) {
|
||||||
|
return Container(
|
||||||
width: ScreenUtil().screenWidth,
|
width: ScreenUtil().screenWidth,
|
||||||
padding: EdgeInsets.fromLTRB(15.w, 40.w, 15.w, 40.w),
|
padding: EdgeInsets.fromLTRB(15.w, 40.w, 15.w, 50.w),
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [
|
colors: [Color(0xFF001D1F).withValues(alpha: 0), Color(0xFF001D1F)],
|
||||||
Color(0xFF001D1F).withValues(alpha: 0),
|
|
||||||
Color(0xFF001D1F),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -319,18 +339,12 @@ class _VideoPlayPageState extends State<VideoPlayPage>
|
|||||||
SizedBox(width: 6.w),
|
SizedBox(width: 6.w),
|
||||||
Text(
|
Text(
|
||||||
'EP.${index + 1}',
|
'EP.${index + 1}',
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 13.sp, color: Colors.white),
|
||||||
fontSize: 13.sp,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Text(
|
Text(
|
||||||
'All ${state.video?.shortPlayInfo?.episodeTotal ?? 0} Episodes',
|
'All ${state.video?.shortPlayInfo?.episodeTotal ?? 0} Episodes',
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 13.sp, color: Colors.white),
|
||||||
fontSize: 13.sp,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -358,9 +372,6 @@ class _VideoPlayPageState extends State<VideoPlayPage>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user