mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
feat: update page transitions
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:localsend_app/provider/settings_provider.dart';
|
||||
import 'package:localsend_app/theme.dart';
|
||||
import 'package:localsend_app/util/platform_check.dart';
|
||||
import 'package:localsend_app/util/snackbar.dart';
|
||||
import 'package:routerino/routerino.dart';
|
||||
import 'package:share_handler/share_handler.dart';
|
||||
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
@@ -23,6 +24,9 @@ Future<PersistenceService> preInit() async {
|
||||
if (!kIsWeb && checkPlatformIsDesktop()) {
|
||||
await windowManager.ensureInitialized();
|
||||
WindowManager.instance.setMinimumSize(const Size(400, 500));
|
||||
|
||||
// use the "slide" transition for desktop
|
||||
Routerino.transition = RouterinoTransition.cupertino;
|
||||
}
|
||||
|
||||
if (checkPlatformWithGallery()) {
|
||||
|
||||
+64
-58
@@ -8,6 +8,7 @@ import 'package:localsend_app/provider/network/send_provider.dart';
|
||||
import 'package:localsend_app/util/sleep.dart';
|
||||
import 'package:localsend_app/widget/animations/initial_fade_transition.dart';
|
||||
import 'package:localsend_app/widget/list_tile/device_list_tile.dart';
|
||||
import 'package:localsend_app/widget/responsive_list_view.dart';
|
||||
import 'package:routerino/routerino.dart';
|
||||
|
||||
class SendPage extends ConsumerStatefulWidget {
|
||||
@@ -28,7 +29,7 @@ class _SendPageState extends ConsumerState<SendPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
sleepAsync(500).then((value) {
|
||||
sleepAsync(800).then((value) {
|
||||
if (mounted) {
|
||||
setState(() => _showName = true);
|
||||
}
|
||||
@@ -67,66 +68,71 @@ class _SendPageState extends ConsumerState<SendPage> {
|
||||
},
|
||||
child: Scaffold(
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 30),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Hero(
|
||||
tag: 'this-device',
|
||||
child: DeviceListTile(
|
||||
device: myDevice,
|
||||
thisDevice: !_showName,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const InitialFadeTransition(
|
||||
duration: Duration(milliseconds: 300),
|
||||
delay: Duration(milliseconds: 400),
|
||||
child: Icon(Icons.arrow_downward),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Hero(
|
||||
tag: 'device-${(sendState?.target ?? _targetDevice)?.ip}',
|
||||
child: DeviceListTile(
|
||||
device: sendState?.target ?? _targetDevice!,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (sendState != null)
|
||||
InitialFadeTransition(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: Column(
|
||||
children: [
|
||||
if (sendState.status == SessionStatus.waiting)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Text(t.sendPage.waiting, textAlign: TextAlign.center),
|
||||
)
|
||||
else if (sendState.status == SessionStatus.declined)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Text(t.sendPage.rejected, style: const TextStyle(color: Colors.orange), textAlign: TextAlign.center),
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: ResponsiveListView.defaultMaxWidth),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 30),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Hero(
|
||||
tag: 'this-device',
|
||||
child: DeviceListTile(
|
||||
device: myDevice,
|
||||
thisDevice: !_showName,
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
_cancel();
|
||||
context.pop();
|
||||
},
|
||||
icon: Icon(sendState.status == SessionStatus.declined ? Icons.check_circle : Icons.close),
|
||||
label: Text(sendState.status == SessionStatus.declined ? t.general.close : t.general.cancel),
|
||||
const SizedBox(height: 20),
|
||||
const InitialFadeTransition(
|
||||
duration: Duration(milliseconds: 300),
|
||||
delay: Duration(milliseconds: 400),
|
||||
child: Icon(Icons.arrow_downward),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 20),
|
||||
Hero(
|
||||
tag: 'device-${(sendState?.target ?? _targetDevice)?.ip}',
|
||||
child: DeviceListTile(
|
||||
device: sendState?.target ?? _targetDevice!,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (sendState != null)
|
||||
InitialFadeTransition(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: Column(
|
||||
children: [
|
||||
if (sendState.status == SessionStatus.waiting)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Text(t.sendPage.waiting, textAlign: TextAlign.center),
|
||||
)
|
||||
else if (sendState.status == SessionStatus.declined)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Text(t.sendPage.rejected, style: const TextStyle(color: Colors.orange), textAlign: TextAlign.center),
|
||||
),
|
||||
Center(
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
_cancel();
|
||||
context.pop();
|
||||
},
|
||||
icon: Icon(sendState.status == SessionStatus.declined ? Icons.check_circle : Icons.close),
|
||||
label: Text(sendState.status == SessionStatus.declined ? t.general.close : t.general.cancel),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -88,7 +88,7 @@ class SendNotifier extends StateNotifier<SendState?> {
|
||||
state = requestState;
|
||||
|
||||
// ignore: use_build_context_synchronously
|
||||
Routerino.context.push(() => const SendPage());
|
||||
Routerino.context.push(() => const SendPage(), transition: RouterinoTransition.fade);
|
||||
|
||||
final response = await requestDio.post(
|
||||
ApiRoute.sendRequest.target(target),
|
||||
|
||||
+1
-1
@@ -841,7 +841,7 @@ packages:
|
||||
name: routerino
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.3.0"
|
||||
screen_retriever:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ dependencies:
|
||||
path_provider: 2.0.11
|
||||
permission_handler: 10.2.0
|
||||
responsive_builder: 0.4.3
|
||||
routerino: 0.2.0
|
||||
routerino: 0.3.0
|
||||
share_handler: 0.0.16
|
||||
shared_preferences: 2.0.15
|
||||
shelf: 1.4.0
|
||||
|
||||
Reference in New Issue
Block a user