No material widget found textfield widgets require a material widget ancestor
Error states that TextField widgets require a Material widget ancestor. Simply wrapping your whole loginWidget into Scaffold
will solve the problem.
Widget LoginPage() {
return new Scaffold(body: *your whole code*)
}
Since most of the widget asks for material widget as their parent widget
its a good practice you should use Material()
or Scaffold()
widget on top of the widget tree and then continue your code.
@override
Widget build(BuildContext context) {
return Material(
child: body(),
}
OR
@override
Widget build(BuildContext context) {
return Scaffold(
child: body(),
}
Just wrap your widget with Material like this:
@override
Widget build(BuildContext context) {
return Material(
child: YourAwesomeWidget(),
}