From 57debc6339fd9fb7e60880ddb9f683e14c055326 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 23 Jun 2023 00:32:43 +0800 Subject: [PATCH] fix peers loaded bug and fix group style on desktop, mobile has more pending problems --- flutter/lib/common/widgets/address_book.dart | 2 +- flutter/lib/common/widgets/my_group.dart | 44 ++++++++------------ flutter/lib/common/widgets/peers_view.dart | 4 +- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/flutter/lib/common/widgets/address_book.dart b/flutter/lib/common/widgets/address_book.dart index 9077b9869..08df6d4e5 100644 --- a/flutter/lib/common/widgets/address_book.dart +++ b/flutter/lib/common/widgets/address_book.dart @@ -76,7 +76,7 @@ class _AddressBookState extends State { border: Border.all(color: Theme.of(context).colorScheme.background)), child: Container( - width: 180, + width: 150, height: double.infinity, padding: const EdgeInsets.all(8.0), child: Column( diff --git a/flutter/lib/common/widgets/my_group.dart b/flutter/lib/common/widgets/my_group.dart index 472f98406..1dd254a02 100644 --- a/flutter/lib/common/widgets/my_group.dart +++ b/flutter/lib/common/widgets/my_group.dart @@ -75,17 +75,14 @@ class _MyGroupState extends State { Widget _buildDesktop() { return Row( children: [ - Card( - margin: EdgeInsets.symmetric(horizontal: 4.0), - shape: RoundedRectangleBorder( + Container( + decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - side: - BorderSide(color: Theme.of(context).scaffoldBackgroundColor)), + border: + Border.all(color: Theme.of(context).colorScheme.background)), child: Container( - width: 200, + width: 150, height: double.infinity, - padding: - const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), child: Column( children: [ _buildLeftHeader(), @@ -93,15 +90,13 @@ class _MyGroupState extends State { child: Container( width: double.infinity, height: double.infinity, - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(2)), child: _buildUserContacts(), - ).marginSymmetric(vertical: 8.0), + ), ) ], ), ), - ).marginOnly(right: 8.0), + ).marginOnly(right: 12.0), Expanded( child: Align( alignment: Alignment.topLeft, @@ -116,30 +111,24 @@ class _MyGroupState extends State { Widget _buildMobile() { return Column( children: [ - Card( - margin: EdgeInsets.symmetric(horizontal: 4.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - side: - BorderSide(color: Theme.of(context).scaffoldBackgroundColor)), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + border: + Border.all(color: Theme.of(context).colorScheme.background)), child: Container( - padding: - const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), child: Column( mainAxisSize: MainAxisSize.min, children: [ _buildLeftHeader(), Container( width: double.infinity, - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(4)), child: _buildUserContacts(), - ).marginSymmetric(vertical: 8.0) + ) ], ), ), - ), - Divider(), + ).marginOnly(bottom: 12.0), Expanded( child: Align( alignment: Alignment.topLeft, @@ -161,6 +150,7 @@ class _MyGroupState extends State { searchUserText.value = value; }, decoration: InputDecoration( + filled: false, prefixIcon: Icon( Icons.search_rounded, color: Theme.of(context).hintColor, @@ -214,7 +204,7 @@ class _MyGroupState extends State { child: Container( child: Row( children: [ - Icon(Icons.person_outline_rounded, color: Colors.grey, size: 16) + Icon(Icons.person_rounded, color: Colors.grey, size: 16) .marginOnly(right: 4), Expanded(child: Text(username)), ], @@ -222,6 +212,6 @@ class _MyGroupState extends State { ), ); }, - )).marginSymmetric(horizontal: 12); + )).marginSymmetric(horizontal: 12).marginOnly(bottom: 6); } } diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index f6232f644..95099bcc8 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -80,7 +80,6 @@ class _PeersViewState extends State<_PeersView> with WindowListener { var _lastQueryPeers = {}; var _lastQueryTime = DateTime.now().subtract(const Duration(hours: 1)); var _queryCount = 0; - var _loaded = false; var _exit = false; late final mobileWidth = () { @@ -126,7 +125,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener { return ChangeNotifierProvider( create: (context) => widget.peers, child: Consumer( - builder: (context, peers, child) => peers.peers.isEmpty && _loaded + builder: (context, peers, child) => peers.peers.isEmpty ? Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -167,7 +166,6 @@ class _PeersViewState extends State<_PeersView> with WindowListener { String _peerId(String cardId) => cardId.replaceAll(widget.peers.name, ''); Widget _buildPeersView(Peers peers) { - _loaded = true; final updateEvent = peers.event; final body = ObxValue((filters) { return FutureBuilder>(