Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
EwuUwe committed Sep 26, 2024
1 parent 3ff7785 commit 8912b67
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 271 deletions.
27 changes: 10 additions & 17 deletions lib/pages/receive_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:iyox_wormhole/gen/ffi.dart';
import 'package:iyox_wormhole/pages/qr_code_scanner_page.dart';
import 'package:iyox_wormhole/utils/type_helpers.dart';
import 'package:iyox_wormhole/utils/paths.dart';
import 'package:iyox_wormhole/utils/type_helpers.dart';

class ReceivePage extends StatefulWidget {
const ReceivePage({Key? key}) : super(key: key);
Expand Down Expand Up @@ -51,9 +51,8 @@ class _ReceivePageState extends State<ReceivePage> {
controller: _controller,
enabled: !transferring,
decoration: const InputDecoration(
border: OutlineInputBorder(
borderRadius:
BorderRadius.all(Radius.circular(18))),
border:
OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(18))),
floatingLabelBehavior: FloatingLabelBehavior.auto,
label: Text('Code'),
),
Expand Down Expand Up @@ -88,9 +87,7 @@ class _ReceivePageState extends State<ReceivePage> {
icon: const Icon(Icons.sim_card_download_outlined),
)
: LinearProgressIndicator(
value: downloadStarted
? receivedBytes / totalReceiveBytes
: null,
value: downloadStarted ? receivedBytes / totalReceiveBytes : null,
minHeight: 13,
borderRadius: BorderRadius.circular(18),
),
Expand All @@ -101,17 +98,17 @@ class _ReceivePageState extends State<ReceivePage> {
}

static final ButtonStyle buttonStyle = ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(200),
),
),
fixedSize: MaterialStateProperty.all<Size>(const Size(180, 60)),
fixedSize: WidgetStateProperty.all<Size>(const Size(180, 60)),
);

void _onQrButtonClicked() async {
final result = await Navigator.push(context,
MaterialPageRoute(builder: (context) => const QRScannerPage()));
final result = await Navigator.push(
context, MaterialPageRoute(builder: (context) => const QRScannerPage()));

if (!mounted) return;

Expand All @@ -127,8 +124,7 @@ class _ReceivePageState extends State<ReceivePage> {
Future<ServerConfig> _getServerConfig() async {
final rendezvousUrl = await api.defaultRendezvousUrl();
final transitUrl = await api.defaultTransitUrl();
final serverConfig =
ServerConfig(rendezvousUrl: rendezvousUrl, transitUrl: transitUrl);
final serverConfig = ServerConfig(rendezvousUrl: rendezvousUrl, transitUrl: transitUrl);
return serverConfig;
}

Expand All @@ -145,9 +141,7 @@ class _ReceivePageState extends State<ReceivePage> {

debugPrint('code: $code');
final stream = api.requestFile(
passphrase: code,
storageFolder: downloadPath,
serverConfig: await _getServerConfig());
passphrase: code, storageFolder: downloadPath, serverConfig: await _getServerConfig());

setState(() {
transferring = true;
Expand Down Expand Up @@ -193,5 +187,4 @@ class _ReceivePageState extends State<ReceivePage> {
}
});
}

}
36 changes: 13 additions & 23 deletions lib/pages/send_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class SendPage extends StatefulWidget {
}

final ButtonStyle largeButtonStyle = ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(200),
),
),
fixedSize: MaterialStateProperty.all<Size>(const Size(150, 60)),
fixedSize: WidgetStateProperty.all<Size>(const Size(150, 60)),
);

class _SendPageState extends State<SendPage> {
Expand All @@ -38,12 +38,12 @@ class _SendPageState extends State<SendPage> {
}

static final ButtonStyle buttonStyle = ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(200),
),
),
fixedSize: MaterialStateProperty.all<Size>(const Size(150, 60)),
fixedSize: WidgetStateProperty.all<Size>(const Size(150, 60)),
);

@override
Expand Down Expand Up @@ -109,21 +109,17 @@ class _SendPageState extends State<SendPage> {
Future<ServerConfig> getServerConfig() async {
final rendezvousUrl = await api.defaultRendezvousUrl();
final transitUrl = await api.defaultTransitUrl();
final serverConfig =
ServerConfig(rendezvousUrl: rendezvousUrl, transitUrl: transitUrl);
final serverConfig = ServerConfig(rendezvousUrl: rendezvousUrl, transitUrl: transitUrl);
return serverConfig;
}

void _onSendButtonClick() async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(allowMultiple: true);
FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true);

if (mounted) {
if (result != null) {
final files = result.files
.where((element) => element.path != null)
.map((e) => e.path!)
.toList();
final files =
result.files.where((element) => element.path != null).map((e) => e.path!).toList();
Navigator.push(context, _createSendingRoute(files));
} else {
ScaffoldMessenger.of(context).showSnackBar(
Expand Down Expand Up @@ -158,15 +154,12 @@ class _SendPageState extends State<SendPage> {
Route _createSendingRoute(List<String> files,
{bool folder = false, bool causedByIntent = false}) {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => SendingPage(
files: files, folder: folder, causedByIntent: causedByIntent),
pageBuilder: (context, animation, secondaryAnimation) =>
SendingPage(files: files, folder: folder, causedByIntent: causedByIntent),
transitionDuration: const Duration(milliseconds: 0),
reverseTransitionDuration: const Duration(milliseconds: 380),
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
FadeThroughTransition(
secondaryAnimation: secondaryAnimation,
animation: animation,
child: child),
transitionsBuilder: (context, animation, secondaryAnimation, child) => FadeThroughTransition(
secondaryAnimation: secondaryAnimation, animation: animation, child: child),
);
}

Expand All @@ -186,10 +179,7 @@ class _SendPageState extends State<SendPage> {
}

void _sendIntentFile(List<SharedAttachment?> attachments) {
final paths = attachments
.where((e) => e != null)
.map((e) => e!.path)
.toList(growable: false);
final paths = attachments.where((e) => e != null).map((e) => e!.path).toList(growable: false);
if (paths.isEmpty) {
return;
}
Expand Down
Loading

0 comments on commit 8912b67

Please sign in to comment.