fix peers loaded bug and fix group style on desktop, mobile has more

pending problems
This commit is contained in:
rustdesk 2023-06-23 00:32:43 +08:00
parent 20db4bed01
commit 57debc6339
3 changed files with 19 additions and 31 deletions

View File

@ -76,7 +76,7 @@ class _AddressBookState extends State<AddressBook> {
border: border:
Border.all(color: Theme.of(context).colorScheme.background)), Border.all(color: Theme.of(context).colorScheme.background)),
child: Container( child: Container(
width: 180, width: 150,
height: double.infinity, height: double.infinity,
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(

View File

@ -75,17 +75,14 @@ class _MyGroupState extends State<MyGroup> {
Widget _buildDesktop() { Widget _buildDesktop() {
return Row( return Row(
children: [ children: [
Card( Container(
margin: EdgeInsets.symmetric(horizontal: 4.0), decoration: BoxDecoration(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
side: border:
BorderSide(color: Theme.of(context).scaffoldBackgroundColor)), Border.all(color: Theme.of(context).colorScheme.background)),
child: Container( child: Container(
width: 200, width: 150,
height: double.infinity, height: double.infinity,
padding:
const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
child: Column( child: Column(
children: [ children: [
_buildLeftHeader(), _buildLeftHeader(),
@ -93,15 +90,13 @@ class _MyGroupState extends State<MyGroup> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(2)),
child: _buildUserContacts(), child: _buildUserContacts(),
).marginSymmetric(vertical: 8.0), ),
) )
], ],
), ),
), ),
).marginOnly(right: 8.0), ).marginOnly(right: 12.0),
Expanded( Expanded(
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
@ -116,30 +111,24 @@ class _MyGroupState extends State<MyGroup> {
Widget _buildMobile() { Widget _buildMobile() {
return Column( return Column(
children: [ children: [
Card( Container(
margin: EdgeInsets.symmetric(horizontal: 4.0), decoration: BoxDecoration(
shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6),
borderRadius: BorderRadius.circular(12), border:
side: Border.all(color: Theme.of(context).colorScheme.background)),
BorderSide(color: Theme.of(context).scaffoldBackgroundColor)),
child: Container( child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
_buildLeftHeader(), _buildLeftHeader(),
Container( Container(
width: double.infinity, width: double.infinity,
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(4)),
child: _buildUserContacts(), child: _buildUserContacts(),
).marginSymmetric(vertical: 8.0) )
], ],
), ),
), ),
), ).marginOnly(bottom: 12.0),
Divider(),
Expanded( Expanded(
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
@ -161,6 +150,7 @@ class _MyGroupState extends State<MyGroup> {
searchUserText.value = value; searchUserText.value = value;
}, },
decoration: InputDecoration( decoration: InputDecoration(
filled: false,
prefixIcon: Icon( prefixIcon: Icon(
Icons.search_rounded, Icons.search_rounded,
color: Theme.of(context).hintColor, color: Theme.of(context).hintColor,
@ -214,7 +204,7 @@ class _MyGroupState extends State<MyGroup> {
child: Container( child: Container(
child: Row( child: Row(
children: [ children: [
Icon(Icons.person_outline_rounded, color: Colors.grey, size: 16) Icon(Icons.person_rounded, color: Colors.grey, size: 16)
.marginOnly(right: 4), .marginOnly(right: 4),
Expanded(child: Text(username)), Expanded(child: Text(username)),
], ],
@ -222,6 +212,6 @@ class _MyGroupState extends State<MyGroup> {
), ),
); );
}, },
)).marginSymmetric(horizontal: 12); )).marginSymmetric(horizontal: 12).marginOnly(bottom: 6);
} }
} }

View File

@ -80,7 +80,6 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
var _lastQueryPeers = <String>{}; var _lastQueryPeers = <String>{};
var _lastQueryTime = DateTime.now().subtract(const Duration(hours: 1)); var _lastQueryTime = DateTime.now().subtract(const Duration(hours: 1));
var _queryCount = 0; var _queryCount = 0;
var _loaded = false;
var _exit = false; var _exit = false;
late final mobileWidth = () { late final mobileWidth = () {
@ -126,7 +125,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
return ChangeNotifierProvider<Peers>( return ChangeNotifierProvider<Peers>(
create: (context) => widget.peers, create: (context) => widget.peers,
child: Consumer<Peers>( child: Consumer<Peers>(
builder: (context, peers, child) => peers.peers.isEmpty && _loaded builder: (context, peers, child) => peers.peers.isEmpty
? Center( ? Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -167,7 +166,6 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
String _peerId(String cardId) => cardId.replaceAll(widget.peers.name, ''); String _peerId(String cardId) => cardId.replaceAll(widget.peers.name, '');
Widget _buildPeersView(Peers peers) { Widget _buildPeersView(Peers peers) {
_loaded = true;
final updateEvent = peers.event; final updateEvent = peers.event;
final body = ObxValue<RxList>((filters) { final body = ObxValue<RxList>((filters) {
return FutureBuilder<List<Peer>>( return FutureBuilder<List<Peer>>(