mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: no Tag Switcher on desktop (#932)
This commit is contained in:
Submodule flutter_server_box.wiki deleted from f440010313
@@ -126,6 +126,7 @@ abstract final class GithubIds {
|
||||
'cnen2018',
|
||||
'xiaomeng9597',
|
||||
'mingzhao2019',
|
||||
'HHXXYY123',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
part of 'tab.dart';
|
||||
|
||||
final class _TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final class _TopBar extends ConsumerWidget implements PreferredSizeWidget {
|
||||
final ValueNotifier<Set<String>> tags;
|
||||
final void Function(String) onTagChanged;
|
||||
final String initTag;
|
||||
@@ -8,33 +8,53 @@ final class _TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const _TopBar({required this.initTag, required this.onTagChanged, required this.tags});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isMobile = ResponsiveBreakpoints.of(context).isMobile;
|
||||
if (!isMobile) return UIs.placeholder;
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final breakpoints = ResponsiveBreakpoints.of(context);
|
||||
final isMobile = breakpoints.isMobile;
|
||||
final padding = EdgeInsets.only(left: isMobile ? 10 : 16, right: isMobile ? 0 : 16);
|
||||
|
||||
final Widget leading;
|
||||
if (isMobile) {
|
||||
// Keep this btn. For issue #657.
|
||||
leading = InkWell(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
onTap: () {
|
||||
SettingsPage.route.go(context);
|
||||
},
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 7, vertical: 3),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(BuildData.name, style: TextStyle(fontSize: 19)),
|
||||
SizedBox(width: 5),
|
||||
Icon(Icons.settings, size: 17),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final servers = ref.watch(serversProvider);
|
||||
final order = servers.serverOrder;
|
||||
var connected = 0;
|
||||
for (final id in order) {
|
||||
final conn = ref.watch(serverProvider(id).select((value) => value.conn));
|
||||
if (conn.index >= ServerConn.connected.index) connected++;
|
||||
}
|
||||
final total = order.length;
|
||||
final connectionText = '$connected/$total ${context.l10n.conn}';
|
||||
leading = Text(
|
||||
connectionText,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||
);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
padding: padding,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Keep this btn. For issue #657.
|
||||
InkWell(
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
onTap: () {
|
||||
SettingsPage.route.go(context);
|
||||
},
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 7, vertical: 3),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(BuildData.name, style: TextStyle(fontSize: 19)),
|
||||
SizedBox(width: 5),
|
||||
Icon(Icons.settings, size: 17),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 30),
|
||||
leading,
|
||||
SizedBox(width: isMobile ? 30 : 16),
|
||||
TagSwitcher(
|
||||
tags: tags,
|
||||
onTagChanged: onTagChanged,
|
||||
|
||||
@@ -113,11 +113,13 @@ class _ServerOrderPageState extends ConsumerState<ServerOrderPage> {
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
final name = spi.name.characters.firstOrNull ?? '?';
|
||||
|
||||
return ListTile(
|
||||
title: Text(spi.name, style: const TextStyle(fontWeight: FontWeight.w500)),
|
||||
subtitle: Text(spi.oldId, style: UIs.textGrey),
|
||||
leading: CircleAvatar(
|
||||
child: Text(spi.name[0]),
|
||||
child: Text(name),
|
||||
),
|
||||
trailing: ReorderableDragStartListener(index: index, child: const Icon(Icons.drag_handle)),
|
||||
);
|
||||
|
||||
16
pubspec.lock
16
pubspec.lock
@@ -504,9 +504,11 @@ packages:
|
||||
fl_lib:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../fl_lib"
|
||||
relative: true
|
||||
source: path
|
||||
path: "."
|
||||
ref: "v1.0.351"
|
||||
resolved-ref: "98d480eb0128805b5b3361bcfb07c3b46b9f1391"
|
||||
url: "https://github.com/lppcg/fl_lib"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
@@ -646,14 +648,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
flutter_staggered_grid_view:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_staggered_grid_view
|
||||
sha256: "19e7abb550c96fbfeb546b23f3ff356ee7c59a019a651f8f102a4ba9b7349395"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
flutter_svg:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -63,7 +63,7 @@ dependencies:
|
||||
fl_lib:
|
||||
git:
|
||||
url: https://github.com/lppcg/fl_lib
|
||||
ref: v1.0.349
|
||||
ref: v1.0.351
|
||||
flutter_gbk2utf8: ^1.0.1
|
||||
get_it: ^8.2.0
|
||||
|
||||
@@ -74,8 +74,8 @@ dependency_overrides:
|
||||
# path: ../dartssh2
|
||||
# xterm:
|
||||
# path: ../xterm.dart
|
||||
fl_lib:
|
||||
path: ../fl_lib
|
||||
# fl_lib:
|
||||
# path: ../fl_lib
|
||||
# fl_build:
|
||||
# path: ../fl_build
|
||||
gtk: # TODO: remove it after fixed in upstream
|
||||
|
||||
Reference in New Issue
Block a user