Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Widgets Not being Displayed on 2.0.1 #34

Open
menezes85 opened this issue Mar 3, 2023 · 7 comments
Open

Custom Widgets Not being Displayed on 2.0.1 #34

menezes85 opened this issue Mar 3, 2023 · 7 comments

Comments

@menezes85
Copy link

Hello, i was using 1.1.0, after update o 2.0.1, custom widgets stopped working on alerts.

@emrade
Copy link
Owner

emrade commented Mar 3, 2023

Hi @menezes85, can you give me a sample of what the custom widget looks like? So i can replicate it.

@menezes85
Copy link
Author

menezes85 commented Mar 28, 2023

 buildTravelConfirmationWidget(
      {
      Color? corTextNormal,
      double? tamanhoTexto,
      double? spaceBetweenWidgets,
      FontWeight? weigthTextoNormal,
      FontWeight? weigthSubtitulo,
      required double valorViagem,
      required  String formaPagamento
      })
  {
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.start,
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children:
      [
        RichText(text: TextSpan(text: 'Source: ',
            children:
            [
              TextSpan(text: originController.text,
                  style: TextStyle(color: corTextNormal, fontWeight: weigthTextoNormal, fontSize: tamanhoTexto))
            ],
            style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: tamanhoTexto))),//, textAlign: TextAlign.center),
        SizedBox(height: spaceBetweenWidgets),
        RichText(text: TextSpan(text: 'Destiny: ',
            children:
            [
              TextSpan(text: destinationController.text,
                  style: TextStyle(color: corTextNormal, fontWeight: weigthTextoNormal, fontSize: tamanhoTexto))
            ], style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: tamanhoTexto))),//, textAlign: TextAlign.center),

        SizedBox(height: spaceBetweenWidgets),
        RichText(text: TextSpan(text: 'Distância: ',
            children:
            [
              TextSpan(text: distancia,
                  style: TextStyle(color: corTextNormal, fontWeight: weigthTextoNormal, fontSize: tamanhoTexto))
            ], style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: tamanhoTexto))),//, textAlign: TextAlign.center),

        SizedBox(height: spaceBetweenWidgets),
        RichText(text: TextSpan(text: 'Type: ',
            children:
            [
              TextSpan(text: controller.tipoCorridaSelecionado.value,
                  style: TextStyle(color: corTextNormal, fontWeight: weigthTextoNormal, fontSize: tamanhoTexto))
            ], style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: tamanhoTexto))),//, textAlign: TextAlign.center),

        SizedBox(height: spaceBetweenWidgets),
        RichText(text: TextSpan(text: 'Value: ',
            children:
            [
              TextSpan(text: UtilBrasilFields.obterReal(valorViagem.toDouble()),
                  style: TextStyle(color: corTextNormal, fontWeight: weigthTextoNormal, fontSize: tamanhoTexto))
            ], style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: tamanhoTexto))),

        SizedBox(height: spaceBetweenWidgets),
        RichText(text: TextSpan(text: 'Payment Method: ',
            children:
            [
              TextSpan(text: formaPagamento,
                  style: TextStyle(color: corTextNormal, fontWeight: weigthTextoNormal, fontSize: tamanhoTexto))
            ], style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: tamanhoTexto))),

        SizedBox(height: spaceBetweenWidgets),
        RichText(text: TextSpan(text: 'Elapsed Time: ',
            children:
            [
              TextSpan(text: tempoViagem,
                  style: TextStyle(color: corTextNormal, fontWeight: weigthTextoNormal, fontSize: tamanhoTexto))
            ], style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: tamanhoTexto))),//, textAlign: TextAlign.center),

        SizedBox(height: spaceBetweenWidgets),

      
        SizedBox(height: spaceBetweenWidgets),

      ],
    );
  }

@menezes85
Copy link
Author

menezes85 commented Mar 28, 2023

call: 
util.showCoolAlert(text:  '',
        title: 'Confirm Travel ?',
        barrierDismissible: false,
        coolAlertType: CoolAlertType.confirm,
        customWidget:
        buildTravelConfirmationWidget(
            weigthTextoNormal: weigthTextoNormal,
            corTextNormal: corTextNormal,
            tamanhoTexto: tamanhoTexto,
            spaceBetweenWidgets: spaceBetweenWidgets,
            weigthSubtitulo: weigthSubtitulo,
            formaPagamento: formaPagamento,
            valorViagem: valor
        ),`

@menezes85
Copy link
Author

on version 1.1.0 my custom widget is displayed normally, on 2.0.1, nothing is showed. i cant upgrade package without this, most part of my alerts uses custom widgets

@menezes85
Copy link
Author

Any update?

@menezes85 menezes85 reopened this Apr 24, 2023
@menezes85
Copy link
Author

Found the Error:
image

@menezes85
Copy link
Author

menezes85 commented Apr 24, 2023

Return of _widget results in an Empty Container, forcing to work only if i set CoolAlertType.custom... Independent if is custom or not, customWidget When set must be displayed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants