Skip to content

Commit bb3e3b4

Browse files
authored
opt.: no Tag Switcher on desktop (#932)
1 parent 3307fca commit bb3e3b4

File tree

6 files changed

+55
-39
lines changed

6 files changed

+55
-39
lines changed

flutter_server_box.wiki

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/data/res/github_id.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ abstract final class GithubIds {
126126
'cnen2018',
127127
'xiaomeng9597',
128128
'mingzhao2019',
129+
'HHXXYY123',
129130
};
130131
}
131132

lib/view/page/server/tab/top_bar.dart

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,60 @@
11
part of 'tab.dart';
22

3-
final class _TopBar extends StatelessWidget implements PreferredSizeWidget {
3+
final class _TopBar extends ConsumerWidget implements PreferredSizeWidget {
44
final ValueNotifier<Set<String>> tags;
55
final void Function(String) onTagChanged;
66
final String initTag;
77

88
const _TopBar({required this.initTag, required this.onTagChanged, required this.tags});
99

1010
@override
11-
Widget build(BuildContext context) {
12-
final isMobile = ResponsiveBreakpoints.of(context).isMobile;
13-
if (!isMobile) return UIs.placeholder;
11+
Widget build(BuildContext context, WidgetRef ref) {
12+
final breakpoints = ResponsiveBreakpoints.of(context);
13+
final isMobile = breakpoints.isMobile;
14+
final padding = EdgeInsets.only(left: isMobile ? 10 : 16, right: isMobile ? 0 : 16);
15+
16+
final Widget leading;
17+
if (isMobile) {
18+
// Keep this btn. For issue #657.
19+
leading = InkWell(
20+
borderRadius: BorderRadius.circular(13),
21+
onTap: () {
22+
SettingsPage.route.go(context);
23+
},
24+
child: const Padding(
25+
padding: EdgeInsets.symmetric(horizontal: 7, vertical: 3),
26+
child: Row(
27+
children: [
28+
Text(BuildData.name, style: TextStyle(fontSize: 19)),
29+
SizedBox(width: 5),
30+
Icon(Icons.settings, size: 17),
31+
],
32+
),
33+
),
34+
);
35+
} else {
36+
final servers = ref.watch(serversProvider);
37+
final order = servers.serverOrder;
38+
var connected = 0;
39+
for (final id in order) {
40+
final conn = ref.watch(serverProvider(id).select((value) => value.conn));
41+
if (conn.index >= ServerConn.connected.index) connected++;
42+
}
43+
final total = order.length;
44+
final connectionText = '$connected/$total ${context.l10n.conn}';
45+
leading = Text(
46+
connectionText,
47+
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
48+
);
49+
}
1450

1551
return Padding(
16-
padding: const EdgeInsets.only(left: 10),
52+
padding: padding,
1753
child: Row(
1854
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1955
children: [
20-
// Keep this btn. For issue #657.
21-
InkWell(
22-
borderRadius: BorderRadius.circular(13),
23-
onTap: () {
24-
SettingsPage.route.go(context);
25-
},
26-
child: const Padding(
27-
padding: EdgeInsets.symmetric(horizontal: 7, vertical: 3),
28-
child: Row(
29-
children: [
30-
Text(BuildData.name, style: TextStyle(fontSize: 19)),
31-
SizedBox(width: 5),
32-
Icon(Icons.settings, size: 17),
33-
],
34-
),
35-
),
36-
),
37-
const SizedBox(width: 30),
56+
leading,
57+
SizedBox(width: isMobile ? 30 : 16),
3858
TagSwitcher(
3959
tags: tags,
4060
onTagChanged: onTagChanged,

lib/view/page/setting/seq/srv_seq.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ class _ServerOrderPageState extends ConsumerState<ServerOrderPage> {
113113
return const SizedBox();
114114
}
115115

116+
final name = spi.name.characters.firstOrNull ?? '?';
117+
116118
return ListTile(
117119
title: Text(spi.name, style: const TextStyle(fontWeight: FontWeight.w500)),
118120
subtitle: Text(spi.oldId, style: UIs.textGrey),
119121
leading: CircleAvatar(
120-
child: Text(spi.name[0]),
122+
child: Text(name),
121123
),
122124
trailing: ReorderableDragStartListener(index: index, child: const Icon(Icons.drag_handle)),
123125
);

pubspec.lock

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,11 @@ packages:
504504
fl_lib:
505505
dependency: "direct main"
506506
description:
507-
path: "../fl_lib"
508-
relative: true
509-
source: path
507+
path: "."
508+
ref: "v1.0.351"
509+
resolved-ref: "98d480eb0128805b5b3361bcfb07c3b46b9f1391"
510+
url: "https://github.com/lppcg/fl_lib"
511+
source: git
510512
version: "0.0.1"
511513
flutter:
512514
dependency: "direct main"
@@ -646,14 +648,6 @@ packages:
646648
url: "https://pub.dev"
647649
source: hosted
648650
version: "3.1.2"
649-
flutter_staggered_grid_view:
650-
dependency: transitive
651-
description:
652-
name: flutter_staggered_grid_view
653-
sha256: "19e7abb550c96fbfeb546b23f3ff356ee7c59a019a651f8f102a4ba9b7349395"
654-
url: "https://pub.dev"
655-
source: hosted
656-
version: "0.7.0"
657651
flutter_svg:
658652
dependency: transitive
659653
description:

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dependencies:
6363
fl_lib:
6464
git:
6565
url: https://github.com/lppcg/fl_lib
66-
ref: v1.0.349
66+
ref: v1.0.351
6767
flutter_gbk2utf8: ^1.0.1
6868
get_it: ^8.2.0
6969

@@ -74,8 +74,8 @@ dependency_overrides:
7474
# path: ../dartssh2
7575
# xterm:
7676
# path: ../xterm.dart
77-
fl_lib:
78-
path: ../fl_lib
77+
# fl_lib:
78+
# path: ../fl_lib
7979
# fl_build:
8080
# path: ../fl_build
8181
gtk: # TODO: remove it after fixed in upstream

0 commit comments

Comments
 (0)