Skip to content

Commit

Permalink
导航切换时的动画
Browse files Browse the repository at this point in the history
  • Loading branch information
jing332 committed Jan 19, 2024
1 parent 5142ef8 commit a10042c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/generated/intl/messages_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MessageLookup extends MessageLookupByLibrary {
"selectAppToOpen": MessageLookupByLibrary.simpleMessage("选择应用打开"),
"setAdminPassword": MessageLookupByLibrary.simpleMessage("设置admin密码"),
"setDefaultDirectory":
MessageLookupByLibrary.simpleMessage("是否设为默认目录?"),
MessageLookupByLibrary.simpleMessage("是否设为默认初始目录?"),
"settings": MessageLookupByLibrary.simpleMessage("设置"),
"wakeLock": MessageLookupByLibrary.simpleMessage("唤醒锁"),
"wakeLockDesc": MessageLookupByLibrary.simpleMessage(
Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/intl_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
"autoStartWebPage": "将网页设置为打开首页",
"autoStartWebPageDesc": "打开主界面时的首页",
"dataDirectory": "data 文件夹路径",
"setDefaultDirectory": "是否设为默认目录?"
"setDefaultDirectory": "是否设为初始目录?"
}
8 changes: 3 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import 'dart:developer';
import 'dart:ffi';

import 'package:alist_flutter/generated/l10n.dart';
import 'package:alist_flutter/generated_api.dart';
import 'package:alist_flutter/pages/alist/alist.dart';
import 'package:alist_flutter/pages/app_update_dialog.dart';
import 'package:alist_flutter/pages/settings/settings.dart';
import 'package:alist_flutter/pages/web/web.dart';
import 'package:animations/animations.dart';
import 'package:fade_indexed_stack/fade_indexed_stack.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
import 'package:lazy_load_indexed_stack/lazy_load_indexed_stack.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -77,7 +75,8 @@ class MyHomePage extends StatelessWidget {

return Scaffold(
body: Obx(
() => LazyLoadIndexedStack(
() => FadeIndexedStack(
lazy: true,
index: controller.selectedIndex.value,
children: [
WebScreen(key: webGlobalKey),
Expand Down Expand Up @@ -108,7 +107,6 @@ class MyHomePage extends StatelessWidget {
],
selectedIndex: controller.selectedIndex.value,
onDestinationSelected: (int index) {
log(index.toString());
// Web
if (controller.selectedIndex.value == webPageIndex &&
controller.selectedIndex.value == webPageIndex) {
Expand Down
5 changes: 0 additions & 5 deletions lib/pages/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
void initState() {
_lifecycleListener = AppLifecycleListener(
onResume: () async {
log("onResume");
final controller = Get.put(_SettingsController());
controller.updateData();
},
Expand Down Expand Up @@ -194,7 +193,6 @@ class _SettingsController extends GetxController {

@override
void onInit() async {
log("onInit");
updateData();

super.onInit();
Expand All @@ -214,9 +212,6 @@ class _SettingsController extends GetxController {
if (sdk >= 30) {
_managerStorageGranted.value =
await Permission.manageExternalStorage.isGranted;

Permission.manageExternalStorage.status
.then((value) => log(value.toString()));
} else {
_managerStorageGranted.value = true;
_storageGranted.value = await Permission.storage.isGranted;
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.6"
fade_indexed_stack:
dependency: "direct main"
description:
name: fade_indexed_stack
sha256: "0d625709d0bf6d0fa275cfa4eba84695fdea93d672c47413cdb49bcbe758a9f3"
url: "https://pub.dev"
source: hosted
version: "0.2.2"
fake_async:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies:
lazy_load_indexed_stack: ^1.1.0
animations: ^2.0.11
file_picker: ^6.1.1
fade_indexed_stack: ^0.2.2


dev_dependencies:
Expand Down

0 comments on commit a10042c

Please sign in to comment.