meltdown_ultra
meltdown_ultra

Reputation: 95

The named parameter 'color' isn't defined

I can't find the problem and I don't know what to do. Please can you help.

Widget _buildTodoItem(String title) {
    return Padding(
      padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 0.0),
      child: GestureDetector(
        onTap: () =>
            setState(() {
              _color = Colors.black;
              }),
        child: Card(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Text(title),
          color: _color,
        ),
      ),
    ),
    );
  }

enter image description here

Upvotes: 0

Views: 915

Answers (1)

Anas Nadeem
Anas Nadeem

Reputation: 907

Replace Your Card widget with this:

Card(
        child: Container(
          padding: const EdgeInsets.all(8.0),
          child: Text(title),
          color: _color,
        ),
      ),

Upvotes: 1

Related Questions