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.
Classes
- ButtonFactory
- A helper to create the buttons and their associated layout.
- ButtonLayout
- The layout of the buttons.
- CalculatorBlueSqrtButton
- 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.
- CalculatorButton
-
A button on the calculator keyboard.
CalculatorButton
uses a FlutterCustomPaint
with a painter that delegates back to theCalculatorButton
's paintForPainter method. This is a template method that uses the variousdrawXXX()
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. - CalculatorButtonState
- CalculatorButtonWithLJ
- The button that has LJ in blue text. Deja vu Sans has a really ugly "J", so we change the font.
- CalculatorEnterButton
- The enter button, which occupies two rows on the keyboard.
- CalculatorFButton
- The f shift button, which is gold instead of black.
- CalculatorGButton
- The g shift button, which is blue instead of black.
- CalculatorOnButton
- 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.
- 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.
- CalculatorShiftButton
- CalculatorWhiteSqrtButton
- 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.
- LandscapeButtonFactory
- PortraitButtonFactory
- UpperLabel
- The gold label above some groups of keys