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.
Dart airdrop-alternativeclipboardclipboard-sharingclipboard-synccopy-pastecross-platformend-to-end-encryptionfile-syncfile-transferfluttergolanglinuxmacosnat-traversalp2pself-hostedtailscaleuniversal-clipboardwebrtcwindows
fix(ui): keep send radar circular in small windows
baiyuze9da456d83c90
diff --git a/ui/lib/pages/send_page.dart b/ui/lib/pages/send_page.dartindex 7ef60c6..70d0776 100644--- a/ui/lib/pages/send_page.dart+++ b/ui/lib/pages/send_page.dart@@ -248,18 +248,16 @@ class _SendPageState extends State<SendPage> with SingleTickerProviderStateMixinfinal selfPlatform = state.self?.platform ?? Platform.operatingSystem.replaceFirst('macos', 'darwin');final hasOuter = _slots.values.any((s) => !s.$1);- // 轨道的大小:外圈接近正圆,横纵比不超过 1.35,也不比宽度高。- // 太矮时横向至少 190,内圈斜角上的设备才不会压到中间的本机。- // 雷达这一栏很窄时(小窗口里列表仍在右边):设备名字缩窄,轨道可以竖着拉长、内圈放大,同样不压到本机- final narrow = space.width < 420;- final nodeW = (space.width * 0.3).clamp(96.0, _SendNode.width);- final innerScale = narrow ? 0.74 : _innerScale;- final below = (overflow.isNotEmpty ? 40.0 : 0) + (offline.isNotEmpty ? 28.0 : 0);- final maxRy = (space.height - below) / 2 - 22;- final outerRx = math.min(math.max(maxRy * 1.35, 190.0), space.width / 2 - nodeW / 2);- final outerRy = math.max(80.0, math.min(maxRy, narrow ? math.max(outerRx, 190.0) : outerRx));- final innerRx = outerRx * innerScale;- final innerRy = outerRy * innerScale;+ // 在至少 420 宽的逻辑画布上排布,再整体等比缩小;圈和节点使用同一变换。+ // 小窗口仍左右排,但不会把圆拉成长椭圆,也不靠压缩节点间距塞进窄栏。+ final canvasWidth = math.max(space.width, 420.0);+ final nodeW = (canvasWidth * 0.3).clamp(110.0, _SendNode.width);+ final below = (overflow.isNotEmpty ? 40.0 : 0) + (offline.isNotEmpty ? 40.0 : 0);+ final maxR = math.max(146.0, (space.height - below) / 2 - 22);+ final outerRx = math.min(maxR, canvasWidth / 2 - nodeW / 2);+ final outerRy = outerRx;+ final innerRx = outerRx * _innerScale;+ final innerRy = innerRx;final radar = DropTarget(enable: !_dialogOpen,@@ -378,7 +376,12 @@ class _SendPageState extends State<SendPage> with SingleTickerProviderStateMixinreturn Column(mainAxisAlignment: MainAxisAlignment.center,children: [- SizedBox(height: outerRy * 2 + 44, child: radar),+ Flexible(+ child: FittedBox(+ fit: BoxFit.scaleDown,+ child: SizedBox(width: canvasWidth, height: outerRy * 2 + 44, child: radar),+ ),+ ),if (overflow.isNotEmpty)Padding(padding: const EdgeInsets.fromLTRB(Insets.xl, Insets.xs, Insets.xl, 0),diff --git a/ui/test/send_page_test.dart b/ui/test/send_page_test.dartindex dc052a5..f9045c9 100644--- a/ui/test/send_page_test.dart+++ b/ui/test/send_page_test.dart@@ -163,6 +163,8 @@ void main() {(false, const Size(1180, 720)),(false, const Size(960, 640)),(false, const Size(760, 520)),+ (false, const Size(760, 760)),+ (true, const Size(760, 520)),(true, const Size(1180, 720)),]) {testWidgets(stacked ? '设置里选了上下排,列表在雷达下面' : '默认左右排,列表在雷达右边(${size.width.round()} 宽)', (tester) async {@@ -185,6 +187,14 @@ void main() {expect(tabs.dx, greaterThan(radar.dx), reason: '列表在雷达右边');expect(tabs.dy, lessThan(radar.dy), reason: '列表从顶上开始');}+ final paints = find.byWidgetPredicate((w) => w is CustomPaint && w.painter.runtimeType.toString() == '_SendRadarPainter');+ expect(paints, findsOneWidget);+ final dynamic painter = tester.widget<CustomPaint>(paints).painter;+ final Size inner = painter.inner;+ final Size outer = painter.outer;+ expect(inner.width, inner.height, reason: '内圈必须保持正圆');+ expect(outer.width, outer.height, reason: '外圈必须保持正圆');+ expect(tester.takeException(), isNull);// 雷达上的设备名字不压到中间的本机,也不互相压final selfRect = tester.getRect(self);final names = [diff --git a/ui/tool/screenshots/screenshots_test.dart b/ui/tool/screenshots/screenshots_test.dartindex 4ef1817..330093d 100644--- a/ui/tool/screenshots/screenshots_test.dart+++ b/ui/tool/screenshots/screenshots_test.dart@@ -461,6 +461,15 @@ void main() {});}+ for (final (name, size) in [+ ('send-small-short', const Size(760, 520)),+ ('send-small-tall', const Size(760, 760)),+ ]) {+ testWidgets(name, (tester) async {+ await _shoot(tester, name, state: _sendDemo(), section: Section.send, settle: false, window: size);+ });+ }+testWidgets('send-dialog-dark', (tester) async {await _shoot(tester, 'send-dialog-dark', state: _sendDemo(), section: Section.send, settle: false,brightness: Brightness.dark, window: const Size(1180, 720), arrange: () async {