Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

"The named parameter 'child' isn't defined." in TextButton Widget

I want to add a TextButton to my code… But my IDE is showing me, that the parameter child in die TextButton Widget isn’t definded…
But in the official Flutter-Documents you add Text to a TextButton by the child parameter. This is my code:

Column(
          crossAxisAlignment: CrossAxisAlignment.end,
          children: actions
              .map((action) => TextButton(
                    
                    style: TextButton.styleFrom(
                      foregroundColor: action.textColor ?? Theme.of(context).primaryColor,
                    ),
                    onPressed: () => Navigator.pop(context, action.popResult),
                    child: Text(action.title.toUpperCase()),
                  ))
              .toList(),
        )

Hope that somebody can help me with this issue.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I think the problem is not in the child property but in the foregroundColor of the TextButton#styleFrom function because foregroundColor is a property that calculates the value based on the onSurface or primary arguments and you cannot set it directly

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading