Last active
November 9, 2020 21:36
-
-
Save antklim/4efb4ff8ac00c3de69507e872e17bc39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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