InkWell buildAppBarActionItem({
Gradient gradient,
String icon,
double width = 36,
double height = 36,
double radius = 12,
Color color,
Function onpressed,
double opacity = 1,
}) {
return InkWell(
onTap: onpressed,
child: Container(
width: width,
height: height,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(radius),
),
**if(color){
color: color.withOpacity(opacity)
}
else{
gradient: StyleBtn.buildLinearGradient(begin: Alignment.topLeft, eng: Alignment.topRight)
}**
// color? color: color.withOpacity(opacity) : gradient: StyleBtn.buildLinearGradient(begin: Alignment.topLeft, eng: Alignment.topRight),
),
child: Center(
child: ImageIcon(
AssetImage("assets/icon/${icon}"),
size: 16.0,
color: MyTheme.white,
),
),
),
);
}
i want to show gradient if gradient is passed to the function or if color is passed color is shown. i have implemented this, but it's expecting an identifier. don't know how to put this and where to