From 6e6a359809d1f3cf702b8750f71b7e983329543a Mon Sep 17 00:00:00 2001 From: csf Date: Thu, 20 Oct 2022 23:22:02 +0900 Subject: [PATCH] cm add multi clients scroll controller arrow actions --- flutter/lib/desktop/pages/server_page.dart | 16 ++++++++++++++++ flutter/lib/desktop/widgets/tabbar_widget.dart | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/flutter/lib/desktop/pages/server_page.dart b/flutter/lib/desktop/pages/server_page.dart index 570c3e68e..277839a21 100644 --- a/flutter/lib/desktop/pages/server_page.dart +++ b/flutter/lib/desktop/pages/server_page.dart @@ -125,6 +125,7 @@ class ConnectionManagerState extends State { showClose: true, controller: serverModel.tabController, maxLabelWidth: 100, + tail: buildScrollJumper(), pageViewBuilder: (pageView) => Row(children: [ Expanded(child: pageView), Consumer( @@ -159,6 +160,21 @@ class ConnectionManagerState extends State { ), ); } + + Widget buildScrollJumper() { + final offstage = gFFI.serverModel.clients.length < 2; + final sc = gFFI.serverModel.tabController.state.value.scrollController; + return Offstage( + offstage: offstage, + child: Row( + children: [ + ActionIcon( + icon: Icons.arrow_left, iconSize: 22, onTap: sc.backward), + ActionIcon( + icon: Icons.arrow_right, iconSize: 22, onTap: sc.forward), + ], + )); + } } Widget buildConnectionCard(Client client) { diff --git a/flutter/lib/desktop/widgets/tabbar_widget.dart b/flutter/lib/desktop/widgets/tabbar_widget.dart index cf866c481..50ae8cf26 100644 --- a/flutter/lib/desktop/widgets/tabbar_widget.dart +++ b/flutter/lib/desktop/widgets/tabbar_widget.dart @@ -844,7 +844,7 @@ class _CloseButton extends StatelessWidget { } class ActionIcon extends StatelessWidget { - final String message; + final String? message; final IconData icon; final Function() onTap; final bool isClose; @@ -852,7 +852,7 @@ class ActionIcon extends StatelessWidget { final double boxSize; const ActionIcon( {Key? key, - required this.message, + this.message, required this.icon, required this.onTap, this.isClose = false, @@ -864,7 +864,7 @@ class ActionIcon extends StatelessWidget { Widget build(BuildContext context) { RxBool hover = false.obs; return Obx(() => Tooltip( - message: translate(message), + message: message != null ? translate(message!) : "", waitDuration: const Duration(seconds: 1), child: InkWell( hoverColor: isClose