0

If I'm not passing the function and just testing with print, it works. I have 3 functions passed on the widget, the CircleAvatar on tap works but not with RawMaterial / button

       RawMaterialButton(
        onPressed: () => bannerTap,//print('raw'),
        child: RichText(
          text: TextSpan(
            //recognizer: TapGestureRecognizer()..onTap  = ()=> print('Text tapped'),
            text: info,
            style: TextStyle(color: Colors.white),
            children: <TextSpan>[
              TextSpan(text: actionMessage, style: TextStyle(fontWeight: FontWeight.bold)),
            ],
          ),

        ),
      ),
dippas
  • 58,591
  • 15
  • 114
  • 126
Mika
  • 1
  • 1

2 Answers2

0

You need to call function instead of function name.

onPressed: () => bannerTap()
KuKu
  • 6,654
  • 1
  • 13
  • 25
  • the bannerTap is a function property I created on the stateless widget. I updated the question with a bit more code, please let me know your thoughts – Mika Feb 25 '21 at 02:23
0

Typo and just need to ensure the custom widget doesn't include the (){} functionName and only the property is passed

Mika
  • 1
  • 1