flutter_cool_alert
flutter_cool_alert copied to clipboard
Custom Widgets Not being Displayed on 2.0.1
Hello, i was using 1.1.0, after update o 2.0.1, custom widgets stopped working on alerts.
Hi @menezes85, can you give me a sample of what the custom widget looks like? So i can replicate it.
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),
],
);
}
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
),`
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
Any update?
Found the Error:
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