Skip to content

Commit

Permalink
Redesign receive page
Browse files Browse the repository at this point in the history
  • Loading branch information
EwuUwe committed Feb 18, 2024
1 parent a3bc258 commit b67bb58
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 43 deletions.
82 changes: 47 additions & 35 deletions lib/pages/ReceivePage.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -28,16 +26,20 @@ class _ReceivePageState extends State<ReceivePage> {
@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(
Expand All @@ -62,37 +64,47 @@ class _ReceivePageState extends State<ReceivePage> {
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>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(200),
),
),
fixedSize: MaterialStateProperty.all<Size>(const Size(180, 60)),
);

void _onQrButtonClicked() async {
final result = await Navigator.push(context,
MaterialPageRoute(builder: (context) => const QRScannerPage()));
Expand Down
3 changes: 1 addition & 2 deletions lib/pages/SendPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -64,7 +63,7 @@ class _SendPageState extends State<SendPage>
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,
Expand Down
19 changes: 14 additions & 5 deletions lib/pages/SettingsPage.dart
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -10,10 +11,18 @@ class SettingsPage extends StatefulWidget {
class _SettingsPageState extends State<SettingsPage> {
@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)),)
],
));
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit b67bb58

Please sign in to comment.