Skip to content

An open-source cross-platform alternative to AirDrop

feat: add expanded parameter to CustomDropdownButton

Tien Do Nam9b9660043751
diff --git a/lib/pages/receive_options_page.dart b/lib/pages/receive_options_page.dart
index 93cd0ac6..513f11eb 100644
--- a/lib/pages/receive_options_page.dart
+++ b/lib/pages/receive_options_page.dart
@@ -61,23 +61,24 @@ class ReceiveOptionsPage extends ConsumerWidget {
const SizedBox(height: 10),
Row(
children: [
- SizedBox(
- width: 100 + (t.general.off.length * 2),
- child: CustomDropdownButton<bool>(
- value: receiveSession.saveToGallery,
- items: [false, true].map((b) {
- return DropdownMenuItem(
- value: b,
- alignment: Alignment.center,
+ CustomDropdownButton<bool>(
+ value: receiveSession.saveToGallery,
+ expanded: false,
+ items: [false, true].map((b) {
+ return DropdownMenuItem(
+ value: b,
+ alignment: Alignment.center,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(b ? t.general.on : t.general.off),
- );
- }).toList(),
- onChanged: (b) {
- if (b != null) {
- ref.read(serverProvider.notifier).setSessionSaveToGallery(b);
- }
- },
- ),
+ ),
+ );
+ }).toList(),
+ onChanged: (b) {
+ if (b != null) {
+ ref.read(serverProvider.notifier).setSessionSaveToGallery(b);
+ }
+ },
),
if (receiveSession.containsDirectories && !receiveSession.saveToGallery)
...[
diff --git a/lib/widget/custom_dropdown_button.dart b/lib/widget/custom_dropdown_button.dart
index 6cf1d4da..f63d1ca2 100644
--- a/lib/widget/custom_dropdown_button.dart
+++ b/lib/widget/custom_dropdown_button.dart
@@ -7,11 +7,13 @@ class CustomDropdownButton<T> extends StatelessWidget {
final T value;
final List<DropdownMenuItem<T>> items;
final ValueChanged<T?>? onChanged;
+ final bool expanded;
const CustomDropdownButton({
required this.value,
required this.items,
this.onChanged,
+ this.expanded = true,
});
@override
@@ -21,7 +23,7 @@ class CustomDropdownButton<T> extends StatelessWidget {
shape: RoundedRectangleBorder(borderRadius: Theme.of(context).inputDecorationTheme.borderRadius),
child: DropdownButton<T>(
value: value,
- isExpanded: true,
+ isExpanded: expanded,
underline: Container(),
borderRadius: Theme.of(context).inputDecorationTheme.borderRadius,
items: items,