Widget isn't a type

Issue

When I Create a new Widget then uper widget shows error.

Widget isn’t a type.

here is Screen shot of my code screen

Solution

Everything in flutter is a widget and if you want to create your own widget to reuse it, you can do it this way:

class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
  children: [
    Container(
      height: 56.0,
      padding: const EdgeInsets.symmetric(horizontal: 8.0),
      decoration: BoxDecoration(color: Colors.blue[500]),
      child: Card(),
        ),
      ],
    );
  }
}

And after creating you reusable widget you can import it to where you want to use it.

Answered By – Jaime Ortiz

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *