|
|
|
@ -20,6 +20,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
import 'package:flutter/rendering.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
|
|
|
|
import 'package:visibility_detector/visibility_detector.dart'; |
|
|
|
|
|
|
|
|
|
import '../view_widget/location_tips.dart'; |
|
|
|
|
import '../view_widget/no_data_view.dart'; |
|
|
|
@ -47,6 +48,7 @@ class UnionPageState extends State<UnionPage>
|
|
|
|
|
String areaName; |
|
|
|
|
List<GlobalKey> _allKey = []; |
|
|
|
|
bool _isShowLocalTips = false; |
|
|
|
|
double visiblePercentage; |
|
|
|
|
|
|
|
|
|
jumpIndex(jpIndex) { |
|
|
|
|
tabController.index = jpIndex; |
|
|
|
@ -65,6 +67,7 @@ class UnionPageState extends State<UnionPage>
|
|
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state) { |
|
|
|
|
if (state == AppLifecycleState.resumed) { |
|
|
|
|
// 处理应用程序切换回前台的逻辑 |
|
|
|
|
if(visiblePercentage == 1) |
|
|
|
|
permissionSettings(); |
|
|
|
|
} else if (state == AppLifecycleState.paused) { |
|
|
|
|
// 处理应用程序切换到后台的逻辑 |
|
|
|
@ -203,7 +206,14 @@ class UnionPageState extends State<UnionPage>
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
super.build(context); |
|
|
|
|
return GestureDetector( |
|
|
|
|
return VisibilityDetector( |
|
|
|
|
key: Key('my-widget-key'), |
|
|
|
|
onVisibilityChanged: (visibilityInfo) { |
|
|
|
|
visiblePercentage = visibilityInfo.visibleFraction; |
|
|
|
|
if(visiblePercentage == 1) |
|
|
|
|
permissionSettings(); |
|
|
|
|
}, |
|
|
|
|
child: GestureDetector( |
|
|
|
|
behavior: HitTestBehavior.translucent, |
|
|
|
|
onTap: () { |
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); |
|
|
|
@ -337,7 +347,7 @@ class UnionPageState extends State<UnionPage>
|
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget buildSearchItem() { |
|
|
|
|