chore: reduce padding in learning setting dropdowns (#1772)

pull/1605/head
ggurdin 9 months ago committed by GitHub
parent c72a2da7fc
commit 3af3f78d93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -47,7 +47,10 @@ class SettingsLearningView extends StatelessWidget {
child: Form(
key: controller.formKey,
child: Padding(
padding: const EdgeInsets.all(16.0),
padding: const EdgeInsets.symmetric(
vertical: 16.0,
horizontal: 8.0,
),
child: Column(
children: [
Expanded(
@ -186,6 +189,7 @@ class SettingsLearningView extends StatelessWidget {
L10n.of(context).publicProfileDesc,
),
activeColor: AppConfig.activeToggleColor,
contentPadding: EdgeInsets.zero,
),
],
),

@ -30,13 +30,19 @@ class CountryPickerDropdownState extends State<CountryPickerDropdown> {
@override
Widget build(BuildContext context) {
final countries = CountryService().getAll();
return DropdownButtonFormField2<Country>(
customButton: widget.learningController.country != null
customButton: widget.learningController.country != null &&
countries.any(
(country) =>
country.name == widget.learningController.country!.name,
)
? CountryPickerTile(
widget.learningController.country!,
isDropdown: true,
)
: null,
isExpanded: true,
decoration: InputDecoration(
labelText: L10n.of(context).countryInformation,
),
@ -44,12 +50,12 @@ class CountryPickerDropdownState extends State<CountryPickerDropdown> {
maxHeight: 300,
),
items: [
...CountryService().getAll().map(
(country) => DropdownMenuItem(
value: country,
child: CountryPickerTile(country),
),
),
...countries.map(
(country) => DropdownMenuItem(
value: country,
child: CountryPickerTile(country),
),
),
],
onChanged: widget.learningController.changeCountry,
value: widget.learningController.country,
@ -94,23 +100,28 @@ class CountryPickerTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
CountryDisplayUtil.flagEmoji(country.name),
style: const TextStyle(fontSize: 25),
),
const SizedBox(width: 10),
Text(
CountryDisplayUtil.countryDisplayName(
country.name,
context,
) ??
'',
style: const TextStyle().copyWith(
color: Theme.of(context).textTheme.bodyLarge!.color,
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
Row(
children: [
Text(
CountryDisplayUtil.flagEmoji(country.name),
style: const TextStyle(fontSize: 25),
),
const SizedBox(width: 10),
Text(
CountryDisplayUtil.countryDisplayName(
country.name,
context,
) ??
'',
style: const TextStyle().copyWith(
color: Theme.of(context).textTheme.bodyLarge!.color,
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
),
],
),
if (isDropdown)
Icon(

@ -80,7 +80,8 @@ class PLanguageDropdownState extends State<PLanguageDropdown> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DropdownButtonFormField2<LanguageModel>(
customButton: widget.initialLanguage != null
customButton: widget.initialLanguage != null &&
sortedLanguages.contains(widget.initialLanguage)
? LanguageDropDownEntry(
languageModel: widget.initialLanguage!,
isL2List: widget.isL2List,

@ -44,6 +44,7 @@ class PSettingsSwitchListTileState
@override
Widget build(BuildContext context) {
return SwitchListTile.adaptive(
contentPadding: EdgeInsets.zero,
value: currentValue,
title: Text(widget.title),
activeColor: AppConfig.activeToggleColor,

Loading…
Cancel
Save