changing layout sizes
This commit is contained in:
parent
3a5caece03
commit
12d755d810
1 changed files with 23 additions and 24 deletions
|
|
@ -25,31 +25,30 @@ class UnitDropdown extends StatelessWidget {
|
||||||
width: 50, // Constrain dropdown width
|
width: 50, // Constrain dropdown width
|
||||||
child: DropdownButton<String>(
|
child: DropdownButton<String>(
|
||||||
value: selectedUnit ?? variable.unit,
|
value: selectedUnit ?? variable.unit,
|
||||||
selectedItemBuilder: (context) => availableUnits.map((unit) =>
|
selectedItemBuilder: (context) => availableUnits
|
||||||
SizedBox(
|
.map((unit) => SizedBox(width: 50, child: Text(unit.symbol, overflow: TextOverflow.ellipsis)))
|
||||||
width: 200,
|
.toList(),
|
||||||
child: Text(unit.symbol, overflow: TextOverflow.ellipsis),
|
icon: const Icon(Icons.arrow_drop_down),
|
||||||
)
|
elevation: 16,
|
||||||
).toList(),
|
style: TextStyle(color: Theme.of(context).colorScheme.primary, fontSize: 14),
|
||||||
icon: const Icon(Icons.arrow_drop_down),
|
underline: Container(height: 1, color: Theme.of(context).dividerColor),
|
||||||
elevation: 16,
|
onChanged: onUnitChanged,
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.primary, fontSize: 14),
|
items: availableUnits.map<DropdownMenuItem<String>>((UnitSpec unit) {
|
||||||
underline: Container(height: 1, color: Theme.of(context).dividerColor),
|
return DropdownMenuItem<String>(
|
||||||
onChanged: onUnitChanged,
|
value: unit.name,
|
||||||
items: availableUnits.map<DropdownMenuItem<String>>((UnitSpec unit) {
|
child: SizedBox(
|
||||||
return DropdownMenuItem<String>(
|
width: 300, // Fixed width for all items
|
||||||
value: unit.name,
|
child: Text(
|
||||||
child: SizedBox(
|
"${unit.symbol} - ${unit.name}",
|
||||||
width: 200, // Fixed width for all items
|
style: const TextStyle(fontSize: 14),
|
||||||
child: Text("${unit.symbol} - ${unit.name}",
|
overflow: TextOverflow.ellipsis,
|
||||||
style: const TextStyle(fontSize: 14),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}).toList(),
|
||||||
}).toList(),
|
menuWidth: 300,
|
||||||
menuMaxHeight: 400,
|
menuMaxHeight: 400,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue