Skip to content

An open-source cross-platform alternative to AirDrop

style: flutter format

Tien Do Namac1215251647
diff --git a/lib/pages/tabs/receive_tab.dart b/lib/pages/tabs/receive_tab.dart
index 76255a4d..bd482d1d 100644
--- a/lib/pages/tabs/receive_tab.dart
+++ b/lib/pages/tabs/receive_tab.dart
@@ -69,9 +69,7 @@ class _ReceiveTagState extends ConsumerState<ReceiveTab> with AutomaticKeepAlive
duration: const Duration(milliseconds: 300),
delay: const Duration(milliseconds: 500),
child: Text(
- serverState == null
- ? t.general.offline
- : networkInfo.localIps.map((ip) => '#${ip.visualId}').toSet().join(' '),
+ serverState == null ? t.general.offline : networkInfo.localIps.map((ip) => '#${ip.visualId}').toSet().join(' '),
style: const TextStyle(fontSize: 24),
),
),
diff --git a/lib/util/autostart_helper.dart b/lib/util/autostart_helper.dart
index 7e65debf..76571375 100644
--- a/lib/util/autostart_helper.dart
+++ b/lib/util/autostart_helper.dart
@@ -22,7 +22,6 @@ Future<void> initAutoStartAndOpenSettings() async {
} else {
await launchAtStartup.disable();
}
-
} catch (e) {
print(e);
}
diff --git a/lib/util/tray_helper.dart b/lib/util/tray_helper.dart
index 9cf1a49f..0ff4a9f1 100644
--- a/lib/util/tray_helper.dart
+++ b/lib/util/tray_helper.dart
@@ -16,7 +16,9 @@ Future<void> initTray() async {
}
try {
if (checkPlatform([TargetPlatform.windows])) {
- await trayManager.setIcon(Assets.img.logo32Ico,);
+ await trayManager.setIcon(
+ Assets.img.logo32Ico,
+ );
} else if (checkPlatform([TargetPlatform.macOS])) {
await trayManager.setIcon(Assets.img.logo32BlackWhite.path, isTemplate: true);
} else {
@@ -56,4 +58,4 @@ Future<void> showFromTray() async {
// https://github.com/localsend/localsend/issues/32
await windowManager.setSkipTaskbar(false);
}
-}
\ No newline at end of file
+}
diff --git a/lib/widget/dialogs/add_file_dialog.dart b/lib/widget/dialogs/add_file_dialog.dart
index de365f97..5d0e197a 100644
--- a/lib/widget/dialogs/add_file_dialog.dart
+++ b/lib/widget/dialogs/add_file_dialog.dart
@@ -40,10 +40,10 @@ class AddFileDialog extends StatelessWidget {
);
} else {
context.pushBottomSheet(() => CustomBottomSheet(
- title: t.dialogs.addFile.title,
- description: t.dialogs.addFile.content,
- child: AddFileDialog(parentRef: parentRef, options: options),
- ));
+ title: t.dialogs.addFile.title,
+ description: t.dialogs.addFile.content,
+ child: AddFileDialog(parentRef: parentRef, options: options),
+ ));
}
}
@@ -63,17 +63,17 @@ class AddFileDialog extends StatelessWidget {
child: option == null
? Container()
: BigButton(
- icon: option.icon,
- label: option.label,
- filled: true,
- onTap: () {
- context.popUntilRoot();
- option.select(
- context: context,
- ref: parentRef,
- );
- },
- ),
+ icon: option.icon,
+ label: option.label,
+ filled: true,
+ onTap: () {
+ context.popUntilRoot();
+ option.select(
+ context: context,
+ ref: parentRef,
+ );
+ },
+ ),
),
const SizedBox(width: 15),
];
diff --git a/lib/widget/dialogs/address_input_dialog.dart b/lib/widget/dialogs/address_input_dialog.dart
index 733c21eb..98371e8c 100644
--- a/lib/widget/dialogs/address_input_dialog.dart
+++ b/lib/widget/dialogs/address_input_dialog.dart
@@ -53,8 +53,7 @@ class _AddressInputDialogState extends ConsumerState<AddressInputDialog> {
final results = TaskRunner<Device?>(
concurrency: 10,
initialTasks: [
- for (final ip in candidates)
- () => ref.read(targetedDiscoveryProvider).discover(ip, port),
+ for (final ip in candidates) () => ref.read(targetedDiscoveryProvider).discover(ip, port),
],
).stream;
@@ -127,26 +126,24 @@ class _AddressInputDialogState extends ConsumerState<AddressInputDialog> {
'${t.general.example}: ${_mode == _InputMode.hashtag ? '123' : '${localIps.firstOrNull?.ipPrefix ?? '192.168.2'}.123'}',
style: const TextStyle(color: Colors.grey),
),
- if (_mode == _InputMode.hashtag)
- ...[
- if (localIps.length <= 1)
+ if (_mode == _InputMode.hashtag) ...[
+ if (localIps.length <= 1)
+ Text(
+ '${t.dialogs.addressInput.ip}: ${localIps.firstOrNull?.ipPrefix ?? '192.168.2'}.$_input',
+ style: const TextStyle(color: Colors.grey),
+ )
+ else ...[
+ Text(
+ '${t.dialogs.addressInput.ip}:',
+ style: const TextStyle(color: Colors.grey),
+ ),
+ for (final ip in localIps)
Text(
- '${t.dialogs.addressInput.ip}: ${localIps.firstOrNull?.ipPrefix ?? '192.168.2'}.$_input',
+ '- ${ip.ipPrefix}.$_input',
style: const TextStyle(color: Colors.grey),
- )
- else
- ...[
- Text(
- '${t.dialogs.addressInput.ip}:',
- style: const TextStyle(color: Colors.grey),
- ),
- for (final ip in localIps)
- Text(
- '- ${ip.ipPrefix}.$_input',
- style: const TextStyle(color: Colors.grey),
- ),
- ],
+ ),
],
+ ],
if (_failed)
Padding(
padding: const EdgeInsets.only(top: 10),
diff --git a/test/unit/util/task_runner_test.dart b/test/unit/util/task_runner_test.dart
index 16dbfb82..87baa743 100644
--- a/test/unit/util/task_runner_test.dart
+++ b/test/unit/util/task_runner_test.dart
@@ -8,10 +8,15 @@ void main() {
final results = TaskRunner<String?>(
concurrency: 10,
initialTasks: [
- for (final data in [[10, null], [30, 'a'], [20, 'b'], [40, 'c']])
+ for (final data in [
+ [10, null],
+ [30, 'a'],
+ [20, 'b'],
+ [40, 'c']
+ ])
() async {
- final delay = data[0] as int;
- final result = data[1] as String?;
+ final delay = data[0] as int;
+ final result = data[1] as String?;
await sleepAsync(delay);
return result;
},