button2twoLine function
dynamic
button2twoLine(
- String name,
- String price,
- bool selected,
- dynamic callback(),
)
Implementation
button2twoLine(String name, String price, bool selected, Function() callback ){
bool enable = true;
Color color = selected ? aTheme.mainColor : Colors.grey.withAlpha(20);
return Stack(
children: <Widget>[
Container(
width: double.maxFinite,
padding: EdgeInsets.only(top: 10, bottom: 10),
decoration: BoxDecoration(
color: color, //(enable) ? color : Colors.grey.withOpacity(0.5),
borderRadius: BorderRadius.circular(aTheme.radius),
border: Border.all(color: Colors.grey.withAlpha(20)),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
spreadRadius: 1,
blurRadius: 1,
offset: Offset(1, 1),
),
],
)
// BoxDecoration(
// color: (enable) ? color : Colors.grey.withOpacity(0.5),
// borderRadius: BorderRadius.circular(_radius),
// )
,
child: Column(
children: [
Text(name, style: selected ? aTheme.style11W800W : aTheme.style11W600,
textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, maxLines: 2,),
SizedBox(height: 6,),
Text(price, style: selected ? aTheme.style11W800W : aTheme.style11W600,
textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, maxLines: 1,),
],
)
),
if (enable)
Positioned.fill(
child: Material(
color: Colors.transparent,
clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(aTheme.radius) ),
child: InkWell(
splashColor: Colors.black.withOpacity(0.2),
onTap: (){
callback();
}, // needed
)),
)
],
);
}