Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save antklim/4efb4ff8ac00c3de69507e872e17bc39 to your computer and use it in GitHub Desktop.

Select an option

Save antklim/4efb4ff8ac00c3de69507e872e17bc39 to your computer and use it in GitHub Desktop.
class _CalculatorInputState extends State<CalculatorInput> {
// Map replaced with the list
final operations = <Operation>[Add, Sub, Mul, Div, Sqrt];
...
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: <Widget>[
Row(
children: <Widget>[
DropdownButton(
// items builder updated
items: operations
.map((entry) =>
DropdownMenuItem(child: Text(entry.name), value: entry))
.toList(),
),
],
),
OperandInput(label: 'Operand A', ...)
// an instance of Operation used to switch UI view
widget.useCase.operation == Sqrt
? SizedBox(height: 68)
: OperandInput(label: 'Operand B', ...),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment