Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

mobile: limited height scroll tags/users, and scrollable peers

21pages167bf70cd65c
diff --git a/flutter/lib/common/widgets/address_book.dart b/flutter/lib/common/widgets/address_book.dart
index 902df25c9..5cc06c7a1 100644
--- a/flutter/lib/common/widgets/address_book.dart
+++ b/flutter/lib/common/widgets/address_book.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
import 'package:dynamic_layouts/dynamic_layouts.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common/formatter/id_formatter.dart';
@@ -170,16 +172,18 @@ class _AddressBookState extends State<AddressBook> {
});
}
+ final gridView = DynamicGridView.builder(
+ shrinkWrap: isMobile,
+ gridDelegate: SliverGridDelegateWithWrapping(),
+ itemCount: tags.length,
+ itemBuilder: (BuildContext context, int index) {
+ final e = tags[index];
+ return tagBuilder(e);
+ });
+ final maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
return isDesktop
- ? DynamicGridView.builder(
- gridDelegate: SliverGridDelegateWithWrapping(
- mainAxisSpacing: 0, crossAxisSpacing: 0),
- itemCount: tags.length,
- itemBuilder: (BuildContext context, int index) {
- final e = tags[index];
- return tagBuilder(e);
- })
- : Wrap(children: tags.map((e) => tagBuilder(e)).toList());
+ ? gridView
+ : LimitedBox(maxHeight: maxHeight, child: gridView);
});
}
diff --git a/flutter/lib/common/widgets/my_group.dart b/flutter/lib/common/widgets/my_group.dart
index 7f5db3bae..8cd997be3 100644
--- a/flutter/lib/common/widgets/my_group.dart
+++ b/flutter/lib/common/widgets/my_group.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common/hbbs/hbbs.dart';
import 'package:flutter_hbb/common/widgets/login.dart';
@@ -157,11 +159,14 @@ class _MyGroupState extends State<MyGroup> {
}
return true;
}).toList();
+ final listView = ListView.builder(
+ shrinkWrap: isMobile,
+ itemCount: items.length,
+ itemBuilder: (context, index) => _buildUserItem(items[index]));
+ var maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
return isDesktop
- ? ListView.builder(
- itemCount: items.length,
- itemBuilder: (context, index) => _buildUserItem(items[index]))
- : Column(children: items.map((e) => _buildUserItem(e)).toList());
+ ? listView
+ : LimitedBox(maxHeight: maxHeight, child: listView);
});
}
diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart
index 0b3785199..1138663ff 100644
--- a/flutter/lib/common/widgets/peers_view.dart
+++ b/flutter/lib/common/widgets/peers_view.dart
@@ -197,23 +197,14 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
: SizedBox(width: mobileWidth, child: visibilityChild);
}
- final Widget child;
- if (isDesktop) {
- child = DynamicGridView.builder(
- gridDelegate: SliverGridDelegateWithWrapping(
- mainAxisSpacing: space / 2, crossAxisSpacing: space),
- itemCount: peers.length,
- itemBuilder: (BuildContext context, int index) {
- return buildOnePeer(peers[index]);
- },
- );
- } else {
- child = Wrap(
- spacing: space,
- runSpacing: space,
- children: peers.map((e) => buildOnePeer(e)).toList());
- }
-
+ final child = DynamicGridView.builder(
+ gridDelegate: SliverGridDelegateWithWrapping(
+ mainAxisSpacing: space / 2, crossAxisSpacing: space),
+ itemCount: peers.length,
+ itemBuilder: (BuildContext context, int index) {
+ return buildOnePeer(peers[index]);
+ },
+ );
if (updateEvent == UpdateEvent.load) {
_curPeers.clear();
_curPeers.addAll(peers.map((e) => e.id));
diff --git a/flutter/lib/mobile/pages/connection_page.dart b/flutter/lib/mobile/pages/connection_page.dart
index 4a14f8466..5a61a2fc8 100644
--- a/flutter/lib/mobile/pages/connection_page.dart
+++ b/flutter/lib/mobile/pages/connection_page.dart
@@ -80,7 +80,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
_buildRemoteIDTextField(),
])),
SliverFillRemaining(
- hasScrollBody: false,
+ hasScrollBody: true,
child: PeerTabPage(),
)
],
diff --git a/flutter/pubspec.lock b/flutter/pubspec.lock
index aa0ead349..37481b86e 100644
--- a/flutter/pubspec.lock
+++ b/flutter/pubspec.lock
@@ -400,11 +400,11 @@ packages:
dependency: "direct main"
description:
path: "packages/dynamic_layouts"
- ref: "0023d01996576e494094793a6552463f01c5627a"
- resolved-ref: "0023d01996576e494094793a6552463f01c5627a"
- url: "https://github.com/flutter/packages.git"
+ ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
+ resolved-ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
+ url: "https://github.com/21pages/packages.git"
source: git
- version: "0.0.1+1"
+ version: "0.0.1+2"
event_bus:
dependency: transitive
description:
diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml
index 9c06d0bbf..3969c288a 100644
--- a/flutter/pubspec.yaml
+++ b/flutter/pubspec.yaml
@@ -102,9 +102,9 @@ dependencies:
flex_color_picker: ^3.3.0
dynamic_layouts:
git:
- url: https://github.com/flutter/packages.git
+ url: https://github.com/21pages/packages.git
path: packages/dynamic_layouts
- ref: 0023d01996576e494094793a6552463f01c5627a
+ ref: 74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6
dev_dependencies:
icons_launcher: ^2.0.4