|
@@ -59,7 +59,7 @@ class HomePage extends StatefulWidget { |
|
|
_HomePageState createState() => _HomePageState(); |
|
|
_HomePageState createState() => _HomePageState(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, TickerProviderStateMixin { |
|
|
class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, TickerProviderStateMixin, AutomaticKeepAliveClientMixin { |
|
|
int _currentIndex = 0; |
|
|
int _currentIndex = 0; |
|
|
List<Map<String, dynamic>> _data = List(); |
|
|
List<Map<String, dynamic>> _data = List(); |
|
|
static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER'); |
|
|
static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER'); |
|
@@ -70,7 +70,7 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti |
|
|
StreamSubscription logOutSubscription; |
|
|
StreamSubscription logOutSubscription; |
|
|
StreamSubscription loginSubscription; |
|
|
StreamSubscription loginSubscription; |
|
|
|
|
|
|
|
|
StreamSubscription eventChannelSubscription; |
|
|
StreamSubscription eventChannelSubscription; |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
void initState() { |
|
|
void initState() { |
|
@@ -126,7 +126,7 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti |
|
|
//app后台杀死时候的还原 |
|
|
//app后台杀死时候的还原 |
|
|
Moblink.restoreScene(_restore); |
|
|
Moblink.restoreScene(_restore); |
|
|
// 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) |
|
|
// 监听开始(传递监听到原生端,用户监听场景还原的数据回传回来) |
|
|
eventChannelSubscription= _eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); |
|
|
eventChannelSubscription = _eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError); |
|
|
|
|
|
|
|
|
MobPushUtil.addPushReceiver(); |
|
|
MobPushUtil.addPushReceiver(); |
|
|
aliasSubscription = EventUtil.instance.on<LoginSuccessEvent>().listen((event) async { |
|
|
aliasSubscription = EventUtil.instance.on<LoginSuccessEvent>().listen((event) async { |
|
@@ -153,13 +153,10 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti |
|
|
MobPushUtil.setAlias(masterId + "_" + userInfo.userId); |
|
|
MobPushUtil.setAlias(masterId + "_" + userInfo.userId); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e, s) { |
|
|
} catch (e, s) { |
|
|
print(e); |
|
|
print(e); |
|
|
print(s); |
|
|
print(s); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
initBaseSet() { |
|
|
initBaseSet() { |
|
@@ -194,6 +191,11 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti |
|
|
super.didChangeAppLifecycleState(state); |
|
|
super.didChangeAppLifecycleState(state); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
void didUpdateWidget(covariant HomePage oldWidget) { |
|
|
|
|
|
super.didUpdateWidget(oldWidget); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
ScreenUtil.init(context, width: 750, height: 1334); |
|
|
ScreenUtil.init(context, width: 750, height: 1334); |
|
@@ -401,12 +403,15 @@ class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, Ti |
|
|
print("首页调用可见"); |
|
|
print("首页调用可见"); |
|
|
IntellectCreate.setCheck(true); |
|
|
IntellectCreate.setCheck(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
// TODO: implement wantKeepAlive |
|
|
|
|
|
bool get wantKeepAlive => true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
final RouteObserver<Route> lifeObserver = RouteObserver(); |
|
|
final RouteObserver<Route> lifeObserver = RouteObserver(); |
|
|
|
|
|
|
|
|
abstract class LifeState<T extends StatefulWidget> extends State<T> |
|
|
abstract class LifeState<T extends StatefulWidget> extends State<T> with RouteAware { |
|
|
with RouteAware { |
|
|
|
|
|
@override |
|
|
@override |
|
|
void initState() { |
|
|
void initState() { |
|
|
super.initState(); |
|
|
super.initState(); |
|
@@ -424,13 +429,14 @@ abstract class LifeState<T extends StatefulWidget> extends State<T> |
|
|
super.dispose(); |
|
|
super.dispose(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void didPop() { |
|
|
void didPop() { |
|
|
onPaused(); |
|
|
onPaused(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void didPopNext() { |
|
|
void didPopNext() { |
|
|
onResume(); |
|
|
onResume(); |
|
|
|
|
|
print("回到首页"); |
|
|
|
|
|
setState(() {}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void didPush() { |
|
|
void didPush() { |
|
|