首页 > 解决方案 > Flutter widget (Padding) constructor error (1 required argument(s) expected, but 0 found.)

问题描述

Today I was going to work further on my app, but I saw that an error appeared that I was not having before. Flutter can't seem to create a padding Widget.

I've searched for any ';' or ',' I missed, but everything seems alright. If I go to the official documentation and copy-paste an example it does not work.

This error happens all over my project, I think something is bugging

Code where error occurs

return Padding(
  padding: EdgeInsets.only(bottom: 7.0),
  child: TextField(
    autofocus: true,
    controller: _searchQueryController,
    decoration: new InputDecoration(
      hintText: 'Text over here',
      prefixIcon: new Padding(
        padding: // <<=== error
            const EdgeInsets.symmetric(vertical: 12.0, horizontal: 10.0),
        child: new Icon(Icons.search),
      ),
    ),
  ),
);

Error 1 required argument(s) expected, but 0 found.

标签: flutterpaddingflutter-layout

解决方案


推荐阅读