added phrases for every empty peer type
This commit is contained in:
parent
38c9e142ff
commit
c1d5f743a9
@ -167,7 +167,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
color: model.currentTab == t
|
||||
? Theme.of(context).colorScheme.background
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(isDesktop ? 2 : 6),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:visibility_detector/visibility_detector.dart';
|
||||
@ -30,6 +30,13 @@ class PeerSortType {
|
||||
];
|
||||
}
|
||||
|
||||
class LoadEvent {
|
||||
static const String recent = 'load_recent_peers';
|
||||
static const String favorite = 'load_fav_peers';
|
||||
static const String lan = 'load_lan_peers';
|
||||
static const String addressBook = 'load_address_book_peers';
|
||||
}
|
||||
|
||||
/// for peer search text, global obs value
|
||||
final peerSearchText = "".obs;
|
||||
|
||||
@ -61,6 +68,12 @@ class _PeersView extends StatefulWidget {
|
||||
/// State for the peer widget.
|
||||
class _PeersViewState extends State<_PeersView> with WindowListener {
|
||||
static const int _maxQueryCount = 3;
|
||||
final HashMap<String, String> _emptyMessages = HashMap.from({
|
||||
LoadEvent.recent: 'empty_recent_tip',
|
||||
LoadEvent.favorite: 'empty_favorite_tip',
|
||||
LoadEvent.lan: 'empty_lan_tip',
|
||||
LoadEvent.addressBook: 'empty_address_book_tip',
|
||||
});
|
||||
final space = isDesktop ? 12.0 : 8.0;
|
||||
final _curPeers = <String>{};
|
||||
var _lastChangeTime = DateTime.now();
|
||||
@ -112,12 +125,30 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
|
||||
return ChangeNotifierProvider<Peers>(
|
||||
create: (context) => widget.peers,
|
||||
child: Consumer<Peers>(
|
||||
builder: (context, peers, child) => peers.peers.isEmpty
|
||||
? Container(
|
||||
margin: EdgeInsets.only(top: kEmptyMarginTop),
|
||||
alignment: Alignment.topCenter,
|
||||
child: Text(translate("Empty")))
|
||||
: _buildPeersView(peers)),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: _buildPeersView(peers),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -221,7 +252,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
|
||||
);
|
||||
}
|
||||
|
||||
if (widget.peers.loadEvent != 'load_recent_peers') {
|
||||
if (widget.peers.loadEvent != LoadEvent.recent) {
|
||||
switch (sortedBy) {
|
||||
case PeerSortType.remoteId:
|
||||
peers.sort((p1, p2) => p1.getId().compareTo(p2.getId()));
|
||||
@ -289,7 +320,7 @@ class RecentPeersView extends BasePeersView {
|
||||
: super(
|
||||
key: key,
|
||||
name: 'recent peer',
|
||||
loadEvent: 'load_recent_peers',
|
||||
loadEvent: LoadEvent.recent,
|
||||
peerCardBuilder: (Peer peer) => RecentPeerCard(
|
||||
peer: peer,
|
||||
menuPadding: menuPadding,
|
||||
@ -311,7 +342,7 @@ class FavoritePeersView extends BasePeersView {
|
||||
: super(
|
||||
key: key,
|
||||
name: 'favorite peer',
|
||||
loadEvent: 'load_fav_peers',
|
||||
loadEvent: LoadEvent.favorite,
|
||||
peerCardBuilder: (Peer peer) => FavoritePeerCard(
|
||||
peer: peer,
|
||||
menuPadding: menuPadding,
|
||||
@ -333,7 +364,7 @@ class DiscoveredPeersView extends BasePeersView {
|
||||
: super(
|
||||
key: key,
|
||||
name: 'discovered peer',
|
||||
loadEvent: 'load_lan_peers',
|
||||
loadEvent: LoadEvent.lan,
|
||||
peerCardBuilder: (Peer peer) => DiscoveredPeerCard(
|
||||
peer: peer,
|
||||
menuPadding: menuPadding,
|
||||
@ -358,7 +389,7 @@ class AddressBookPeersView extends BasePeersView {
|
||||
: super(
|
||||
key: key,
|
||||
name: 'address book peer',
|
||||
loadEvent: 'load_address_book_peers',
|
||||
loadEvent: LoadEvent.addressBook,
|
||||
peerFilter: (Peer peer) =>
|
||||
_hitTag(gFFI.abModel.selectedTags, peer.tags),
|
||||
peerCardBuilder: (Peer peer) => AddressBookPeerCard(
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", "Minimieren"),
|
||||
("Maximize", "Maximieren"),
|
||||
("Your Device", "Ihr Gerät"),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -46,6 +46,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("relay_hint_tip", "It may not be possible to connect directly, you can try to connect via relay. \nIn addition, if you want to use relay on your first try, you can add the \"/r\" suffix to the ID, or select the option \"Always connect via relay\" in the peer card."),
|
||||
("No transfers in progress", ""),
|
||||
("idd_driver_tip", "Install virtual display driver which is used when you have no physical displays."),
|
||||
("confirm_idd_driver_tip", "The option to install the virtual display driver is checked. Note that a test certificate will be installed to trust the virtual display driver. This test certificate will only be used to trust Rustdesk drivers.")
|
||||
("confirm_idd_driver_tip", "The option to install the virtual display driver is checked. Note that a test certificate will be installed to trust the virtual display driver. This test certificate will only be used to trust Rustdesk drivers."),
|
||||
("empty_recent_tip", "Oops, no recent sessions!\nTime to plan a new one."),
|
||||
("empty_favorite_tip", "No favorite peers yet?\nLet's find someone to connect with and add it to your favorites!"),
|
||||
("empty_lan_tip", "Oh no, it looks like we haven't discovered any peers yet."),
|
||||
("empty_address_book_tip", "Oh dear, it appears that there are currently no peers listed in your address book."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", "Minimizza"),
|
||||
("Maximize", "Massimizza"),
|
||||
("Your Device", "Il tuo dispositivo"),
|
||||
("empty_recent_tip", "Oops, non c'è nessuna sessione recente!\nTempo di pianificarne una."),
|
||||
("empty_favorite_tip", "Ancora nessun peer?\nTrova qualcuno con cui connetterti e aggiungilo ai tuoi preferiti!"),
|
||||
("empty_lan_tip", "Oh no, sembra proprio che non abbiamo ancora rilevato nessun peer."),
|
||||
("empty_address_book_tip", "Oh diamine, sembra che per ora non ci siano peer nella tua rubrica."),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -468,5 +468,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Minimize", ""),
|
||||
("Maximize", ""),
|
||||
("Your Device", ""),
|
||||
("empty_recent_tip", ""),
|
||||
("empty_favorite_tip", ""),
|
||||
("empty_lan_tip", ""),
|
||||
("empty_address_book_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user