Skip to content

Commit cc200fb

Browse files
committed
Added feature of dropdowns in settings_page.py should strictly allow selection and no other interaction
1 parent c072358 commit cc200fb

File tree

1 file changed

+47
-24
lines changed

1 file changed

+47
-24
lines changed

lib/screens/settings_page.dart

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,40 +66,63 @@ class SettingsPage extends ConsumerWidget {
6666
title: const Text('Default URI Scheme'),
6767
subtitle: Text(
6868
'api.foss42.com → ${settings.defaultUriScheme}://api.foss42.com'),
69-
trailing: DropdownMenu(
70-
onSelected: (value) {
69+
trailing: Container(
70+
decoration: BoxDecoration(
71+
border: Border.all(color: Colors.grey, width: 2.0), // Adjust border width as needed
72+
borderRadius: BorderRadius.circular(8.0), // Adjust border radius as needed
73+
),
74+
child: DropdownButton<String>(
75+
onChanged: (value) {
7176
ref
72-
.read(settingsProvider.notifier)
73-
.update(defaultUriScheme: value);
77+
.read(settingsProvider.notifier)
78+
.update(defaultUriScheme: value);
7479
},
75-
initialSelection: settings.defaultUriScheme,
76-
dropdownMenuEntries: kSupportedUriSchemes
77-
.map<DropdownMenuEntry<String>>((value) {
78-
return DropdownMenuEntry<String>(
80+
value: settings.defaultUriScheme,
81+
items: kSupportedUriSchemes.map<DropdownMenuItem<String>>((String value) {
82+
return DropdownMenuItem<String>(
7983
value: value,
80-
label: value,
84+
child: Padding(
85+
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16), // Adjust padding to increase size
86+
child: Text(value),
87+
),
8188
);
82-
}).toList()),
89+
}).toList(),
90+
underline: Container(),
91+
iconSize: 30,
92+
93+
),
94+
),
8395
),
96+
8497
ListTile(
8598
contentPadding: kPb10,
8699
hoverColor: kColorTransparent,
87100
title: const Text('Default Code Generator'),
88-
trailing: DropdownMenu(
89-
onSelected: (value) {
90-
ref
91-
.read(settingsProvider.notifier)
92-
.update(defaultCodeGenLang: value);
93-
},
94-
initialSelection: settings.defaultCodeGenLang,
95-
dropdownMenuEntries: CodegenLanguage.values
96-
.map<DropdownMenuEntry<CodegenLanguage>>((value) {
97-
return DropdownMenuEntry<CodegenLanguage>(
98-
value: value,
99-
label: value.label,
100-
);
101-
}).toList()),
101+
trailing: Container(
102+
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 15), // Adjust padding to increase size
103+
decoration: BoxDecoration(
104+
border: Border.all(color: Colors.grey, width: 2.0), // Add border styling
105+
borderRadius: BorderRadius.circular(5), // Optional: Add border radius
106+
),
107+
child: DropdownButtonHideUnderline( // Hide the default underline
108+
child: DropdownButton<CodegenLanguage>(
109+
value: settings.defaultCodeGenLang,
110+
onChanged: (value) {
111+
ref
112+
.read(settingsProvider.notifier)
113+
.update(defaultCodeGenLang: value);
114+
},
115+
items: CodegenLanguage.values.map((value) {
116+
return DropdownMenuItem<CodegenLanguage>(
117+
value: value,
118+
child: Text(value.label),
119+
);
120+
}).toList(),
121+
onTap: () {}, // Prevent dropdown from opening on tap
122+
),
123+
),
102124
),
125+
),
103126
CheckboxListTile(
104127
contentPadding: EdgeInsets.zero,
105128
title: const Text("Save Responses"),

0 commit comments

Comments
 (0)