This error appears because you are using the prefixIcon property, but the widget you are using doesn’t have that parameter.
Usually, prefixIcon is only available inside InputDecoration (for example in TextField or TextFormField), not directly on the widget.
Wrong example (causes the error):
TextField(
prefixIcon: Icon(Icons.email), // Error, because TextField doesn’t have this parameter
)
Correct example (use decoration → InputDecoration):
TextField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.email),
labelText: 'Email',
border: OutlineInputBorder(),
),
)
Or with TextFormField:
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock),
labelText: 'Password',
border: OutlineInputBorder(),
),
)
So the solution is: move prefixIcon inside decoration: InputDecoration(...).
0 Comments:
Posting Komentar