The problem is simple, I have a widget called SelectBox with an "active" parameter. If active is true then there should be both the shadow and the white border, but the border doesn’t appear anymore! When active is false the border is shown. I have this problem since I updated flutter (3.27.1). Here is my widget:
class SelectBox extends StatelessWidget {
const SelectBox({super.key, required this.text, required this.active});
final bool active;
final String text;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(5)),
border: Border.all(
width: 2,
color: Colors.white,
),
boxShadow: [
if (active)
BoxShadow(
color: Colors.white.withValues(alpha: 0.7),
blurRadius: 30,
blurStyle: BlurStyle.outer,
)
]),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
child: Text(
text,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
fontSize: 20.0),
),
),
);
}
}
If I try to remove the borderRadius from the box decoration the border is displayed but it isn’t rounded! I tried different solutions, for example I tried to use two different container, one for the shadow and the other for the border but nothing to do.
2
Answers
I just copied your code and run with Flutter 3.27.1. It’s working fine for me. There should be some other issue.
your code is working perfectly in flutter 3.27.0