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): keep Android transfers below the status bar

baiyuze5927d87e719e
diff --git a/ui/lib/mobile/transfers_tab.dart b/ui/lib/mobile/transfers_tab.dart
index a313cec..70339da 100644
--- a/ui/lib/mobile/transfers_tab.dart
+++ b/ui/lib/mobile/transfers_tab.dart
@@ -86,80 +86,86 @@ class _TransfersTabState extends State<TransfersTab> {
...state.transfers(TransferDirection.TRANSFER_DIRECTION_OUTGOING),
]..sort((a, b) => b.createdAtUnix.compareTo(a.createdAtUnix));
- return ListView(
- physics: const AlwaysScrollableScrollPhysics(),
- padding: const EdgeInsets.only(bottom: Insets.xl),
- children: [
- MobileHeader(title: l.navSend),
- MobileGroup(
- title: l.navDevices,
- footer: devices.isEmpty ? l.mNoOnlineDevices : null,
- children: [
- for (final d in devices)
- Padding(
- padding: const EdgeInsets.all(Insets.lg),
- child: Row(
- children: [
- Icon(
- AppIcons.deviceLaptop,
- size: 24,
- color: context.palette.textDim,
- ),
- const SizedBox(width: Insets.md),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- d.name,
+ return SafeArea(
+ bottom: false,
+ child: ListView(
+ physics: const AlwaysScrollableScrollPhysics(),
+ padding: const EdgeInsets.only(bottom: Insets.xl),
+ children: [
+ MobileHeader(title: l.navSend),
+ MobileGroup(
+ title: l.navDevices,
+ footer: devices.isEmpty ? l.mNoOnlineDevices : null,
+ children: [
+ for (final d in devices)
+ Padding(
+ padding: const EdgeInsets.all(Insets.lg),
+ child: Row(
+ children: [
+ Icon(
+ AppIcons.deviceLaptop,
+ size: 24,
+ color: context.palette.textDim,
+ ),
+ const SizedBox(width: Insets.md),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ d.name,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: context.text.bodyLarge,
+ ),
+ Text(
+ routeLabel(l, state, d),
+ style: context.text.bodySmall,
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(width: Insets.sm),
+ ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 140),
+ child: FilledButton(
+ style: secondaryButtonStyle(context),
+ onPressed: _picking ? null : () => _send(state, d),
+ child: Text(
+ l.sendChooseFiles,
maxLines: 2,
- overflow: TextOverflow.ellipsis,
- style: context.text.bodyLarge,
- ),
- Text(
- routeLabel(l, state, d),
- style: context.text.bodySmall,
+ textAlign: TextAlign.center,
),
- ],
- ),
- ),
- const SizedBox(width: Insets.sm),
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 140),
- child: FilledButton(
- style: secondaryButtonStyle(context),
- onPressed: _picking ? null : () => _send(state, d),
- child: Text(
- l.sendChooseFiles,
- maxLines: 2,
- textAlign: TextAlign.center,
),
),
- ),
- ],
- ),
- ),
- if (devices.isEmpty && widget.onPair != null)
- MobileTile(title: l.addDevice, onTap: widget.onPair),
- ],
- ),
- if (rows.isNotEmpty)
- MobileGroup(
- title: l.friendHistory,
- children: [
- for (final t in rows)
- Padding(
- padding: const EdgeInsets.fromLTRB(
- Insets.lg,
- Insets.md,
- Insets.lg,
- Insets.md,
+ ],
),
- child: MobileTransferCard(transfer: t, actions: _actions(t)),
),
+ if (devices.isEmpty && widget.onPair != null)
+ MobileTile(title: l.addDevice, onTap: widget.onPair),
],
),
- ],
+ if (rows.isNotEmpty)
+ MobileGroup(
+ title: l.friendHistory,
+ children: [
+ for (final t in rows)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Insets.lg,
+ Insets.md,
+ Insets.lg,
+ Insets.md,
+ ),
+ child: MobileTransferCard(
+ transfer: t,
+ actions: _actions(t),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
);
}
diff --git a/ui/test/mobile_transfers_test.dart b/ui/test/mobile_transfers_test.dart
index b83db4b..fce5610 100644
--- a/ui/test/mobile_transfers_test.dart
+++ b/ui/test/mobile_transfers_test.dart
@@ -7,6 +7,7 @@ import 'package:pasteferry_ui/i18n.dart';
import 'package:pasteferry_ui/main.dart' show AppScope;
import 'package:pasteferry_ui/mobile/mobile_app.dart';
import 'package:pasteferry_ui/mobile/transfers_tab.dart';
+import 'package:pasteferry_ui/mobile/ui.dart';
class _State extends AppState {
final cancelled = <String>[];
@@ -74,10 +75,12 @@ void main() {
addTearDown(state.dispose);
await tester.pumpWidget(AppScope(state: state, child: MaterialApp(
theme: buildMobileTheme(Brightness.light), locale: const Locale('zh'),
+ builder: (_, child) => MediaQuery(data: const MediaQueryData(size: Size(360, 800), padding: EdgeInsets.only(top: 32)), child: child!),
localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: supportedLocales,
home: const Scaffold(body: TransfersTab()),
)));
await tester.pumpAndSettle();
+ expect(tester.getTopLeft(find.byType(MobileHeader)).dy, greaterThanOrEqualTo(32));
final title = find.text('report.pdf');
expect(tester.getTopLeft(find.byTooltip('保存')).dx, greaterThanOrEqualTo(tester.getTopRight(title).dx));
expect(tester.getSize(find.byType(MobileTransferCard)).height, lessThan(105));