An open-source cross-platform alternative to AirDrop
feat: update page transitions
Tien Do Nam39967a0f117a
diff --git a/lib/init.dart b/lib/init.dartindex a6c0ecf4..fc6f5123 100644--- a/lib/init.dart+++ b/lib/init.dart@@ -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()) {diff --git a/lib/pages/send_page.dart b/lib/pages/send_page.dartindex ef67753b..860a1fbf 100644--- a/lib/pages/send_page.dart+++ b/lib/pages/send_page.dart@@ -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),+ 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,+ ),+ ),+ 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!,+ ),+ ),+ ],),- 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),+ ),+ ),+ ],),),- ],- ),+ ],),- 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),- ),- ),- ],- ),- ),- ],+ ),),),),diff --git a/lib/provider/network/send_provider.dart b/lib/provider/network/send_provider.dartindex eb6e8581..05c541d3 100644--- a/lib/provider/network/send_provider.dart+++ b/lib/provider/network/send_provider.dart@@ -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),diff --git a/pubspec.lock b/pubspec.lockindex c271d199..c4a01e76 100644--- a/pubspec.lock+++ b/pubspec.lock@@ -841,7 +841,7 @@ packages:name: routerinourl: "https://pub.dartlang.org"source: hosted- version: "0.2.0"+ version: "0.3.0"screen_retriever:dependency: transitivedescription:diff --git a/pubspec.yaml b/pubspec.yamlindex b4b3c69e..e5c6dfa4 100644--- a/pubspec.yaml+++ b/pubspec.yaml@@ -32,7 +32,7 @@ dependencies:path_provider: 2.0.11permission_handler: 10.2.0responsive_builder: 0.4.3- routerino: 0.2.0+ routerino: 0.3.0share_handler: 0.0.16shared_preferences: 2.0.15shelf: 1.4.0