EDIT: how to find out outside of my class if the button has been pressed?
I tried with a method named isPressed with an @override in WaitForvalidation() but it return always "false" when I click on the button. It's like an object is remake just after the push.
My Screen Class :
class MyScreen extends StatelessWidget {
CustomRaisedButton valButton = new CustomRaisedButton();
@override
Widget build (BuildContext context) {
WaitForvalidation();
return Container(
child: valButton.build(context), // <--- Not sure that's legal...
);
}
@override
WaitForvalidation() {
// <---- HERE, I Want to know if the button was pressed !
if(valButton.isPressed())
print("Button Pressed");
}
}
My Button Class :
class CustomRaisedButton extends StatelessWidget {
bool _active = false;
CustomRaisedButton();
bool isPressed() {
return _active
}
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(bottom: 10),
child: RaisedButton(
onPressed: () {
_active = true;
},
child: Text(
"Button",
),
),
);
}
}
Thank you !