fix:切换播放问题
This commit is contained in:
parent
7120208013
commit
96d6ef8f75
@ -6,6 +6,11 @@ plugins {
|
||||
// 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"
|
||||
@ -31,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")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ 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();
|
||||
@ -165,7 +166,8 @@ class KtExploreLogic extends GetxController {
|
||||
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,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';
|
||||
|
@ -5,7 +5,6 @@ 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 +20,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,12 +79,15 @@ class _KtMainPageState extends State<KtMainPage>
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
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),
|
||||
@ -105,6 +108,7 @@ class _KtMainPageState extends State<KtMainPage>
|
||||
currentIndex: _currentIndex,
|
||||
onTap: (index) {
|
||||
_currentIndex = index;
|
||||
logic.curIndex = index;
|
||||
_controller.jumpToPage(index);
|
||||
final myListLogic = Get.put(MyListLogic());
|
||||
myListLogic.initData();
|
||||
@ -134,6 +138,8 @@ class _KtMainPageState extends State<KtMainPage>
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -332,3 +338,7 @@ class _KtMainPageState extends State<KtMainPage>
|
||||
// EasyThrottle.throttle('restore', Duration(minutes: 5), () => BuyUtils.restorePay(showTips: false));
|
||||
// }
|
||||
}
|
||||
|
||||
class KtMainLogic extends GetxController{
|
||||
int curIndex = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user