samwig library
The samwig library contains the classes and methods that build the widgets that interface with the samcas library.
The supplied widgets adapt based on the host platform and rely on PlatformProvider
being at the
root of the widget tree.
Note that it is not mandatory to use these, you can write your own as as long as the following protocols are adopted. Namely:
- Do not update SamModel directly. Instead, call SamModel.present with a proposal for a change using SE.sa_change or some action you may write.
- The
WidgetsBinding.instance.addPostFrameCallback
callback is often useful to do post render processing.
Classes
Functions
-
buildBrokenMsg(
BuildContext context, SamModel sm, String brokenMsg) → Widget - Builds a broken message alert when a SamModel renders and is broken. [...]
- Return a basic button widget adapted to the host platform. [...]
-
fancyButton(
SamModel sm, {double width: 140, Object action, String label, double height}) → Widget - Return a decorated button widget adapted to the host platform. [...]
-
genPlatformPicker(
SamModel sm, String sym, String valStr, {Object value, String label}) → Widget - Returns a DropDown or Picker widget based on the host platform. [...]
-
genSwitch(
SamModel sm, String sym, Object label, {bool defValue: false, CheckFunc changeExec}) → Widget - Return an on/off switch widget [...]
-
getChoiceValue<
T> (BuildContext context, {String title, List< String> labels, List<T> values}) → Future<T> - Return a choice of one value out of a given list. [...]
-
inputBox(
SamModel sm, {String sym, String label, double width: 200, double height: 50, String hint, FocusFunc onFocus}) → Widget - Return an TextField widget according to the host platform. [...]
-
log(
String msg) → bool - A logging function used during development. [...]
-
row(
Widget w) → Row -
Return a singleton widget
w
into a Row list [...] -
text(
String text, {double fontSize, FontWeight fontWeight}) → Widget -
Return a Text widget populated with
text
optionally formatted with afontSize
andfontWeight
[...]
Typedefs
-
MeasureSizeCallback(
Size size) → void - Callback used by MeasuredSize