From b67bb58472c9edb39d79c29d22ea9768e904958a Mon Sep 17 00:00:00 2001 From: ewuuwe Date: Sun, 18 Feb 2024 12:28:41 +0100 Subject: [PATCH] Redesign receive page --- lib/pages/ReceivePage.dart | 82 +++++++++++++++++++++---------------- lib/pages/SendPage.dart | 3 +- lib/pages/SettingsPage.dart | 19 ++++++--- pubspec.yaml | 2 +- 4 files changed, 63 insertions(+), 43 deletions(-) diff --git a/lib/pages/ReceivePage.dart b/lib/pages/ReceivePage.dart index c51ab86..e023ffd 100644 --- a/lib/pages/ReceivePage.dart +++ b/lib/pages/ReceivePage.dart @@ -1,10 +1,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:gap/gap.dart'; import 'package:iyox_wormhole/gen/ffi.dart'; import 'package:iyox_wormhole/pages/QrCodeScannerPage.dart'; -import 'package:iyox_wormhole/pages/SendPage.dart'; import 'package:iyox_wormhole/utils/type_helpers.dart'; import 'package:iyox_wormhole/utils/paths.dart'; @@ -28,16 +26,20 @@ class _ReceivePageState extends State { @override Widget build(BuildContext context) { return Center( - child: AnimatedContainer( - duration: const Duration(milliseconds: 2000), - child: Padding( - padding: const EdgeInsets.all(11.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Padding( + padding: EdgeInsets.fromLTRB(20, 55, 0, 20), + child: Text("Receive Files", style: TextStyle(fontSize: 40)), + ), + Container( + alignment: Alignment.center, + margin: const EdgeInsets.symmetric(horizontal: 12), child: Column( mainAxisSize: MainAxisSize.min, children: [ - const Icon(Icons.download_rounded, size: 130,), - const Text("Receive File", style: TextStyle(fontSize: 45)), - const Gap(40), Row( children: [ Flexible( @@ -62,37 +64,47 @@ class _ReceivePageState extends State { icon: const Icon(Icons.qr_code)), ], ), - const SizedBox( - height: 25, - ), - FilledButton.icon( - onPressed: !transferring ? _onReceiveButtonClick : null, - style: largeButtonStyle, - label: const Text('Receive'), - icon: const Icon(Icons.file_download_outlined), - ), - if (transferring) - Column( - children: [ - const SizedBox( - height: 12, - ), - LinearProgressIndicator( - value: downloadStarted - ? receivedBytes / totalReceiveBytes - : null, - minHeight: 10, - borderRadius: BorderRadius.circular(18), - ) - ], - ), ], ), ), - ), - ); + Container( + alignment: Alignment.center, + margin: const EdgeInsets.fromLTRB(10, 0, 10, 30), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 100), + transitionBuilder: (child, animation) => ScaleTransition( + scale: animation, + child: child, + ), + child: !transferring + ? FilledButton.icon( + onPressed: _onReceiveButtonClick, + style: buttonStyle, + label: const Text('Receive File'), + icon: const Icon(Icons.sim_card_download_outlined), + ) + : LinearProgressIndicator( + value: downloadStarted + ? receivedBytes / totalReceiveBytes + : null, + minHeight: 13, + borderRadius: BorderRadius.circular(18), + ), + ), + ), + ], + )); } + static final ButtonStyle buttonStyle = ButtonStyle( + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(200), + ), + ), + fixedSize: MaterialStateProperty.all(const Size(180, 60)), + ); + void _onQrButtonClicked() async { final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => const QRScannerPage())); diff --git a/lib/pages/SendPage.dart b/lib/pages/SendPage.dart index 7db6c88..86d7aa5 100644 --- a/lib/pages/SendPage.dart +++ b/lib/pages/SendPage.dart @@ -3,7 +3,6 @@ import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:gap/gap.dart'; -import 'package:iyox_wormhole/utils/type_helpers.dart'; import 'package:iyox_wormhole/gen/ffi.dart'; import 'SendingPage.dart'; @@ -64,7 +63,7 @@ class _SendPageState extends State children: [ const Padding( padding: EdgeInsets.fromLTRB(20, 55, 0, 20), - child: Text("Send Files", style: TextStyle(fontSize: 41)), + child: Text("Send Files", style: TextStyle(fontSize: 40)), ), AnimatedContainer( width: double.infinity, diff --git a/lib/pages/SettingsPage.dart b/lib/pages/SettingsPage.dart index 5f57bdb..43aef41 100644 --- a/lib/pages/SettingsPage.dart +++ b/lib/pages/SettingsPage.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; class SettingsPage extends StatefulWidget { const SettingsPage({Key? key}) : super(key: key); @@ -10,10 +11,18 @@ class SettingsPage extends StatefulWidget { class _SettingsPageState extends State { @override Widget build(BuildContext context) { - return const SafeArea( - child: Scaffold( - body: Center(child: Text("Coming soon", style: TextStyle(fontSize: 23),)), - ), - ); + return const Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.fromLTRB(20, 55, 0, 20), + child: Text("Settings", style: TextStyle(fontSize: 40)), + ), + Gap(100), + Center( + child: Text("Coming soon", style: TextStyle(fontSize: 23)),) + ], + )); } } diff --git a/pubspec.yaml b/pubspec.yaml index 4ca8c3c..b62b2a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: iyox_wormhole description: Mobile Client for the magic-wormhole protocol publish_to: 'none' -version: 0.0.5+17 +version: 0.0.7+19 environment: sdk: '>=3.0.2 <4.0.0'