I got following code:
FlatButton.icon(
minWidth: double.infinity,
padding: EdgeInsets.symmetric(
vertical: kDefaultPadding,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
color: kPrimaryColor,
onPressed: () {},
icon: WebsafeSvg.asset("assets/Icons/Edit.svg", width: 16),
label: Text(
"New message",
style: TextStyle(color: Colors.white),
),
).addNeumorphism(
topShadowColor: Colors.white,
bottomShadowColor: Color(0xFF234395).withOpacity(0.2),
),
It seems the FlatButtun is now deprecated and I must convert it to TextButton but when I try that, it gives me errors for minWith parameter. When I try to wrap it with ConstrainedBox I get other errors for padding shape, etc.
I don't know how make this old code work as expected before?
As I've commented, you can't just "convert" a
FlatButton.iconto aTextButton.icon. The changes in the buttons are breaking changes made to Flutter:So, to solve your problem, you'll have to compose your own widgets to get close to
FlatButton.icon.For your example, you can use the
Paddingwidget for padding, andSizedBoxfor the width. for rounded corners, you can use thestyleproperty.Your button code can look something like this using
TextButton.icon: