Home > Net >  Flutter: Position Icon after TextField with same height
Flutter: Position Icon after TextField with same height

Time:05-19

I'm trying to achieve the following: enter image description here You Can try this Code

Widget build(BuildContext context) {
    return Card(
      elevation: 5,
      color: Colors.white,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(10),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Container(
            height: MediaQuery.of(context).size.height * 0.10,
            padding: const EdgeInsets.all(20.0),
            child: Row(
              mainAxisSize: MainAxisSize.min,
              children: [
                Expanded(
                  child: TextField(
                    maxLines: 1,
                    decoration: InputDecoration(
                      prefixIcon: const Icon(
                        Icons.search,
                        color: Colors.black,
                      ),
                      hintText: 'Search Employee',
                      hintStyle: Theme.of(context).textTheme.bodyText2!.copyWith(color: Colors.black),
                      enabledBorder: const OutlineInputBorder(
                          borderSide:
                              BorderSide(color: Colors.black, width: 0)),
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5)),
                    ),
                  ),
                ),
                SizedBox(width: MediaQuery.of(context).size.height * 0.010,),
                FittedBox(
                  child: Icon(
                    Icons.add_box,
                    color: Colors.black,
                    size: MediaQuery.of(context).size.height * 0.10,
                  ),
                ),
              ],
            ),
          )
        ],
      ),
    );
  }[![enter image description here][1]][1]
  • Related