mirror of
https://github.com/foss42/apidash.git
synced 2025-06-07 03:48:11 +08:00
Added feature of dropdowns in settings_page.py should strictly allow selection and no other interaction
This commit is contained in:
@ -66,40 +66,63 @@ class SettingsPage extends ConsumerWidget {
|
|||||||
title: const Text('Default URI Scheme'),
|
title: const Text('Default URI Scheme'),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'api.foss42.com → ${settings.defaultUriScheme}://api.foss42.com'),
|
'api.foss42.com → ${settings.defaultUriScheme}://api.foss42.com'),
|
||||||
trailing: DropdownMenu(
|
trailing: Container(
|
||||||
onSelected: (value) {
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey, width: 2.0), // Adjust border width as needed
|
||||||
|
borderRadius: BorderRadius.circular(8.0), // Adjust border radius as needed
|
||||||
|
),
|
||||||
|
child: DropdownButton<String>(
|
||||||
|
onChanged: (value) {
|
||||||
ref
|
ref
|
||||||
.read(settingsProvider.notifier)
|
.read(settingsProvider.notifier)
|
||||||
.update(defaultUriScheme: value);
|
.update(defaultUriScheme: value);
|
||||||
},
|
},
|
||||||
initialSelection: settings.defaultUriScheme,
|
value: settings.defaultUriScheme,
|
||||||
dropdownMenuEntries: kSupportedUriSchemes
|
items: kSupportedUriSchemes.map<DropdownMenuItem<String>>((String value) {
|
||||||
.map<DropdownMenuEntry<String>>((value) {
|
return DropdownMenuItem<String>(
|
||||||
return DropdownMenuEntry<String>(
|
|
||||||
value: value,
|
value: value,
|
||||||
label: value,
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16), // Adjust padding to increase size
|
||||||
|
child: Text(value),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}).toList()),
|
}).toList(),
|
||||||
|
underline: Container(),
|
||||||
|
iconSize: 30,
|
||||||
|
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: kPb10,
|
contentPadding: kPb10,
|
||||||
hoverColor: kColorTransparent,
|
hoverColor: kColorTransparent,
|
||||||
title: const Text('Default Code Generator'),
|
title: const Text('Default Code Generator'),
|
||||||
trailing: DropdownMenu(
|
trailing: Container(
|
||||||
onSelected: (value) {
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 15), // Adjust padding to increase size
|
||||||
ref
|
decoration: BoxDecoration(
|
||||||
.read(settingsProvider.notifier)
|
border: Border.all(color: Colors.grey, width: 2.0), // Add border styling
|
||||||
.update(defaultCodeGenLang: value);
|
borderRadius: BorderRadius.circular(5), // Optional: Add border radius
|
||||||
},
|
),
|
||||||
initialSelection: settings.defaultCodeGenLang,
|
child: DropdownButtonHideUnderline( // Hide the default underline
|
||||||
dropdownMenuEntries: CodegenLanguage.values
|
child: DropdownButton<CodegenLanguage>(
|
||||||
.map<DropdownMenuEntry<CodegenLanguage>>((value) {
|
value: settings.defaultCodeGenLang,
|
||||||
return DropdownMenuEntry<CodegenLanguage>(
|
onChanged: (value) {
|
||||||
value: value,
|
ref
|
||||||
label: value.label,
|
.read(settingsProvider.notifier)
|
||||||
);
|
.update(defaultCodeGenLang: value);
|
||||||
}).toList()),
|
},
|
||||||
|
items: CodegenLanguage.values.map((value) {
|
||||||
|
return DropdownMenuItem<CodegenLanguage>(
|
||||||
|
value: value,
|
||||||
|
child: Text(value.label),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onTap: () {}, // Prevent dropdown from opening on tap
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
CheckboxListTile(
|
CheckboxListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
title: const Text("Save Responses"),
|
title: const Text("Save Responses"),
|
||||||
|
Reference in New Issue
Block a user