当前,我正在尝试创建一个位于屏幕右侧的下拉菜单,当您单击它以选择一个砝码时,它将弹出在屏幕中间,并且仅显示一些砝码其余部分都用填充物包围,就像这张图片一样:(Just like this picture)
This is what mine looks like at the minute with the code.
非常感谢您!
class Weight {
int amount;
Weight(this.amount);
static List<Weight> getWeight() {
return <Weight>[
Weight(66),
Weight(67),
Weight(68),
Weight(69),
Weight(70),
Weight(71),
Weight(72),
Weight(73),
Weight(74),
Weight(75),
Weight(76),
];
}
static List<DropdownMenuItem<Weight>> buildDropdownMenuItemsWeight(
List weightAmount) {
List<DropdownMenuItem<Weight>> items = List();
for (Weight weight in weightAmount) {
items.add(DropdownMenuItem(
value: weight,
child: Text('${weight.amount} Lbs'),
));
}
return items;
}
// Bottom that I'm using on the other page, to reference the above class to display the items in dropdown.
DropdownButton(
value: _selectedWeightSystem,
items: _dropdownMenuItems,
onChanged: onChangeDropdownItemWeightSystem,
),