简体   繁体   English

Flutter Text Field:如何在边框内添加图标

[英]Flutter Text Field: How to add Icon inside the border

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码的输出(这不是我想要的)

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码输出(这不是我想要的)

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码输出(这不是我想要的)

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码输出(这不是我想要的)

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码输出(这不是我想要的)

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码输出(这不是我想要的)

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码输出(这不是我想要的)

要复制的搜索栏

I would like to add the icon in the search bar.我想在搜索栏中添加图标。 Here is my code so far:到目前为止,这是我的代码:

new TextField(
     decoration: new InputDecoration(
     icon: new Icon(Icons.search)
     labelText: "Describe Your Issue...",
     enabledBorder: const OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(20.0)),
     borderSide: const BorderSide(
       color: Colors.grey,
      ),
    ),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.all(Radius.circular(10.0)),
      borderSide: BorderSide(color: Colors.blue),
    ),
   ),
  ),

This is the result of the code above (this is not what i want):这是上面代码的结果(这不是我想要的):

我的代码输出(这不是我想要的)

TextField(
      decoration: InputDecoration(
        filled: true,
        fillColor: Color(0xFFFFFFFF),
        prefixIcon: Icon(Icons.search, color: Colors.pink),
        border: OutlineInputBorder(
          borderRadius: BorderRadius.all(
            Radius.circular(30),
          ),
        ),
        hintText: ' Search',
      ),
    ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM