diff --git a/flutter_server_box.wiki b/flutter_server_box.wiki deleted file mode 160000 index f4400103..00000000 --- a/flutter_server_box.wiki +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f4400103133a69c90743909448934fcc11cb55bf diff --git a/lib/data/res/github_id.dart b/lib/data/res/github_id.dart index e4c6eee6..6e91d932 100644 --- a/lib/data/res/github_id.dart +++ b/lib/data/res/github_id.dart @@ -126,6 +126,7 @@ abstract final class GithubIds { 'cnen2018', 'xiaomeng9597', 'mingzhao2019', + 'HHXXYY123', }; } diff --git a/lib/view/page/server/tab/top_bar.dart b/lib/view/page/server/tab/top_bar.dart index 6bed035d..5476fb3b 100644 --- a/lib/view/page/server/tab/top_bar.dart +++ b/lib/view/page/server/tab/top_bar.dart @@ -1,6 +1,6 @@ part of 'tab.dart'; -final class _TopBar extends StatelessWidget implements PreferredSizeWidget { +final class _TopBar extends ConsumerWidget implements PreferredSizeWidget { final ValueNotifier> 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, diff --git a/lib/view/page/setting/seq/srv_seq.dart b/lib/view/page/setting/seq/srv_seq.dart index d8b71ce2..764fc80a 100644 --- a/lib/view/page/setting/seq/srv_seq.dart +++ b/lib/view/page/setting/seq/srv_seq.dart @@ -113,11 +113,13 @@ class _ServerOrderPageState extends ConsumerState { 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)), ); diff --git a/pubspec.lock b/pubspec.lock index 1e6f0c65..f974cbaa 100644 --- a/pubspec.lock +++ b/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: diff --git a/pubspec.yaml b/pubspec.yaml index 644f700e..558d9662 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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