fancyButton function

Widget fancyButton (
  1. SamModel sm,
  2. {double width: 140,
  3. @required Object action,
  4. @required String label,
  5. double height}
)

Return a decorated button widget adapted to the host platform.

The label is used as text on the button and the width and height control the size.

The action should be an action code from the Enums list of action code that is the companion of sm.

Implementation

Widget fancyButton(SamModel sm,{double width=140,@required Object action,@required String label,double height}) {
  return SizedBox(
    width: width,
    height: height,
    child: PlatformButton(
      material: (_, __)  => MaterialRaisedButtonData(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),),
      cupertinoFilled: (_, __) => CupertinoFilledButtonData(),
      padding:EdgeInsets.all(0.1),
      onPressed: (){sm.actionCall(action);},
      child: Text(label),
    ),
  );
}