-1

I have an AlertDialog that I want to have hyperlinks within the text. This is what I have currently:

 await showDialog(
        context: context,
        barrierDismissible: true,
        builder: (BuildContext context) => AgreementDialog());

// AgreementDialog.dart
build(BuildContext context) {
    return StreamBuilder(
        stream: agreementBloc.agreements,
        builder:
            (BuildContext context, AsyncSnapshot<AgreementDocuments> snapshot) {
          if (snapshot.hasError) {
            SnackBars.errorSnackBar(context, snapshot.error.toString());

            return Spinner();
          }

          if (!snapshot.hasData) {
            return Spinner();
          }

          return AlertDialog(
            title: Text('Wait'),
            content: Text('test tes test'),
            actions: <Widget>[
              TextButton(
                  child: Text('Approve'),
                  onPressed: () => Navigator.of(context).pop()),
            ],
          );
        });
  }

The above works and will render 'test tes test', but now when I try to use the solution here I can't see the content text at all. Here is what I've tried:

return AlertDialog(
            title: Text('One second...'),
            content: RichText(
              text: TextSpan(children: [
                TextSpan(text: 'By clicking Agree, I hereby agree to the '),
                TextSpan(text: 'Blah blah blah'),
              ]),
            ),
            actions: <Widget>[
              TextButton(
                  child: Text('Approve'),
                  onPressed: () => Navigator.of(context).pop()),
            ],
          );

but it ends up blank:

enter image description here

Does anyone know what I'm doing wrong?

nyphur
  • 2,404
  • 2
  • 24
  • 48

1 Answers1

1

This is gonna be really dumb but I also don't know why my app was doing this...

The color was white so it blended in. I have to set my TextSpan to a color other than white.

nyphur
  • 2,404
  • 2
  • 24
  • 48