CalculatorButton class Null safety

A button on the calculator keyboard. CalculatorButton uses a Flutter CustomPaint with 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.


A CalculatorButton is associated with three Operations, one when unshifted, and one each for the f ang g shift states. On a button press, the button consults the model to find the current shift status, and dispatches the correct Operation to the Controller. This could be done with a switch statement, but since this application uses the GoF state pattern so heavily, I did that -- see ShiftKey.select.

Inheritance
Mixed in types
Implementers

Constructors

CalculatorButton(ButtonFactory bFactory, String uText, String fText, String gText, Operation uKey, Operation fKey, Operation gKey, String acceleratorKey, {String? acceleratorLabel, Key? key})

Properties

acceleratorKey String
Key (or keys) to generate a press of this button
final
acceleratorLabel String
read-only
bFactory ButtonFactory
final
fKey Operation
final
fText String
final
gKey Operation
final
gText String
final
gTextOffset Offset
read-only
hashCode int
The hash code for this object.
read-onlyinherited
height double
read-only
innerBorder RRect
read-only
innerBorderColor Color
read-only
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyTextOffset Offset
read-only
keyTextStyle TextStyle
read-only
lowerSurface RRect
read-only
lowerSurfaceColor Color
read-only
lowerSurfaceColorPressed Color
read-only
outerBorder RRect
read-only
outerBorderPressedScale double
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
uKey Operation
final
upperSurface RRect
read-only
upperSurfaceColor Color
read-only
upperSurfaceColorPressed Color
read-only
uText String
final
width double
read-only

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() CalculatorButtonState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
drawBlueText(Canvas canvas, double w) → void
drawGoldText(Canvas canvas, double w) → void
drawKeyboardAccelerator(Canvas canvas) → void
drawText(Canvas canvas, TextStyle style, String text, double w, Offset offset) → void
drawWhiteText(Canvas canvas, TextStyle style, String text, double w) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
paintForPainter(Canvas canvas, Size size, {required bool pressed, required bool pressedFromKeyboard, required bool showAccelerators}) → void
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited