button2outline function

dynamic button2outline(
  1. String text,
  2. TextStyle style,
  3. Color color,
  4. double _radius,
  5. Function _callback,
  6. bool enable,
  7. Color colorBkg,
)

Implementation

button2outline(String text, TextStyle style, Color color, double _radius, Function _callback, bool enable, Color colorBkg){
  return Stack(
    children: <Widget>[
      Container(
          width: double.maxFinite,
          padding: EdgeInsets.only(top: 10, bottom: 10),
          decoration: BoxDecoration(
            color: colorBkg,
            border: Border.all(color: color, width: 2),
            borderRadius: BorderRadius.circular(_radius),
          ),
          child: Text(text, style: style, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis,)
      ),
      if (enable)
        Positioned.fill(
          child: Material(
              color: Colors.transparent,
              clipBehavior: Clip.hardEdge,
              shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(_radius) ),
              child: InkWell(
                splashColor: Colors.black.withOpacity(0.2),
                onTap: (){
                  _callback();
                }, // needed
              )),
        )
    ],
  );
}