From 1be383e50eab75ce6bfe3ec19ae4839b00f8f5b2 Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 10 Aug 2023 20:35:41 +0800 Subject: [PATCH 1/2] not show waitingForImage when already get first image Signed-off-by: 21pages --- flutter/lib/models/model.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 9c4ff281c..4b481dfe6 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -425,6 +425,7 @@ class FfiModel with ChangeNotifier { closeConnection(); } + if (_waitForFirstImage[sessionId] == false) return; dialogManager.show( (setState, close, context) => CustomAlertDialog( title: null, From 16c94fb1d06ee6f8b5ca9609cf751fafa1664990 Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 10 Aug 2023 21:32:26 +0800 Subject: [PATCH 2/2] hide multiselect icon if peers is empty Signed-off-by: 21pages --- flutter/lib/common/widgets/peer_tab_page.dart | 1 + flutter/lib/common/widgets/peers_view.dart | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index a034ec13d..761a37011 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -262,6 +262,7 @@ class _PeerTabPageState extends State Widget _createMultiSelection() { final textColor = Theme.of(context).textTheme.titleLarge?.color; final model = Provider.of(context); + if (model.currentTabCachedPeers.isEmpty) return Offstage(); return Container( padding: EdgeInsets.all(4.0), child: InkWell( diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index e9af1c6e3..c34299fd6 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -124,31 +124,34 @@ class _PeersViewState extends State<_PeersView> with WindowListener { Widget build(BuildContext context) { return ChangeNotifierProvider( create: (context) => widget.peers, - child: Consumer( - builder: (context, peers, child) => peers.peers.isEmpty - ? Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.sentiment_very_dissatisfied_rounded, - color: Theme.of(context).tabBarTheme.labelColor, - size: 40, - ).paddingOnly(bottom: 10), - Text( - translate( - _emptyMessages[widget.peers.loadEvent] ?? 'Empty', - ), - textAlign: TextAlign.center, - style: TextStyle( - color: Theme.of(context).tabBarTheme.labelColor, - ), - ), - ], + child: Consumer(builder: (context, peers, child) { + if (peers.peers.isEmpty) { + gFFI.peerTabModel.setCurrentTabCachedPeers([]); + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.sentiment_very_dissatisfied_rounded, + color: Theme.of(context).tabBarTheme.labelColor, + size: 40, + ).paddingOnly(bottom: 10), + Text( + translate( + _emptyMessages[widget.peers.loadEvent] ?? 'Empty', + ), + textAlign: TextAlign.center, + style: TextStyle( + color: Theme.of(context).tabBarTheme.labelColor, + ), ), - ) - : _buildPeersView(peers), - ), + ], + ), + ); + } else { + return _buildPeersView(peers); + } + }), ); }