mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 10:26:19 +02:00
fix: load local peers, called two times on select tab (#10859)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
ce1e4863cb
commit
343f12b380
1 changed files with 13 additions and 19 deletions
|
@ -33,8 +33,8 @@ class PeerTabPage extends StatefulWidget {
|
|||
|
||||
class _TabEntry {
|
||||
final Widget widget;
|
||||
final Function({dynamic hint}) load;
|
||||
_TabEntry(this.widget, this.load);
|
||||
final Function({dynamic hint})? load;
|
||||
_TabEntry(this.widget, [this.load]);
|
||||
}
|
||||
|
||||
EdgeInsets? _menuPadding() {
|
||||
|
@ -44,21 +44,15 @@ EdgeInsets? _menuPadding() {
|
|||
class _PeerTabPageState extends State<PeerTabPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final List<_TabEntry> entries = [
|
||||
_TabEntry(
|
||||
RecentPeersView(
|
||||
menuPadding: _menuPadding(),
|
||||
),
|
||||
bind.mainLoadRecentPeers),
|
||||
_TabEntry(
|
||||
FavoritePeersView(
|
||||
menuPadding: _menuPadding(),
|
||||
),
|
||||
bind.mainLoadFavPeers),
|
||||
_TabEntry(
|
||||
DiscoveredPeersView(
|
||||
menuPadding: _menuPadding(),
|
||||
),
|
||||
bind.mainDiscover),
|
||||
_TabEntry(RecentPeersView(
|
||||
menuPadding: _menuPadding(),
|
||||
)),
|
||||
_TabEntry(FavoritePeersView(
|
||||
menuPadding: _menuPadding(),
|
||||
)),
|
||||
_TabEntry(DiscoveredPeersView(
|
||||
menuPadding: _menuPadding(),
|
||||
)),
|
||||
_TabEntry(
|
||||
AddressBook(
|
||||
menuPadding: _menuPadding(),
|
||||
|
@ -100,7 +94,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||
gFFI.peerTabModel.setCurrentTabCachedPeers([]);
|
||||
}
|
||||
gFFI.peerTabModel.setCurrentTab(tabIndex);
|
||||
entries[tabIndex].load(hint: false);
|
||||
entries[tabIndex].load?.call(hint: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +219,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||
child: RefreshWidget(
|
||||
onPressed: () {
|
||||
if (gFFI.peerTabModel.currentTab < entries.length) {
|
||||
entries[gFFI.peerTabModel.currentTab].load();
|
||||
entries[gFFI.peerTabModel.currentTab].load?.call();
|
||||
}
|
||||
},
|
||||
spinning: loading,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue