How to call multiple reactions/actions when OnPress in ElevatedButton

0

I try to run 2 Functions when I press the login button, but don't work

I'm use MobX, and here is my code:

Observer(builder: (_) {
                          return ElevatedButton(
                            onPressed:
                                dadosLogin.apertouLogin as void Function()?,
                            child: dadosLogin.carregando
                                ? SizedBox(
                                    height: altura / 40,
                                    width: largura / 20,
                                    child: CircularProgressIndicator(
                                      strokeWidth: largura / 200,
                                      valueColor: AlwaysStoppedAnimation(
                                        Color(0xFFFFFFFF),
                                      ),
                                    ),
                                  )
                                : Text(
                                    "LOGIN",
                                    style: TextStyle(),
                                  ),
                          );

With this code I run only this:

@computed
  Function? get apertouLogin =>
      (loginOK && !carregando && senhaOK) ? logando : null;

But, i'm need this to

 @computed
  Function? get puxandoLogin => (!carregando) ? puxando : null;

This:

onPressed: () {
  functionOne as void Function();
  functionTwo as void Function();
}

Don't work

flutter
dart
mobx
asked on Stack Overflow Apr 26, 2021 by efe • edited Apr 26, 2021 by efe

1 Answer

0
onPressed: () {
  functionOne as void Function();
  functionTwo as void Function();
}
answered on Stack Overflow Apr 26, 2021 by Ujjwal Raijada

User contributions licensed under CC BY-SA 3.0