I am new to Flutter and I was trying do execute the example here. I just want to use the TextField widget to get some user input. The issue is that I get a \"No Material wid
Put your widget inside a Scaffold, like this:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Demo',
//home: MyWidget(), --> do not do this !!!
home: Home() --> this will wrap it in Scaffold
);
}
}
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Demo'),
),
body: MyWidget()); --> put your widget here
}
}
class MyWidget extends StatefulWidget {
...