fix:首页布局问题
This commit is contained in:
parent
311e4fe06c
commit
ab042840b9
@ -1,3 +1,5 @@
|
|||||||
|
import java.util.Properties
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
|
@ -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,17 +149,25 @@ 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;
|
||||||
|
|
||||||
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(() {
|
||||||
|
@ -11,7 +11,6 @@ import '../../kt_widgets/kt_status_widget.dart';
|
|||||||
|
|
||||||
class KtHomeLogic extends GetxController {
|
class KtHomeLogic extends GetxController {
|
||||||
final state = KtHomeState();
|
final state = KtHomeState();
|
||||||
late TabController categoryTabCtrl;
|
|
||||||
|
|
||||||
final EasyRefreshController easyRefreshController = EasyRefreshController(
|
final EasyRefreshController easyRefreshController = EasyRefreshController(
|
||||||
controlFinishRefresh: true,
|
controlFinishRefresh: true,
|
||||||
|
@ -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),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -20,6 +20,7 @@ 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'},
|
||||||
@ -78,61 +79,67 @@ class _KtMainPageState extends State<KtMainPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: GetBuilder<KtMainLogic>(
|
||||||
body: PageView.builder(
|
builder: (ctrl) {
|
||||||
controller: _controller,
|
return Scaffold(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
body: PageView.builder(
|
||||||
onPageChanged: (index) {
|
controller: _controller,
|
||||||
_currentIndex = index;
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
setState(() {});
|
onPageChanged: (index) {
|
||||||
},
|
_currentIndex = index;
|
||||||
itemBuilder: (context, index) => _getTab(index),
|
logic.curIndex = index;
|
||||||
itemCount: _tabsTitle.length,
|
setState(() {});
|
||||||
),
|
},
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
itemBuilder: (context, index) => _getTab(index),
|
||||||
selectedItemColor: Color(0xFF1E1E20),
|
itemCount: _tabsTitle.length,
|
||||||
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'],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
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);
|
||||||
|
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'],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -164,170 +171,174 @@ class _KtMainPageState extends State<KtMainPage>
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
// @override
|
||||||
// void didChangeAppLifecycleState(AppLifecycleState state) {
|
// void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
// super.didChangeAppLifecycleState(state);
|
// super.didChangeAppLifecycleState(state);
|
||||||
// if (state == AppLifecycleState.paused) {
|
// if (state == AppLifecycleState.paused) {
|
||||||
// _cycleLifeTime = DateTime.now();
|
// _cycleLifeTime = DateTime.now();
|
||||||
// } else if (state == AppLifecycleState.resumed) {
|
// } else if (state == AppLifecycleState.resumed) {
|
||||||
// AppBadgePlus.updateBadge(0);
|
// AppBadgePlus.updateBadge(0);
|
||||||
// final now = DateTime.now();
|
// final now = DateTime.now();
|
||||||
// final duration = now.difference(_cycleLifeTime ?? now);
|
// final duration = now.difference(_cycleLifeTime ?? now);
|
||||||
// if ((duration.inMilliseconds > 3 || _isAndroidTwicePermission) && _pageOpen) {
|
// if ((duration.inMilliseconds > 3 || _isAndroidTwicePermission) && _pageOpen) {
|
||||||
// Future.delayed(const Duration(milliseconds: 1000)).then((_) {
|
// Future.delayed(const Duration(milliseconds: 1000)).then((_) {
|
||||||
// if (mounted) _checkDeeplink();
|
// if (mounted) _checkDeeplink();
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// _cycleLifeTime = null;
|
// _cycleLifeTime = null;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// void _checkDeeplink() {
|
// void _checkDeeplink() {
|
||||||
// EasyThrottle.throttle('check-deeplink', Duration(seconds: 2), () async {
|
// EasyThrottle.throttle('check-deeplink', Duration(seconds: 2), () async {
|
||||||
// try {
|
// try {
|
||||||
// // 获取deepling链接
|
// // 获取deepling链接
|
||||||
// // final adjustProvider = context.read<AdjustProvider>();
|
// // final adjustProvider = context.read<AdjustProvider>();
|
||||||
// final deepLink = AdjustService().deeplink ?? '';
|
// final deepLink = AdjustService().deeplink ?? '';
|
||||||
// debugPrint('[CheckDeeplink] DEEPLINK链接: $deepLink');
|
// debugPrint('[CheckDeeplink] DEEPLINK链接: $deepLink');
|
||||||
// // 使用的原始链接和使用链接
|
// // 使用的原始链接和使用链接
|
||||||
// String useString = '';
|
// String useString = '';
|
||||||
// String useStr = '';
|
// String useStr = '';
|
||||||
// //优先使用直链
|
// //优先使用直链
|
||||||
// if (deepLink != '') {
|
// if (deepLink != '') {
|
||||||
// useString = deepLink;
|
// useString = deepLink;
|
||||||
// useStr = deepLink;
|
// useStr = deepLink;
|
||||||
// // 清空deeplink
|
// // 清空deeplink
|
||||||
// AdjustService().clearDeeplink();
|
// AdjustService().clearDeeplink();
|
||||||
// debugPrint('----清理deeplink:${AdjustService().deeplink}');
|
// debugPrint('----清理deeplink:${AdjustService().deeplink}');
|
||||||
// } else {
|
// } else {
|
||||||
// // 获取剪贴板内容
|
// // 获取剪贴板内容
|
||||||
// final clipboardData = await Clipboard.getData(Clipboard.kTextPlain);
|
// final clipboardData = await Clipboard.getData(Clipboard.kTextPlain);
|
||||||
// final clipboardString = clipboardData?.text ?? '';
|
// final clipboardString = clipboardData?.text ?? '';
|
||||||
// debugPrint('[CheckDeeplink] 剪贴板原始链接: $clipboardString');
|
// debugPrint('[CheckDeeplink] 剪贴板原始链接: $clipboardString');
|
||||||
// // 判断剪贴板内容是否为跳转链接并处理
|
// // 判断剪贴板内容是否为跳转链接并处理
|
||||||
// final clipboardStr =
|
// final clipboardStr =
|
||||||
// clipboardString != '' &&
|
// clipboardString != '' &&
|
||||||
// clipboardString.startsWith(Apis.W2A_PREFIX) &&
|
// clipboardString.startsWith(Apis.W2A_PREFIX) &&
|
||||||
// clipboardString.contains(Apis.W2A_NAME)
|
// clipboardString.contains(Apis.W2A_NAME)
|
||||||
// ? clipboardString.substring(Apis.W2A_PREFIX.length).trim()
|
// ? clipboardString.substring(Apis.W2A_PREFIX.length).trim()
|
||||||
// : '';
|
// : '';
|
||||||
// debugPrint('[CheckDeeplink] 剪贴板处理链接: $clipboardStr');
|
// debugPrint('[CheckDeeplink] 剪贴板处理链接: $clipboardStr');
|
||||||
// useString = clipboardString;
|
// useString = clipboardString;
|
||||||
// useStr = clipboardStr;
|
// useStr = clipboardStr;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // 使用链接
|
// // 使用链接
|
||||||
// if (useStr != '') {
|
// if (useStr != '') {
|
||||||
// final uri = Uri.tryParse(useStr);
|
// final uri = Uri.tryParse(useStr);
|
||||||
// Map<String, dynamic> params = uri!.queryParameters;
|
// Map<String, dynamic> params = uri!.queryParameters;
|
||||||
// // params.forEach((k, v) {
|
// // params.forEach((k, v) {
|
||||||
// // debugPrint('----key:$k value:$v');
|
// // debugPrint('----key:$k value:$v');
|
||||||
// // });
|
// // });
|
||||||
//
|
//
|
||||||
// final shortPlayId = params['short_play_id'];
|
// final shortPlayId = params['short_play_id'];
|
||||||
// final videoId = params['video_id'] ?? 0;
|
// final videoId = params['video_id'] ?? 0;
|
||||||
// if (shortPlayId?.isEmpty ?? false) {
|
// if (shortPlayId?.isEmpty ?? false) {
|
||||||
// debugPrint('[CheckDeeplink] 链接中没有参数');
|
// debugPrint('[CheckDeeplink] 链接中没有参数');
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// // 上报w2a
|
// // 上报w2a
|
||||||
// HttpClient().request(Apis.uploadW2a, data: {"data": useString});
|
// HttpClient().request(Apis.uploadW2a, data: {"data": useString});
|
||||||
// debugPrint('[CheckDeeplink] 跳转链接: $useStr');
|
// debugPrint('[CheckDeeplink] 跳转链接: $useStr');
|
||||||
// debugPrint('[CheckDeeplink] 上报链接: $useString');
|
// debugPrint('[CheckDeeplink] 上报链接: $useString');
|
||||||
// debugPrint('---current route:${Get.currentRoute}');
|
// debugPrint('---current route:${Get.currentRoute}');
|
||||||
// AdjustService().clearDeeplink();
|
// AdjustService().clearDeeplink();
|
||||||
// // 清空剪贴板
|
// // 清空剪贴板
|
||||||
// await Clipboard.setData(const ClipboardData(text: ''));
|
// await Clipboard.setData(const ClipboardData(text: ''));
|
||||||
// if (Get.currentRoute == AppRoutes.shortVideo) {
|
// if (Get.currentRoute == AppRoutes.shortVideo) {
|
||||||
// // Get.offAndToNamed(
|
// // Get.offAndToNamed(
|
||||||
// // AppRoutes.shortVideo,
|
// // AppRoutes.shortVideo,
|
||||||
// // arguments: {'shortPlayId': int.parse(shortPlayId), "videoId": int.parse(videoId)},
|
// // arguments: {'shortPlayId': int.parse(shortPlayId), "videoId": int.parse(videoId)},
|
||||||
// // );
|
// // );
|
||||||
// final logic = Get.put(ShortVideoLogic());
|
// final logic = Get.put(ShortVideoLogic());
|
||||||
// logic.state.shortPlayId = int.parse(shortPlayId);
|
// logic.state.shortPlayId = int.parse(shortPlayId);
|
||||||
// logic.state.videoId = int.parse(videoId);
|
// logic.state.videoId = int.parse(videoId);
|
||||||
// logic.initData();
|
// logic.initData();
|
||||||
// } else {
|
// } else {
|
||||||
// Get.toNamed(
|
// Get.toNamed(
|
||||||
// AppRoutes.shortVideo,
|
// AppRoutes.shortVideo,
|
||||||
// arguments: {'shortPlayId': int.parse(shortPlayId.toString()), "videoId": int.parse(videoId.toString())},
|
// arguments: {'shortPlayId': int.parse(shortPlayId.toString()), "videoId": int.parse(videoId.toString())},
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// } catch (e) {
|
// } catch (e) {
|
||||||
// debugPrint('[AdjustManager] 读取剪贴板异常: $e');
|
// debugPrint('[AdjustManager] 读取剪贴板异常: $e');
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// _initFirebase() async {
|
// _initFirebase() async {
|
||||||
// try {
|
// try {
|
||||||
// await Firebase.initializeApp();
|
// await Firebase.initializeApp();
|
||||||
// } catch (e) {
|
// } catch (e) {
|
||||||
// debugPrint("----initFirebase err: $e");
|
// debugPrint("----initFirebase err: $e");
|
||||||
// }
|
// }
|
||||||
// if (Platform.isIOS) {
|
// if (Platform.isIOS) {
|
||||||
// await FirebaseIOS().initialize();
|
// await FirebaseIOS().initialize();
|
||||||
// } else if (Platform.isAndroid) {
|
// } else if (Platform.isAndroid) {
|
||||||
// await FirebaseAndroid().initialize();
|
// await FirebaseAndroid().initialize();
|
||||||
// await FirebaseAndroid().initializeNotifications();
|
// await FirebaseAndroid().initializeNotifications();
|
||||||
// }
|
// }
|
||||||
// // 获取初始消息(应用通过通知启动)看是否是应用消息启动
|
// // 获取初始消息(应用通过通知启动)看是否是应用消息启动
|
||||||
// if (Platform.isIOS) {
|
// if (Platform.isIOS) {
|
||||||
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
// // 看是否是消息跳进来,然后跳转到详情页面
|
// // 看是否是消息跳进来,然后跳转到详情页面
|
||||||
// RemoteMessage? remoteMessage = await FirebaseMessaging.instance.getInitialMessage();
|
// RemoteMessage? remoteMessage = await FirebaseMessaging.instance.getInitialMessage();
|
||||||
// debugPrint("杀死app启动通知:$remoteMessage");
|
// debugPrint("杀死app启动通知:$remoteMessage");
|
||||||
// if (remoteMessage != null) {
|
// if (remoteMessage != null) {
|
||||||
// final msgData = remoteMessage.data as Map;
|
// final msgData = remoteMessage.data as Map;
|
||||||
// final msgNotification = remoteMessage.notification;
|
// final msgNotification = remoteMessage.notification;
|
||||||
// final String? msgId = msgData['msg_id'];
|
// final String? msgId = msgData['msg_id'];
|
||||||
// final String title = msgNotification?.title ?? "";
|
// final String title = msgNotification?.title ?? "";
|
||||||
// if (msgId != null) {
|
// if (msgId != null) {
|
||||||
// HttpClient().request(Apis.sendMessageReport, data: {"message_id": int.parse(msgId), "title": title});
|
// HttpClient().request(Apis.sendMessageReport, data: {"message_id": int.parse(msgId), "title": title});
|
||||||
// }
|
// }
|
||||||
// FirebaseCommon().onFirebaseRoute(msgData);
|
// FirebaseCommon().onFirebaseRoute(msgData);
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // 检查通知权限
|
// // 检查通知权限
|
||||||
// Future<void> _checkNotificationPermission() async {
|
// Future<void> _checkNotificationPermission() async {
|
||||||
// final permissionStatus = await Permission.notification.status;
|
// final permissionStatus = await Permission.notification.status;
|
||||||
// if (permissionStatus.isDenied) {
|
// if (permissionStatus.isDenied) {
|
||||||
// if (Platform.isAndroid) {
|
// if (Platform.isAndroid) {
|
||||||
// //安卓第二次请求权限,再次查询剪贴板的w2a链接
|
// //安卓第二次请求权限,再次查询剪贴板的w2a链接
|
||||||
// _isAndroidTwicePermission = true;
|
// _isAndroidTwicePermission = true;
|
||||||
// }
|
// }
|
||||||
// //再次请求
|
// //再次请求
|
||||||
// await Permission.notification.request();
|
// await Permission.notification.request();
|
||||||
// } else if (permissionStatus.isPermanentlyDenied) {
|
// } else if (permissionStatus.isPermanentlyDenied) {
|
||||||
// int now = DateTime.now().millisecondsSinceEpoch;
|
// int now = DateTime.now().millisecondsSinceEpoch;
|
||||||
// int lastRequestTime = SpUtils().getInt(SpKeys.notiPermissionTime) ?? now;
|
// int lastRequestTime = SpUtils().getInt(SpKeys.notiPermissionTime) ?? now;
|
||||||
// int hours = DateTime.now().difference(DateTime.fromMillisecondsSinceEpoch(lastRequestTime)).inHours;
|
// int hours = DateTime.now().difference(DateTime.fromMillisecondsSinceEpoch(lastRequestTime)).inHours;
|
||||||
// if (hours < 24) return;
|
// if (hours < 24) return;
|
||||||
// SpUtils().setInt(SpKeys.notiPermissionTime, now);
|
// SpUtils().setInt(SpKeys.notiPermissionTime, now);
|
||||||
// //永久拒绝
|
// //永久拒绝
|
||||||
// Get.dialog(
|
// Get.dialog(
|
||||||
// CommonDialog(
|
// CommonDialog(
|
||||||
// topIconWidget: Positioned(
|
// topIconWidget: Positioned(
|
||||||
// left: -35.w,
|
// left: -35.w,
|
||||||
// top: 0.w,
|
// top: 0.w,
|
||||||
// child: Image.asset('ic_dialog_subscribe.png'.icon, width: 140.w, height: 100.w),
|
// child: Image.asset('ic_dialog_subscribe.png'.icon, width: 140.w, height: 100.w),
|
||||||
// ),
|
// ),
|
||||||
// title: 'Turn on Notifications?',
|
// title: 'Turn on Notifications?',
|
||||||
// subTitle: 'Get alerts for new episodes and exclusive offers.',
|
// subTitle: 'Get alerts for new episodes and exclusive offers.',
|
||||||
// hasLeftBtn: false,
|
// hasLeftBtn: false,
|
||||||
// rightBtnText: 'Allow',
|
// rightBtnText: 'Allow',
|
||||||
// rightBtnFunc: () => openAppSettings(),
|
// rightBtnFunc: () => openAppSettings(),
|
||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// _restore() async {
|
// _restore() async {
|
||||||
// await Get.put(MineLogic()).getUserInfo();
|
// await Get.put(MineLogic()).getUserInfo();
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user