Skip to content

PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.

fix(ui): fit the send radar to its rings and leave room for the list

baiyuze57ec479fa902
diff --git a/ui/lib/pages/send_page.dart b/ui/lib/pages/send_page.dart
index c8f7bfa..1e1efdf 100644
--- a/ui/lib/pages/send_page.dart
+++ b/ui/lib/pages/send_page.dart
@@ -31,9 +31,10 @@ class SendPage extends StatefulWidget {
}
/// 雷达上的位置(角度,0 是正右方,顺时针)。内圈放同一局域网里的设备,外圈放其他网络的和离线的。
-/// 内圈在本机的四个斜角,不和「这台 Mac」挤在一行;外圈先占左右,再占上下和外侧的斜角,与内圈错开。
+/// 内圈在本机的四个斜角,不和「这台 Mac」挤在一行;外圈只用左右两个位置,上下就不用给名字留地方,
+/// 圆圈能撑满雷达区。放不下的设备在雷达下面以小标签列出。
const _innerAngles = [-135.0, -45.0, 135.0, 45.0];
-const _outerAngles = [180.0, 0.0, -90.0, 90.0, -155.0, -25.0];
+const _outerAngles = [180.0, 0.0];
/// 这次启动以来检查过保存位置没有:macOS 上第一次写「下载」等文件夹时系统会弹窗,要在用户看着的时候触发
bool _receiveDirChecked = false;
@@ -122,8 +123,8 @@ class _SendPageState extends State<SendPage> with SingleTickerProviderStateMixin
Widget _body(BuildContext context, AppState state, double height) {
final l = context.l10n;
- // 雷达随窗口高度伸缩,最高 440;给上面的标题和下面的列表至少留出几行
- final radarHeight = (height - 270).clamp(240.0, 440.0);
+ // 雷达约占页面高度的四成,最高 320,其余留给下面的列表
+ final radarHeight = (height * 0.42).clamp(220.0, 320.0);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -184,7 +185,7 @@ class _SendPageState extends State<SendPage> with SingleTickerProviderStateMixin
// 分配位置:已有的不动,新来的按内外圈占空位。换了网络的设备换到另一圈。
// 窗口矮的时候内圈的上下两个位置会压到本机,只用左右两个,其余的放外圈
- final innerSlots = height >= 320 ? _innerAngles.length : 2;
+ final innerSlots = height >= 240 ? _innerAngles.length : 2;
final ids = {for (final d in peers) d.id};
_slots.removeWhere((id, s) => !ids.contains(id) || (s.$1 && s.$2 >= innerSlots));
for (final d in peers) {
@@ -236,10 +237,10 @@ class _SendPageState extends State<SendPage> with SingleTickerProviderStateMixin
child: LayoutBuilder(
builder: (context, box) {
final center = box.biggest.center(Offset.zero);
- // 轨道接近正圆(横纵比 1.3):最下面的设备下方要放得下名字和状态。
- // 窗口矮的时候横向放宽一些,内圈斜角上的设备才不会压到中间的本机
- final outerRy = box.maxHeight / 2 - 62;
- final outerRx = math.min(math.max(outerRy * 1.3, 220.0), box.maxWidth / 2 - _SendNode.width / 2);
+ // 外圈撑满雷达区的高度,横纵比约 1.7:不像正圆那样左右空着,也不至于压成一条扁椭圆。
+ // 设备只在外圈左右和内圈斜角上,上下不用给名字留地方
+ final outerRy = box.maxHeight / 2 - 14;
+ final outerRx = math.min(math.max(outerRy * 1.7, 220.0), box.maxWidth / 2 - _SendNode.width / 2);
final innerRx = outerRx * 0.6;
final innerRy = outerRy * 0.6;
_nodeRects.clear();