Skip to content

Instantly share code, notes, and snippets.

@matuella
Created March 5, 2021 13:21
Show Gist options
  • Save matuella/1bbee4f8570b9320dee4b182af65cdb4 to your computer and use it in GitHub Desktop.
Save matuella/1bbee4f8570b9320dee4b182af65cdb4 to your computer and use it in GitHub Desktop.
StackOverflow Q: "Removing helperText padding from InputDecoration with OutlineInputBorder"
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: TextField(
decoration: InputDecoration(
// This indeed updates `helperText`, but also changes the label padding
// contentPadding: EdgeInsets.zero,
border: const OutlineInputBorder(),
labelText: 'My Label Text',
helperText: 'My Helper Text',
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment