mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: nav bar
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPalaX/grpc/grpc_repo.dart';
|
||||
import 'package:PiliPalaX/pages/dynamics/view.dart';
|
||||
import 'package:PiliPalaX/pages/home/view.dart';
|
||||
import 'package:PiliPalaX/pages/media/view.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
@@ -57,27 +55,6 @@ class MainController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void onBackPressed(BuildContext context) {
|
||||
// if (_lastPressedAt == null ||
|
||||
// DateTime.now().difference(_lastPressedAt!) >
|
||||
// const Duration(seconds: 2)) {
|
||||
// 两次点击时间间隔超过2秒,重新记录时间戳
|
||||
// _lastPressedAt = DateTime.now();
|
||||
if (selectedIndex != 0) {
|
||||
pageController.jumpTo(0);
|
||||
} else {
|
||||
if (Platform.isAndroid) {
|
||||
const MethodChannel("onUserLeaveHint").invokeMethod('back');
|
||||
} else {
|
||||
SystemNavigator.pop(); // 退出应用
|
||||
}
|
||||
}
|
||||
// SmartDialog.showToast("再按一次退出PiliPalaX");
|
||||
// return; // 不退出应用
|
||||
// }
|
||||
// SystemNavigator.pop(); // 退出应用
|
||||
}
|
||||
|
||||
void getUnreadDynamic() async {
|
||||
if (!userLogin.value || dynIndex == null || dynIndex == -1) {
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPalaX/grpc/grpc_client.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:PiliPalaX/models/common/dynamic_badge_mode.dart';
|
||||
@@ -129,12 +131,15 @@ class _MainAppState extends State<MainApp>
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (bool didPop, Object? result) async {
|
||||
_mainController.onBackPressed(context);
|
||||
if (_dynamicController.flag) {
|
||||
_dynamicController.flag = false;
|
||||
if (_mainController.selectedIndex != 0) {
|
||||
setIndex(0);
|
||||
_mainController.bottomBarStream.add(true);
|
||||
} else {
|
||||
if (Platform.isAndroid) {
|
||||
const MethodChannel("onUserLeaveHint").invokeMethod('back');
|
||||
} else {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
if (!_homeController.flag) {
|
||||
_homeController.flag = true;
|
||||
}
|
||||
},
|
||||
child: LayoutBuilder(
|
||||
|
||||
Reference in New Issue
Block a user