No material widget found textfield widgets require a material widget ancestor No material widget found textfield widgets require a material widget ancestor ios ios

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*)}


Just wrap your widget with Material like this:

@overrideWidget build(BuildContext context) {  return Material(    child: YourAwesomeWidget(),}


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.

@overrideWidget build(BuildContext context) {  return Material(    child: body(),}

OR

@overrideWidget build(BuildContext context) {  return Scaffold(    child: body(),}