mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-30 07:15:51 +08:00
tweaks (#1788)
* tweak * opt: show bar * opt: crc32 * opt: appsign * opt: Get * opt: compress only if large * opt: wbi * tweak Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Signed-off-by: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
31e5692dff
commit
521ca3ad18
@@ -12,6 +12,7 @@ import 'package:PiliPlus/pages/dynamics/controller.dart';
|
||||
import 'package:PiliPlus/pages/home/controller.dart';
|
||||
import 'package:PiliPlus/pages/mine/view.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:PiliPlus/utils/extension/get_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -30,8 +31,7 @@ class MainController extends GetxController
|
||||
|
||||
List<NavigationBarType> navigationBars = <NavigationBarType>[];
|
||||
|
||||
StreamController<bool>? bottomBarStream;
|
||||
late bool hideTabBar = Pref.hideTabBar;
|
||||
RxBool? bottomBar;
|
||||
late dynamic controller;
|
||||
final RxInt selectedIndex = 0.obs;
|
||||
|
||||
@@ -41,12 +41,10 @@ class MainController extends GetxController
|
||||
late int dynamicPeriod = Pref.dynamicPeriod * 60 * 1000;
|
||||
late int _lastCheckDynamicAt = 0;
|
||||
late bool hasDyn = false;
|
||||
late final DynamicsController dynamicController = Get.put(
|
||||
DynamicsController(),
|
||||
);
|
||||
late final dynamicController = Get.putOrFind(DynamicsController.new);
|
||||
|
||||
late bool hasHome = false;
|
||||
late final HomeController homeController = Get.put(HomeController());
|
||||
late final homeController = Get.putOrFind(HomeController.new);
|
||||
|
||||
late DynamicBadgeMode msgBadgeMode = Pref.msgBadgeMode;
|
||||
late Set<MsgUnReadType> msgUnReadTypes = Pref.msgUnReadTypeV2;
|
||||
@@ -84,8 +82,8 @@ class MainController extends GetxController
|
||||
)
|
||||
: PageController(initialPage: selectedIndex.value);
|
||||
|
||||
if (navigationBars.length > 1 && hideTabBar) {
|
||||
bottomBarStream = StreamController<bool>.broadcast();
|
||||
if (navigationBars.length > 1 && Pref.hideTabBar) {
|
||||
bottomBar = true.obs;
|
||||
}
|
||||
dynamicBadgeMode = DynamicBadgeMode.values[Pref.dynamicBadgeMode];
|
||||
|
||||
@@ -321,13 +319,13 @@ class MainController extends GetxController
|
||||
|
||||
void setSearchBar() {
|
||||
if (hasHome) {
|
||||
homeController.searchBarStream?.add(true);
|
||||
homeController.searchBar?.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
bottomBarStream?.close();
|
||||
bottomBar?.close();
|
||||
controller.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class MainApp extends StatefulWidget {
|
||||
|
||||
class _MainAppState extends State<MainApp>
|
||||
with RouteAware, WidgetsBindingObserver, WindowListener, TrayListener {
|
||||
final MainController _mainController = Get.put(MainController());
|
||||
final _mainController = Get.put(MainController());
|
||||
late final _setting = GStorage.setting;
|
||||
|
||||
@override
|
||||
@@ -294,7 +294,7 @@ class _MainAppState extends State<MainApp>
|
||||
.toList(),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink()
|
||||
: null
|
||||
: null;
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
@@ -305,7 +305,7 @@ class _MainAppState extends State<MainApp>
|
||||
if (_mainController.selectedIndex.value != 0) {
|
||||
_mainController
|
||||
..setIndex(0)
|
||||
..bottomBarStream?.add(true)
|
||||
..bottomBar?.value = true
|
||||
..setSearchBar();
|
||||
} else {
|
||||
onBack();
|
||||
@@ -439,28 +439,28 @@ class _MainAppState extends State<MainApp>
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: useBottomNav
|
||||
? _mainController.hideTabBar
|
||||
? StreamBuilder(
|
||||
stream: _mainController.bottomBarStream?.stream
|
||||
.distinct(),
|
||||
initialData: true,
|
||||
builder: (context, AsyncSnapshot snapshot) {
|
||||
return AnimatedSlide(
|
||||
curve: Curves.easeInOutCubicEmphasized,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
offset: Offset(0, snapshot.data ? 0 : 1),
|
||||
child: bottomNav,
|
||||
);
|
||||
},
|
||||
)
|
||||
: bottomNav
|
||||
: null,
|
||||
bottomNavigationBar: _buildBottom(bottomNav),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget? _buildBottom(Widget? bottomNav) {
|
||||
if (bottomNav != null) {
|
||||
if (_mainController.bottomBar case final bottomBar?) {
|
||||
return Obx(
|
||||
() => AnimatedSlide(
|
||||
curve: Curves.easeInOutCubicEmphasized,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
offset: Offset(0, bottomBar.value ? 0 : 1),
|
||||
child: bottomNav,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return bottomNav;
|
||||
}
|
||||
|
||||
Widget _buildIcon({
|
||||
required NavigationBarType type,
|
||||
bool selected = false,
|
||||
|
||||
Reference in New Issue
Block a user