height: MediaQuery.of(context).size.height \* 0.1 \* buttonHeight,
color: buttonColor,
**child: FlatButton(**
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0.0),
side: BorderSide(
color: Colors.black12,
width: 1,
style: BorderStyle.solid)),
padding: EdgeInsets.all(16.0),
onPressed: () =\> buttonPressed(buttonText),
child: Text(
buttonText,
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.bold,
color: Colors.black
),
)
),
Im trying to update from flatbutton to textbutton, but it lead to other error
CodePudding user response:
After Flutter update some of Widgets are Deprecated.
You Used TextButton
instead of FlatButton
, FlatButton is deprecated by flutter.
CodePudding user response:
In TextButton, all your style should be inside the "style: ButtonStyle" like this:
TextButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
side: const BorderSide(
color: Colors.black12,
width: 2,
style: BorderStyle.solid,
),
borderRadius: BorderRadius.circular(0.0),
),
),
),
child: Text(
"CLICK ME!",
style: const TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
onPressed: () {
debugPrint("Click Button pressed");
},
),