view.buttons library Null safety
Buttons for the keyboard. When pressed, buttons consult the Model to see if a shift key has been pressed, and dispatch an appropriate Operation to the Controller.
The overall structure is this:
See CalculatorButton for more details.
- A helper to create the buttons and their associated layout.
- The layout of the buttons.
- The 16C's square root button, which draws an extra line above the blue label to visually complete the square-root symbol. Lining this up depends on the specific font, which is bundled with the app.
A button on the calculator keyboard.
CalculatorButtonuses a Flutter
CustomPaintwith a painter that delegates back to the
CalculatorButton's paintForPainter method. This is a template method that uses the various
drawXXX()methods and the getters defined here to draw a button. The defaults provided here work for most buttons, but are specialized for buttons that have a distinct visual appearance.
- The button that has LJ in blue text. Deja vu Sans has a really ugly "J", so we change the font.
- The enter button, which occupies two rows on the keyboard.
- The f shift button, which is gold instead of black.
- The g shift button, which is blue instead of black.
- The on/off button, which is flat on the 16C. This button also has a special function when the on button is pressed, because pressing it a second time turns the calculator off, so it's also a CalculatorOnSpecialButton.
- A CalculatorButton that has a special function when used with conjunction with the on'off button. Such buttons show text describing their special function when the on/off button has been pressed.
- The 15C's square root button, which draws an extra line above the blue label to visually complete the square-root symbol. Lining this up depends on the specific font, which is bundled with the app.
- The gold label above some groups of keys