flutter_cool_alert icon indicating copy to clipboard operation
flutter_cool_alert copied to clipboard

Custom Widgets Not being Displayed on 2.0.1

Open menezes85 opened this issue 1 year ago • 7 comments

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

menezes85 avatar Mar 03 '23 21:03 menezes85

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

emrade avatar Mar 03 '23 22:03 emrade

 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 avatar Mar 28 '23 23:03 menezes85

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 avatar Mar 28 '23 23:03 menezes85

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 avatar Mar 29 '23 14:03 menezes85

Any update?

menezes85 avatar Apr 03 '23 21:04 menezes85

Found the Error: image

menezes85 avatar Apr 24 '23 13:04 menezes85

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

menezes85 avatar Apr 24 '23 13:04 menezes85