Let’s wrap some padding around our TextField.
We use EdgeSet.all for put padding around the TextField.
We then EdgeInset for the inner padding of the Textfield.
home_screen.dart
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
import 'package:flutter/material.dart'; class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { @override Widget build(BuildContext context) { //return Container(color: Colors.redAccent); return Scaffold( appBar: AppBar( title: Text('Food Delivery'), actions: <Widget>[ TextButton( onPressed: () {}, child: Text('Cart (0)'), style: ButtonStyle( foregroundColor: MaterialStateProperty.all(Colors.white)), ) ], leading: IconButton( icon: Icon(Icons.account_circle), iconSize: 30, onPressed: () {}), ), body: ListView( children: <Widget>[ Padding( padding: EdgeInsets.all(20.0), child: TextField( decoration: InputDecoration( contentPadding: EdgeInsets.symmetric(vertical: 15.0), fillColor: Colors.white, filled: true, border: OutlineInputBorder( borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide(width: 0.8)), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide( width: 0.8, color: Theme.of(context).primaryColor)), hintText: 'Search Text', prefixIcon: Icon(Icons.search, size: 30), suffixIcon: IconButton( icon: Icon(Icons.clear), onPressed: () {}, ), ), ), ) ], )); } } |