Widget build(BuildContext context) {
return Expanded(
child: Container(
alignment: Alignment.center,
child: FlatButton(
color: (buttons == EQUAL_SIGN)
? Theme.of(context).primaryColor
: Color(0xFFFFFFFF),
padding: EdgeInsets.symmetric(vertical: 10.0),
child: Text(
buttons,
style: TextStyle(
color: (_colorTextButtons())
? Colors.blueAccent
: (buttons == EQUAL_SIGN)
? Theme.of(context).buttonColor
: Color(0xFF444444),
fontSize: _fontSize() ? 18 : 20.0),
),
onPressed: () => onTap(buttonText: buttons),
),
),
);
}
}
I try to replace with TextButton but nothing.
Widget build(BuildContext context) {
return Expanded(
child: Container(
alignment: Alignment.center,
child: TextButton(
color: (buttons == EQUAL_SIGN)
? Theme.of(context).primaryColor
: Color(0xFFFFFFFF),
padding: EdgeInsets.symmetric(vertical: 10.0),
child: Text(
buttons,
style: TextStyle(
color: (_colorTextButtons())
? Colors.blueAccent
: (buttons == EQUAL_SIGN)
? Theme.of(context).buttonColor
: Color(0xFF444444),
fontSize: _fontSize() ? 18 : 20.0),
),
onPressed: () => onTap(buttonText: buttons),
),
),
);
}
}
2
Answers
We don’t have any
FlatButton
on the current version of Flutter. You can useTextButton
.Find more about this breaking-changes/buttons.
You can change the
flatButton
into some other button liketextButton
; it is due to update of Flutter that made theflatButton
can’t be used anymore.Here is the example of simple usage textButton: