diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index f6609ce4f..7c5fc4ba1 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -82,6 +82,7 @@ jobs: - name: Install flutter rust bridge deps run: | + git config --global core.longpaths true cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid" Push-Location flutter ; flutter pub get ; Pop-Location ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart index 28bfb6690..845b10cd3 100644 --- a/flutter/lib/common/widgets/peers_view.dart +++ b/flutter/lib/common/widgets/peers_view.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:collection'; +import 'package:dynamic_layouts/dynamic_layouts.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -177,26 +178,29 @@ class _PeersViewState extends State<_PeersView> with WindowListener { if (snapshot.hasData) { final peers = snapshot.data!; gFFI.peerTabModel.setCurrentTabCachedPeers(peers); - final cards = []; - for (final peer in peers) { - final visibilityChild = VisibilityDetector( - key: ValueKey(_cardId(peer.id)), - onVisibilityChanged: onVisibilityChanged, - child: widget.peerCardBuilder(peer), - ); - cards.add(isDesktop - ? Obx( - () => SizedBox( - width: 220, - height: - peerCardUiType.value == PeerUiType.grid ? 140 : 42, - child: visibilityChild, - ), - ) - : SizedBox(width: mobileWidth, child: visibilityChild)); - } - final child = - Wrap(spacing: space, runSpacing: space, children: cards); + final child = DynamicGridView.builder( + gridDelegate: SliverGridDelegateWithWrapping( + mainAxisSpacing: space / 2, crossAxisSpacing: space), + itemCount: peers.length, + itemBuilder: (BuildContext context, int index) { + final visibilityChild = VisibilityDetector( + key: ValueKey(_cardId(peers[index].id)), + onVisibilityChanged: onVisibilityChanged, + child: widget.peerCardBuilder(peers[index]), + ); + return isDesktop + ? Obx( + () => SizedBox( + width: 220, + height: peerCardUiType.value == PeerUiType.grid + ? 140 + : 42, + child: visibilityChild, + ), + ) + : SizedBox(width: mobileWidth, child: visibilityChild); + }, + ); if (updateEvent == UpdateEvent.load) { _curPeers.clear(); _curPeers.addAll(peers.map((e) => e.id)); diff --git a/flutter/lib/desktop/pages/connection_page.dart b/flutter/lib/desktop/pages/connection_page.dart index 6d53ecc78..5990d11bb 100644 --- a/flutter/lib/desktop/pages/connection_page.dart +++ b/flutter/lib/desktop/pages/connection_page.dart @@ -138,7 +138,7 @@ class _ConnectionPageState extends State Divider().paddingOnly(right: 12), ])), SliverFillRemaining( - hasScrollBody: false, + hasScrollBody: true, child: PeerTabPage().paddingOnly(right: 12.0), ) ], diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock index 6c18736d1..7cd9680f0 100644 --- a/flutter/pubspec.lock +++ b/flutter/pubspec.lock @@ -328,7 +328,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: "e51fddf7f3b46d4423b7aa79ba824a45a1ea1b7a" + resolved-ref: e51fddf7f3b46d4423b7aa79ba824a45a1ea1b7a url: "https://github.com/rustdesk-org/rustdesk_desktop_multi_window" source: git version: "0.1.0" @@ -396,6 +396,15 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" + dynamic_layouts: + dependency: "direct main" + description: + path: "packages/dynamic_layouts" + ref: "0023d01996576e494094793a6552463f01c5627a" + resolved-ref: "0023d01996576e494094793a6552463f01c5627a" + url: "https://github.com/flutter/packages.git" + source: git + version: "0.0.1+1" event_bus: dependency: transitive description: diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index ba90bef3c..9c06d0bbf 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -100,6 +100,11 @@ dependencies: uuid: ^3.0.7 auto_size_text_field: ^2.2.1 flex_color_picker: ^3.3.0 + dynamic_layouts: + git: + url: https://github.com/flutter/packages.git + path: packages/dynamic_layouts + ref: 0023d01996576e494094793a6552463f01c5627a dev_dependencies: icons_launcher: ^2.0.4