Skip to content

An open-source cross-platform alternative to AirDrop

feat: update send mode popup

Tien Do Namb75f53c3889b
diff --git a/assets/i18n/_missing_translations_ar.json b/assets/i18n/_missing_translations_ar.json
index 23843ad3..6eb87a91 100644
--- a/assets/i18n/_missing_translations_ar.json
+++ b/assets/i18n/_missing_translations_ar.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_bn.json b/assets/i18n/_missing_translations_bn.json
index ed2e1c39..aeaa9fc4 100644
--- a/assets/i18n/_missing_translations_bn.json
+++ b/assets/i18n/_missing_translations_bn.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -80,6 +81,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_es_ES.json b/assets/i18n/_missing_translations_es_ES.json
index c57302db..8f1a6a0e 100644
--- a/assets/i18n/_missing_translations_es_ES.json
+++ b/assets/i18n/_missing_translations_es_ES.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -58,6 +59,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_fr_FR.json b/assets/i18n/_missing_translations_fr_FR.json
index 9383fa62..dd8a3994 100644
--- a/assets/i18n/_missing_translations_fr_FR.json
+++ b/assets/i18n/_missing_translations_fr_FR.json
@@ -9,7 +9,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -24,6 +25,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_hu.json b/assets/i18n/_missing_translations_hu.json
index b7699394..b87626af 100644
--- a/assets/i18n/_missing_translations_hu.json
+++ b/assets/i18n/_missing_translations_hu.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -33,6 +34,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_in.json b/assets/i18n/_missing_translations_in.json
index fd14f1ce..9fa304bb 100644
--- a/assets/i18n/_missing_translations_in.json
+++ b/assets/i18n/_missing_translations_in.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -80,6 +81,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_it.json b/assets/i18n/_missing_translations_it.json
index 9b3c36a8..f1942ab7 100644
--- a/assets/i18n/_missing_translations_it.json
+++ b/assets/i18n/_missing_translations_it.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -80,6 +81,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_iw.json b/assets/i18n/_missing_translations_iw.json
index d3274aec..571973ad 100644
--- a/assets/i18n/_missing_translations_iw.json
+++ b/assets/i18n/_missing_translations_iw.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_ja.json b/assets/i18n/_missing_translations_ja.json
index ae05da86..1e3d23c9 100644
--- a/assets/i18n/_missing_translations_ja.json
+++ b/assets/i18n/_missing_translations_ja.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -33,6 +34,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_ko.json b/assets/i18n/_missing_translations_ko.json
index a25eceb4..82e3046b 100644
--- a/assets/i18n/_missing_translations_ko.json
+++ b/assets/i18n/_missing_translations_ko.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -80,6 +81,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_ne.json b/assets/i18n/_missing_translations_ne.json
index 2916948b..8f699093 100644
--- a/assets/i18n/_missing_translations_ne.json
+++ b/assets/i18n/_missing_translations_ne.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_nl.json b/assets/i18n/_missing_translations_nl.json
index 82695101..ffdce4ca 100644
--- a/assets/i18n/_missing_translations_nl.json
+++ b/assets/i18n/_missing_translations_nl.json
@@ -9,7 +9,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -19,5 +20,13 @@
"receiveHistoryPage": {
"openFolder": "Open folder",
"deleteHistory": "Delete history"
+ },
+ "dialogs": {
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
+ }
}
}
diff --git a/assets/i18n/_missing_translations_pl.json b/assets/i18n/_missing_translations_pl.json
index b01b610f..6c6156b2 100644
--- a/assets/i18n/_missing_translations_pl.json
+++ b/assets/i18n/_missing_translations_pl.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_pt_BR.json b/assets/i18n/_missing_translations_pt_BR.json
index f980d8aa..3f6c4572 100644
--- a/assets/i18n/_missing_translations_pt_BR.json
+++ b/assets/i18n/_missing_translations_pt_BR.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -69,6 +70,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_ru.json b/assets/i18n/_missing_translations_ru.json
index ce13f2b4..deeb2e5a 100644
--- a/assets/i18n/_missing_translations_ru.json
+++ b/assets/i18n/_missing_translations_ru.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_sv.json b/assets/i18n/_missing_translations_sv.json
index 7390bd0a..3308afc3 100644
--- a/assets/i18n/_missing_translations_sv.json
+++ b/assets/i18n/_missing_translations_sv.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_tr.json b/assets/i18n/_missing_translations_tr.json
index b445bbbf..086ea2da 100644
--- a/assets/i18n/_missing_translations_tr.json
+++ b/assets/i18n/_missing_translations_tr.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -52,6 +53,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_uk.json b/assets/i18n/_missing_translations_uk.json
index b6bf7f82..5f2de3a3 100644
--- a/assets/i18n/_missing_translations_uk.json
+++ b/assets/i18n/_missing_translations_uk.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_zh_Hans.json b/assets/i18n/_missing_translations_zh_Hans.json
index e76443c3..86360105 100644
--- a/assets/i18n/_missing_translations_zh_Hans.json
+++ b/assets/i18n/_missing_translations_zh_Hans.json
@@ -1,7 +1,17 @@
{
"@@info": [
"Here are translations that exist in <en> but not in <zh-Hans>.",
- "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hans' to quickly apply the newly added translations.",
- "Congratulations! There are no missing translations! :)"
- ]
+ "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hans' to quickly apply the newly added translations."
+ ],
+ "sendTab": {
+ "sendModeHelp": "Explanation"
+ },
+ "dialogs": {
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
+ }
+ }
}
diff --git a/assets/i18n/_missing_translations_zh_Hant_HK.json b/assets/i18n/_missing_translations_zh_Hant_HK.json
index 8242ccb4..be6bf608 100644
--- a/assets/i18n/_missing_translations_zh_Hant_HK.json
+++ b/assets/i18n/_missing_translations_zh_Hant_HK.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -86,6 +87,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_missing_translations_zh_Hant_TW.json b/assets/i18n/_missing_translations_zh_Hant_TW.json
index 41f0c317..8e4654b9 100644
--- a/assets/i18n/_missing_translations_zh_Hant_TW.json
+++ b/assets/i18n/_missing_translations_zh_Hant_TW.json
@@ -12,7 +12,8 @@
"single": "Single recipient",
"multiple": "Multiple recipients",
"link": "Share via link"
- }
+ },
+ "sendModeHelp": "Explanation"
},
"settingsTab": {
"receive": {
@@ -33,6 +34,12 @@
"notAvailableOnPlatform": {
"title": "Not available",
"content": "This feature is only available on:"
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
}
}
diff --git a/assets/i18n/_unused_translations.json b/assets/i18n/_unused_translations.json
index bf447c70..a70e168b 100644
--- a/assets/i18n/_unused_translations.json
+++ b/assets/i18n/_unused_translations.json
@@ -14,9 +14,10 @@
"link": "Share via link"
}
},
- "receiveHistoryPage": {
- "openFolder": "Open folder",
- "deleteHistory": "Delete history"
+ "dialogs": {
+ "sendModeHelp": {
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
+ }
}
},
"ar": {},
diff --git a/assets/i18n/strings.i18n.json b/assets/i18n/strings.i18n.json
index 7c7c1922..1cbd98d9 100644
--- a/assets/i18n/strings.i18n.json
+++ b/assets/i18n/strings.i18n.json
@@ -68,6 +68,7 @@
"multiple": "Multiple recipients",
"link": "Share via link"
},
+ "sendModeHelp": "Explanation",
"help": "Please ensure that the desired target is also in the same wifi network.",
"placeItems": "Place items to share."
},
@@ -318,6 +319,12 @@
"quickSaveNotice": {
"title": "@:general.quickSave",
"content": "File requests are automatically accepted. Be aware that everyone in the local network can send you files."
+ },
+ "sendModeHelp": {
+ "title": "Send modes",
+ "single": "Sends files to one recipient. Selection will be cleared after finished file transfer.",
+ "multiple": "Sends files to multiple recipients. Selection will not be cleared.",
+ "link": "Recipients who do not have LocalSend installed can download the selected files by opening the link in their browser."
}
},
"tray": {
diff --git a/assets/i18n/strings_de.i18n.json b/assets/i18n/strings_de.i18n.json
index 79496906..4a1ac059 100644
--- a/assets/i18n/strings_de.i18n.json
+++ b/assets/i18n/strings_de.i18n.json
@@ -62,12 +62,13 @@
"nearbyDevices": "Geräte in der Nähe",
"thisDevice": "Dieses Gerät",
"scan": "Geräte suchen",
- "sendMode": "Sende-Modus",
+ "sendMode": "Sendemodus",
"sendModes": {
"single": "Einzelner Empfänger",
"multiple": "Mehrere Empfänger",
"link": "Per Link teilen"
},
+ "sendModeHelp": "Erklärung",
"help": "Bitte stelle sicher, dass sich das gewünschte Ziel auch im selben WLAN-Netzwerk befindet.",
"placeItems": "Dateien ablegen, um zu teilen."
},
@@ -248,6 +249,12 @@
"quickSaveNotice": {
"title": "@:general.quickSave",
"content": "Dateianfragen werden automatisch akzeptiert. Beachte, dass jeder im lokalen Netzwerk dir Dateien senden kann."
+ },
+ "sendModeHelp": {
+ "title": "Sendemodus",
+ "single": "Sende Dateien an einen Empfänger. Die Auswahl wird gelöscht, sobald die Übertragung abgeschlossen ist.",
+ "multiple": "Sende Dateien an mehrere Empfänger. Die Auswahl bleibt erhalten.",
+ "link": "Empfänger, die LocalSend nicht installiert haben, können die ausgewählten Dateien herunterladen, in dem sie den Link im Browser öffnen."
}
},
"tray": {
diff --git a/lib/model/send_mode.dart b/lib/model/send_mode.dart
new file mode 100644
index 00000000..438122c3
--- /dev/null
+++ b/lib/model/send_mode.dart
@@ -0,0 +1,5 @@
+enum SendMode {
+ single, // 1:1 file transfer
+ multiple, // 1:n file transfer
+ link, // 1:n file transfer but receiver needs to initiate
+}
diff --git a/lib/model/state/settings_state.dart b/lib/model/state/settings_state.dart
index 23b8119d..ba671867 100644
--- a/lib/model/state/settings_state.dart
+++ b/lib/model/state/settings_state.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:localsend_app/gen/strings.g.dart';
+import 'package:localsend_app/model/send_mode.dart';
part 'settings_state.freezed.dart';
@@ -19,5 +20,6 @@ class SettingsState with _$SettingsState {
required bool minimizeToTray, // minimize to tray instead of exiting the app
required bool autoStartLaunchMinimized, // start hidden in tray (only available when launchAtStartup is true)
required bool https,
+ required SendMode sendMode,
}) = _SettingsState;
}
diff --git a/lib/pages/tabs/send_tab.dart b/lib/pages/tabs/send_tab.dart
index 49e97a22..0c14405f 100644
--- a/lib/pages/tabs/send_tab.dart
+++ b/lib/pages/tabs/send_tab.dart
@@ -10,10 +10,12 @@ import 'package:localsend_app/provider/network/scan_provider.dart';
import 'package:localsend_app/provider/network/send_provider.dart';
import 'package:localsend_app/provider/network_info_provider.dart';
import 'package:localsend_app/provider/selection/selected_sending_files_provider.dart';
+import 'package:localsend_app/provider/settings_provider.dart';
import 'package:localsend_app/util/file_picker.dart';
import 'package:localsend_app/util/file_size_helper.dart';
import 'package:localsend_app/util/platform_check.dart';
import 'package:localsend_app/widget/custom_icon_button.dart';
+import 'package:localsend_app/widget/dialogs/send_mode_help_dialog.dart';
import 'package:localsend_app/widget/opacity_slideshow.dart';
import 'package:localsend_app/widget/big_button.dart';
import 'package:localsend_app/widget/dialogs/add_file_dialog.dart';
@@ -26,6 +28,8 @@ import 'package:localsend_app/widget/responsive_list_view.dart';
import 'package:localsend_app/widget/rotating_widget.dart';
import 'package:routerino/routerino.dart';
+import '../../model/send_mode.dart';
+
const _horizontalPadding = 15.0;
class SendTab extends ConsumerStatefulWidget {
@@ -203,42 +207,8 @@ class _SendTabState extends ConsumerState<SendTab> {
child: const Icon(Icons.ads_click),
),
),
- Tooltip(
- message: t.sendTab.sendMode,
- child: _CircularPopupButton(
- tooltip: t.sendTab.sendMode,
- onSelected: (i) => print('SEL $i'),
- itemBuilder: (_) => [
- PopupMenuItem(
- value: 0,
- // padding: const EdgeInsets.only(left: 12, right: 2),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Icon(Icons.send),
- const SizedBox(width: 10),
- Text(t.sendTab.sendModes.single),
- ],
- ),
- ),
- PopupMenuItem(
- value: 1,
- // padding: const EdgeInsets.only(left: 12, right: 2),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- const Icon(Icons.share),
- const SizedBox(width: 10),
- Text(t.sendTab.sendModes.multiple),
- ],
- ),
- ),
- ],
- child: const Padding(
- padding: EdgeInsets.all(8),
- child: Icon(Icons.settings),
- ),
- ),
+ _SendModeButton(
+ onSelect: (mode) => ref.read(settingsProvider.notifier).setSendMode(mode),
),
],
),
@@ -421,3 +391,91 @@ class _RotatingSyncIcon extends ConsumerWidget {
);
}
}
+
+class _SendModeButton extends StatelessWidget {
+ final void Function(SendMode mode) onSelect;
+
+ const _SendModeButton({required this.onSelect});
+
+ @override
+ Widget build(BuildContext context) {
+ return _CircularPopupButton<int>(
+ tooltip: t.sendTab.sendMode,
+ onSelected: (mode) {
+ switch (mode) {
+ case 0:
+ onSelect(SendMode.single);
+ break;
+ case 1:
+ onSelect(SendMode.multiple);
+ break;
+ case -1:
+ showDialog(context: context, builder: (_) => const SendModeHelpDialog());
+ break;
+ }
+ },
+ itemBuilder: (_) => [
+ PopupMenuItem(
+ value: 0,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Consumer(
+ builder: (BuildContext context, WidgetRef ref, Widget? child) {
+ final sendMode = ref.watch(settingsProvider.select((s) => s.sendMode));
+ return Visibility(
+ visible: sendMode == SendMode.single,
+ maintainSize: true,
+ maintainAnimation: true,
+ maintainState: true,
+ child: const Icon(Icons.check_circle),
+ );
+ },
+ ),
+ const SizedBox(width: 10),
+ Text(t.sendTab.sendModes.single),
+ ],
+ ),
+ ),
+ PopupMenuItem(
+ value: 1,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Consumer(
+ builder: (BuildContext context, WidgetRef ref, Widget? child) {
+ final sendMode = ref.watch(settingsProvider.select((s) => s.sendMode));
+ return Visibility(
+ visible: sendMode == SendMode.multiple,
+ maintainSize: true,
+ maintainAnimation: true,
+ maintainState: true,
+ child: const Icon(Icons.check_circle),
+ );
+ },
+ ),
+ const SizedBox(width: 10),
+ Text(t.sendTab.sendModes.multiple),
+ ],
+ ),
+ ),
+ const PopupMenuDivider(),
+ PopupMenuItem(
+ value: -1,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Icon(Icons.help),
+ const SizedBox(width: 10),
+ Text(t.sendTab.sendModeHelp),
+ ],
+ ),
+ ),
+ ],
+ child: const Padding(
+ padding: EdgeInsets.all(8),
+ child: Icon(Icons.settings),
+ ),
+ );
+ }
+}
diff --git a/lib/provider/persistence_provider.dart b/lib/provider/persistence_provider.dart
index 81cd0249..f2e4c923 100644
--- a/lib/provider/persistence_provider.dart
+++ b/lib/provider/persistence_provider.dart
@@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:localsend_app/constants.dart';
import 'package:localsend_app/gen/strings.g.dart';
import 'package:localsend_app/model/receive_history_entry.dart';
+import 'package:localsend_app/model/send_mode.dart';
import 'package:localsend_app/util/alias_generator.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:uuid/uuid.dart';
@@ -33,6 +34,7 @@ const _quickSave = 'ls_quick_save';
const _minimizeToTray = 'ls_minimize_to_tray';
const _autoStartLaunchMinimized = 'ls_auto_start_launch_minimized';
const _https = 'ls_https';
+const _sendMode = 'ls_send_mode';
/// This service abstracts the persistence layer.
class PersistenceService {
@@ -179,4 +181,12 @@ class PersistenceService {
Future<void> setHttps(bool https) async {
await _prefs.setBool(_https, https);
}
+
+ SendMode getSendMode() {
+ return SendMode.values.firstWhereOrNull((m) => m.name == _prefs.getString(_sendMode)) ?? SendMode.single;
+ }
+
+ Future<void> setSendMode(SendMode mode) async {
+ await _prefs.setString(_sendMode, mode.name);
+ }
}
diff --git a/lib/provider/settings_provider.dart b/lib/provider/settings_provider.dart
index 0fb69adc..4cef8fc7 100644
--- a/lib/provider/settings_provider.dart
+++ b/lib/provider/settings_provider.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:localsend_app/gen/strings.g.dart';
+import 'package:localsend_app/model/send_mode.dart';
import 'package:localsend_app/model/state/settings_state.dart';
import 'package:localsend_app/provider/persistence_provider.dart';
@@ -28,6 +29,7 @@ class SettingsNotifier extends StateNotifier<SettingsState> {
minimizeToTray: service.isMinimizeToTray(),
autoStartLaunchMinimized: service.isAutoStartLaunchMinimized(),
https: service.isHttps(),
+ sendMode: service.getSendMode(),
);
}
@@ -107,4 +109,11 @@ class SettingsNotifier extends StateNotifier<SettingsState> {
https: https,
);
}
+
+ Future<void> setSendMode(SendMode mode) async {
+ await _service.setSendMode(mode);
+ state = state.copyWith(
+ sendMode: mode,
+ );
+ }
}
diff --git a/lib/widget/dialogs/send_mode_help_dialog.dart b/lib/widget/dialogs/send_mode_help_dialog.dart
new file mode 100644
index 00000000..f4a061ff
--- /dev/null
+++ b/lib/widget/dialogs/send_mode_help_dialog.dart
@@ -0,0 +1,55 @@
+import 'package:flutter/material.dart';
+import 'package:localsend_app/gen/strings.g.dart';
+import 'package:routerino/routerino.dart';
+
+class SendModeHelpDialog extends StatelessWidget {
+ const SendModeHelpDialog();
+
+ @override
+ Widget build(BuildContext context) {
+ return AlertDialog(
+ title: Text(t.dialogs.sendModeHelp.title),
+ content: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _SendModeItem(
+ mode: t.sendTab.sendModes.single,
+ explanation: t.dialogs.sendModeHelp.single,
+ ),
+ const SizedBox(height: 10),
+ _SendModeItem(
+ mode: t.sendTab.sendModes.multiple,
+ explanation: t.dialogs.sendModeHelp.multiple,
+ ),
+ ],
+ ),
+ actions: [
+ TextButton(
+ onPressed: () => context.pop(),
+ child: Text(t.general.close),
+ )
+ ],
+ );
+ }
+}
+
+class _SendModeItem extends StatelessWidget {
+ final String mode;
+ final String explanation;
+ const _SendModeItem({
+ required this.mode,
+ required this.explanation,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(mode, style: const TextStyle(fontWeight: FontWeight.bold)),
+ Text(explanation),
+ ],
+ );
+ }
+}