mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: server tab navigation bar when landscape
This commit is contained in:
@@ -690,7 +690,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -700,7 +700,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -826,7 +826,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -836,7 +836,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -854,7 +854,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -864,7 +864,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -885,7 +885,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@@ -898,7 +898,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
@@ -924,7 +924,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@@ -937,7 +937,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -960,7 +960,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@@ -973,7 +973,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -996,7 +996,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -1008,7 +1008,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
|
||||
@@ -1037,7 +1037,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -1049,7 +1049,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
|
||||
PRODUCT_NAME = ServerBox;
|
||||
@@ -1075,7 +1075,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -1087,7 +1087,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
|
||||
PRODUCT_NAME = ServerBox;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 882;
|
||||
static const int build = 884;
|
||||
static const String engine = "3.19.6";
|
||||
static const String buildAt = "2024-05-09 15:29:37";
|
||||
static const int modifications = 3;
|
||||
static const String buildAt = "2024-05-09 17:08:49";
|
||||
static const int modifications = 4;
|
||||
static const int script = 46;
|
||||
}
|
||||
|
||||
@@ -175,20 +175,19 @@ class _HomePageState extends State<HomePage>
|
||||
: ValBuilder(
|
||||
listenable: _isLandscape,
|
||||
builder: (ls) {
|
||||
if (ls) return const SizedBox();
|
||||
return ListenableBuilder(
|
||||
listenable: _selectIndex,
|
||||
builder: (_, __) => _buildBottomBar(),
|
||||
builder: (_, __) => _buildBottomBar(ls),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomBar() {
|
||||
Widget _buildBottomBar(bool ls) {
|
||||
return NavigationBar(
|
||||
selectedIndex: _selectIndex.value,
|
||||
height: kBottomNavigationBarHeight * 1.1,
|
||||
height: kBottomNavigationBarHeight * (ls ? 0.75 : 1.1),
|
||||
animationDuration: const Duration(milliseconds: 250),
|
||||
onDestinationSelected: (int index) {
|
||||
if (_selectIndex.value == index) return;
|
||||
@@ -203,7 +202,9 @@ class _HomePageState extends State<HomePage>
|
||||
_switchingPage = false;
|
||||
});
|
||||
},
|
||||
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
labelBehavior: ls
|
||||
? NavigationDestinationLabelBehavior.alwaysHide
|
||||
: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
destinations: [
|
||||
NavigationDestination(
|
||||
icon: const Icon(BoxIcons.bx_server),
|
||||
|
||||
@@ -18,7 +18,7 @@ import 'package:toolbox/data/model/server/try_limiter.dart';
|
||||
import 'package:toolbox/data/res/color.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/view/widget/auto_hide_fab.dart';
|
||||
import 'package:toolbox/view/widget/auto_hide.dart';
|
||||
import 'package:toolbox/view/widget/percent_circle.dart';
|
||||
|
||||
import '../../../core/route.dart';
|
||||
@@ -101,7 +101,8 @@ class _ServerPageState extends State<ServerPage>
|
||||
return _buildBody();
|
||||
},
|
||||
),
|
||||
floatingActionButton: AutoHideFab(
|
||||
floatingActionButton: AutoHide(
|
||||
direction: AxisDirection.right,
|
||||
controller: _scrollController,
|
||||
child: FloatingActionButton(
|
||||
heroTag: 'addServer',
|
||||
|
||||
102
lib/view/widget/auto_hide.dart
Normal file
102
lib/view/widget/auto_hide.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
final class AutoHide extends StatefulWidget {
|
||||
final Widget child;
|
||||
final ScrollController controller;
|
||||
final AxisDirection direction;
|
||||
|
||||
const AutoHide({
|
||||
super.key,
|
||||
required this.child,
|
||||
required this.controller,
|
||||
required this.direction,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AutoHide> createState() => _AutoHideState();
|
||||
}
|
||||
|
||||
final class _AutoHideState extends State<AutoHide> {
|
||||
bool _visible = true;
|
||||
bool _isScrolling = false;
|
||||
Timer? _timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.controller.addListener(_scrollListener);
|
||||
_setupTimer();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.controller.removeListener(_scrollListener);
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _setupTimer() {
|
||||
_timer?.cancel();
|
||||
_timer = Timer.periodic(const Duration(seconds: 3), (_) {
|
||||
debugPrint('[AutoHideFab._timer] trigger timer');
|
||||
if (_isScrolling) return;
|
||||
if (!_visible) return;
|
||||
if (!widget.controller.positions.any((e) => e.maxScrollExtent >= 0)) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_visible = false;
|
||||
});
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
});
|
||||
}
|
||||
|
||||
void _scrollListener() {
|
||||
if (_isScrolling) return;
|
||||
_isScrolling = true;
|
||||
|
||||
if (!_visible) {
|
||||
setState(() {
|
||||
_visible = true;
|
||||
});
|
||||
_setupTimer();
|
||||
}
|
||||
|
||||
_isScrolling = false;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedContainer(
|
||||
duration: Durations.medium1,
|
||||
curve: Curves.easeInOutCubic,
|
||||
transform: _transform,
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
|
||||
Matrix4? get _transform {
|
||||
switch (widget.direction) {
|
||||
case AxisDirection.down:
|
||||
return _visible
|
||||
? Matrix4.identity()
|
||||
: Matrix4.translationValues(0, 55, 0);
|
||||
case AxisDirection.up:
|
||||
return _visible
|
||||
? Matrix4.identity()
|
||||
: Matrix4.translationValues(0, -55, 0);
|
||||
case AxisDirection.left:
|
||||
return _visible
|
||||
? Matrix4.identity()
|
||||
: Matrix4.translationValues(-55, 0, 0);
|
||||
case AxisDirection.right:
|
||||
return _visible
|
||||
? Matrix4.identity()
|
||||
: Matrix4.translationValues(55, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
|
||||
final class AutoHideFab extends StatefulWidget {
|
||||
final Widget child;
|
||||
final ScrollController controller;
|
||||
|
||||
const AutoHideFab({
|
||||
super.key,
|
||||
required this.child,
|
||||
required this.controller,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AutoHideFab> createState() => _AutoHideFabState();
|
||||
}
|
||||
|
||||
final class _AutoHideFabState extends State<AutoHideFab> {
|
||||
bool _visible = true;
|
||||
bool _isScrolling = false;
|
||||
Timer? _timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.controller.addListener(_scrollListener);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.controller.removeListener(_scrollListener);
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _setupTimer() {
|
||||
if (_timer != null) {
|
||||
_timer!.cancel();
|
||||
_timer = null;
|
||||
}
|
||||
_timer = Timer.periodic(const Duration(seconds: 3), (_) {
|
||||
if (_isScrolling) return;
|
||||
if (!_visible) return;
|
||||
if (widget.controller.position.maxScrollExtent <= 0) return;
|
||||
setState(() {
|
||||
_visible = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void _scrollListener() {
|
||||
if (_isScrolling) return;
|
||||
_isScrolling = true;
|
||||
if (widget.controller.position.userScrollDirection ==
|
||||
ScrollDirection.reverse) {
|
||||
if (_visible) {
|
||||
setState(() {
|
||||
_visible = false;
|
||||
});
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
}
|
||||
} else {
|
||||
if (!_visible) {
|
||||
setState(() {
|
||||
_visible = true;
|
||||
});
|
||||
_setupTimer();
|
||||
}
|
||||
}
|
||||
_isScrolling = false;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedContainer(
|
||||
duration: Durations.medium1,
|
||||
curve: Curves.easeInOutCubic,
|
||||
transform: Matrix4.translationValues(_visible ? 0.0 : 55, 0.0, 0.0),
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,8 @@ final class KvRow extends StatelessWidget {
|
||||
children: [
|
||||
kBuilder?.call() ?? Text(k, style: UIs.text12),
|
||||
UIs.width7,
|
||||
vBuilder?.call() ?? Text(
|
||||
vBuilder?.call() ??
|
||||
Text(
|
||||
v,
|
||||
style: UIs.text11Grey,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
@@ -471,7 +471,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
|
||||
@@ -481,7 +481,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "Server Box";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@@ -608,7 +608,7 @@
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
|
||||
@@ -618,7 +618,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "Server Box";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@@ -638,7 +638,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 882;
|
||||
CURRENT_PROJECT_VERSION = 884;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -649,7 +649,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MARKETING_VERSION = 1.0.882;
|
||||
MARKETING_VERSION = 1.0.884;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "Server Box";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
||||
Reference in New Issue
Block a user