Skip to content

An open-source cross-platform alternative to AirDrop

feat: optimize ltr UI

Tien Do Nam72d1d083f892
diff --git a/lib/pages/receive_page.dart b/lib/pages/receive_page.dart
index 68d68a9c..8621de65 100644
--- a/lib/pages/receive_page.dart
+++ b/lib/pages/receive_page.dart
@@ -114,13 +114,13 @@ class _ReceivePageState extends ConsumerState<ReceivePage> {
label: '#${receiveState.sender.ip.visualId}',
),
if (receiveState.sender.deviceModel != null)
- Padding(
- padding: const EdgeInsets.only(left: 10),
- child: DeviceBadge(
+ ...[
+ const SizedBox(width: 10),
+ DeviceBadge(
color: Theme.of(context).colorScheme.tertiaryContainer,
label: receiveState.sender.deviceModel!,
),
- ),
+ ],
],
),
const SizedBox(height: 40),
diff --git a/lib/pages/tabs/send_tab.dart b/lib/pages/tabs/send_tab.dart
index fbb1cb4c..e8942d16 100644
--- a/lib/pages/tabs/send_tab.dart
+++ b/lib/pages/tabs/send_tab.dart
@@ -109,80 +109,69 @@ class _SendTabState extends ConsumerState<SendTab> {
] else ...[
Card(
margin: EdgeInsets.zero,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: const EdgeInsets.only(left: 15, top: 15),
- child: Text(
+ child: Padding(
+ padding: const EdgeInsets.all(15),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
t.sendTab.selection.title,
style: Theme.of(context).textTheme.subtitle1,
),
- ),
- const SizedBox(height: 5),
- Padding(
- padding: const EdgeInsets.only(left: 15),
- child: Text(t.sendTab.selection.files(files: selectedFiles.length)),
- ),
- Padding(
- padding: const EdgeInsets.only(left: 15),
- child: Text(t.sendTab.selection.size(size: selectedFiles.fold(0, (prev, curr) => prev + curr.size).asReadableFileSize)),
- ),
- const SizedBox(height: 10),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 15),
- child: SingleChildScrollView(
+ const SizedBox(height: 5),
+ Text(t.sendTab.selection.files(files: selectedFiles.length)),
+ Text(t.sendTab.selection.size(size: selectedFiles.fold(0, (prev, curr) => prev + curr.size).asReadableFileSize)),
+ const SizedBox(height: 10),
+ SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
...selectedFiles.map((file) {
- return Padding(
- padding: const EdgeInsets.only(right: 10),
- child: CrossFileThumbnail(file),
- );
- }),
+ return [
+ CrossFileThumbnail(file),
+ const SizedBox(width: 10),
+ ];
+ }).expand((e) => e),
],
),
),
- ),
- const SizedBox(height: 10),
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- TextButton(
- style: TextButton.styleFrom(
- foregroundColor: Theme.of(context).colorScheme.onSurface,
+ const SizedBox(height: 10),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ TextButton(
+ style: TextButton.styleFrom(
+ foregroundColor: Theme.of(context).colorScheme.onSurface,
+ ),
+ onPressed: () {
+ context.push(() => const SelectedFilesPage());
+ },
+ child: Text(t.general.edit),
),
- onPressed: () {
- context.push(() => const SelectedFilesPage());
- },
- child: Text(t.general.edit),
- ),
- const SizedBox(width: 15),
- ElevatedButton.icon(
- style: ElevatedButton.styleFrom(
- backgroundColor: Theme.of(context).colorScheme.primary,
- foregroundColor: Theme.of(context).colorScheme.onPrimary,
+ const SizedBox(width: 15),
+ ElevatedButton.icon(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Theme.of(context).colorScheme.primary,
+ foregroundColor: Theme.of(context).colorScheme.onPrimary,
+ ),
+ onPressed: () {
+ if (addOptions.length == 1) {
+ addOptions.first.select(context: context, ref: ref); // open directly
+ return;
+ }
+ AddFileDialog.open(
+ context: context,
+ parentRef: ref,
+ options: addOptions,
+ );
+ },
+ icon: const Icon(Icons.add),
+ label: Text(t.general.add),
),
- onPressed: () {
- if (addOptions.length == 1) {
- addOptions.first.select(context: context, ref: ref); // open directly
- return;
- }
- AddFileDialog.open(
- context: context,
- parentRef: ref,
- options: addOptions,
- );
- },
- icon: const Icon(Icons.add),
- label: Text(t.general.add),
- ),
- const SizedBox(width: 15),
- ],
- ),
- const SizedBox(height: 15),
- ],
+ ],
+ ),
+ ],
+ ),
),
),
],
diff --git a/lib/widget/list_tile/custom_list_tile.dart b/lib/widget/list_tile/custom_list_tile.dart
index 94015b26..9c7acb6f 100644
--- a/lib/widget/list_tile/custom_list_tile.dart
+++ b/lib/widget/list_tile/custom_list_tile.dart
@@ -32,10 +32,10 @@ class CustomListTile extends StatelessWidget {
child: Row(
children: [
if (icon != null)
- Padding(
- padding: const EdgeInsets.only(right: 15),
- child: icon,
- ),
+ ...[
+ icon!,
+ const SizedBox(width: 15),
+ ],
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,