title: Flutter remove extra space left and right of appbar
body: <p>So I have been trying to work around this but couldn't I have a search box inside my <code>appbar</code> in flutter and I have a <code>PreferredSize</code> to help with the height my I have extra space as shown with the blue line in the image below. Can someone help on how to remove this padding-like space as I want the content to align with the content below the search box? Below is the screenshot and my code snippet.</p>
  <p><a href="https://i.stack.imgur.com/MxL3Z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MxL3Z.jpg" alt="enter image description here" /></a></p>
  <pre><code>
     appBar: PreferredSize(
            preferredSize: Size.fromHeight(40.0),
            // here the desired height
            child: AppBar(
              centerTitle: true,
              backgroundColor: colorGreen,
              title: Container(
                height: 35,
                  width: double.infinity,
                  decoration: BoxDecoration(
                    color: Colors.white,
                     ),
                  child: Center(
                      child: SizedBox(
                        height: 40,
                        width: double.infinity,
                        child: Row(
                          children: &lt;Widget&gt;[
                            // Expanded(
                            Container(
                              padding: EdgeInsets.only(bottom:6),
                                width: 240,
                                  alignment: Alignment.centerLeft,
                                  child: TextField(
                                    readOnly: true,
  
                                    onTap: (){
                          
  
  
                                    },
                                    textAlign: TextAlign.left,
                                    controller: controller,
                                    cursorColor: Colors.grey,
                                    style: TextStyle(
                                        color: Colors.grey,
                                        fontSize: 16,
                                        fontFamily: 'Montserrat'),
                                    onChanged:
                                    onSearchTextChanged,
                                    decoration: InputDecoration(
                                      hintText: &quot;Search&quot;,
                                      hintStyle: TextStyle(
                                          color: Colors.grey,
                                          fontSize: 13,fontWeight: FontWeight.normal,
                                          fontFamily:
                                          'Montserrat'),
                                      border: InputBorder.none,
                                      prefixIcon: Container(
                                          padding: EdgeInsets.only(top: 5),
                                          child:Icon(
                                        Icons.search,
                                        color: Colors.grey,
                                        size: 15,
                                      )),
  
                                      suffixIcon: Visibility(
                                          visible: backClear,
                                          child:InkWell(
                                          onTap: () {
                                            },
                                          child: Container(
                                              padding: EdgeInsets.only(top: 5),
                                              child:Icon(
                                            Icons.backspace,
                                            color: Colors.grey,
                                            size: 12,
                                          )))),
                                     labelStyle: TextStyle(
                                         color: Colors.grey,
                                         fontSize: 14,fontWeight: FontWeight.normal,
                                         fontFamily:
                                         'Montserrat'),
                                     // hintText:Center(child: Text(&quot;&quot;),), //contentPadding: EdgeInsets.only(top: 2),
                                    ),
                                  ),
                                ),
  
  
                            new Container(
                              width: 2.0,
                              height: 100.0,
                              color: colorGreen,
                            ),
                            Expanded(
                                flex: 1,
                                child: Align(
                                  alignment: Alignment.center,
                                  child: new Theme(
                                      data: Theme.of(context)
                                          .copyWith(
                                        canvasColor:colorGray,
                                      ),
                                      child:Directionality(
                                          textDirection: TextDirection.ltr,
                                          child: DropdownButtonHideUnderline(
                                        child: ButtonTheme(
                                          alignedDropdown: true,
                                          child: DropdownButton(
                                            //iconSize: 15,
                                            isDense: false,
                                            icon: Container(
                                                padding: EdgeInsets.all(0),
                                                child:Icon(
                                              //Icons.arrow_drop_down,
                                              Icons.location_on,
                                              color: Colors.grey,
                                              size: 15,
                                            )),
  
                                            hint: Center(
                                                child: Text(
                                                  &quot;All Cities&quot;,
                                                  textAlign: TextAlign
                                                      .center,
                                                  style: TextStyle(
                                                      color: Colors
                                                          .grey,
                                                      fontWeight:
                                                      FontWeight
                                                          .normal,
                                                      fontFamily:
                                                      'Montserrat',
                                                      fontSize: 12),
                                                )),
                                            style: TextStyle(
                                              color: Colors
                                              .grey,
                                              fontWeight:
                                              FontWeight
                                                  .normal,
                                              fontFamily:
                                              'Montserrat',
                                              fontSize: 12),
                                            //value: selectedCountry,
                                            onChanged: (newVal) {
                                              setState(() {
                                                   });
                                            },
                                            value: _mySelection,
                                            items:
                                            data.map((item) {
                                              return new DropdownMenuItem(
                                                child: Container(
                                                  child: Container(
                                                      padding: EdgeInsets.all(0),
                                                      child: Center(
                                                      child: Text(
                                                    &quot;&quot;
                                                  ))),
                                                ),
                                                value: item['id']
                                                    .toString(),
                                              );
                                            }).toList(),
  
                                            isExpanded: true,
                                          ),
                                        ),
                                      )
                                      ),
                                )
                                ),
                            )
                          ],
                        ),
                      ))),
  
            ),
          ),
  
  
  
  </code></pre>