Skip to content

Commit d04d4b5

Browse files
committed
add support for folder selection on desktop platforms only
1 parent 54e23ba commit d04d4b5

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

lib/features/nearby/nearby_page.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class _NearbyPageState extends State<NearbyPage> {
3434
bool get _supportsDesktopDrop =>
3535
!kIsWeb && (Platform.isWindows || Platform.isLinux);
3636

37+
bool get _supportsFolderSelection =>
38+
!kIsWeb && !Platform.isAndroid && !Platform.isIOS;
39+
3740
@override
3841
void dispose() {
3942
_textController.dispose();
@@ -153,13 +156,14 @@ class _NearbyPageState extends State<NearbyPage> {
153156
icon: const Icon(Icons.videocam),
154157
label: Text(l10n.contentVideo),
155158
),
156-
OutlinedButton.icon(
157-
onPressed: _isPreparingItems || draft.isSending
158-
? null
159-
: () => _pickByType(TransferPayloadType.folder),
160-
icon: const Icon(Icons.folder),
161-
label: Text(l10n.contentFolder),
162-
),
159+
if (_supportsFolderSelection)
160+
OutlinedButton.icon(
161+
onPressed: _isPreparingItems || draft.isSending
162+
? null
163+
: () => _pickByType(TransferPayloadType.folder),
164+
icon: const Icon(Icons.folder),
165+
label: Text(l10n.contentFolder),
166+
),
163167
],
164168
),
165169
const SizedBox(height: 14),

lib/state/app_controller.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ class AppController extends ChangeNotifier {
656656
}
657657

658658
Future<int> addDraftItemsFromType(TransferPayloadType type) async {
659+
if (type == TransferPayloadType.folder &&
660+
(Platform.isAndroid || Platform.isIOS)) {
661+
return 0;
662+
}
659663
final items = await _payloadBuilder.pickByType(type);
660664
_sendDraft = _sendDraft.addItems(items);
661665
notifyListeners();

0 commit comments

Comments
 (0)