Skip to content

Instantly share code, notes, and snippets.

@vovahost
Created December 11, 2019 22:56
Show Gist options
  • Save vovahost/3f9149a1c8f5eec352c796e7585e233c to your computer and use it in GitHub Desktop.
Save vovahost/3f9149a1c8f5eec352c796e7585e233c to your computer and use it in GitHub Desktop.
Example of a TextField without any padding.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TextField without padding',
debugShowCheckedModeBanner: false,
theme: ThemeData(primarySwatch: Colors.blue),
home: Material(
child: Center(
child: Container(
width: 150.0,
color: Colors.lightGreenAccent,
child: TextField(
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0.0),
isDense: true,
border: InputBorder.none,
hintText: "Type a message",
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 14.0,
),
),
minLines: 1,
maxLines: 1,
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment