The case is I want to change the elevatedbutton child text to 'ok' when the number I input on the textfield is greater than or equals to the value of a
sample
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
int a = 1654;
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
TextEditingController controller = TextEditingController();
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
a.toString(),
),
SizedBox(height: 20),
TextField(
controller: controller,
keyboardType: TextInputType.number,
),
SizedBox(height: 20),
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(100, 50),
),
onPressed: () {},
child: Text('not ok'),
)
],
);
}
}
