genPlatformPicker function
Returns a DropDown or Picker widget based on the host platform.
This widget is used to ask the user to select from a list of values.
On the Material platform it will be a drop-down list.
On the Cupertino platform it will be the Picker widget.
The value
option if present will be used to set the initial value and assumes the SamHot value
has the same value. This can be guaranteed by specifying initial:sm.getHot(sym)
and making sure
the SamHot value of sym
has a value that is in the universe of item values described below.
The label
parameter if present is added as a label to the widget.
The valStr
string represents the universe of items to choose from. Each item is separated by a "/".
If the item has a ":", it is split on the ":" and the first part is treated as the item label and the
second part as the choice value.
Here is a complete call as an example used in sample missile app. In this
case the sym
value is contained in a variable but it could be a literal.
genPlatformPicker(sm, symBanks, "0/1/2/3", value:"1",label:" Banks: ")
Implementation
Widget genPlatformPicker(SamModel sm,String sym,String valStr,{Object value,String label}) {
return PlatformWidget(
material:(_,__) => _genDropdown(sm,sym,valStr,value:value,label:label),
cupertino:(_,__) => _genPicker(sm,sym,valStr,value:value,label:label),
);
}