Skip to content

Instantly share code, notes, and snippets.

@figengungor
Created September 29, 2018 15:40
Show Gist options
  • Save figengungor/53c53cee0128a0ab9056946cca9cb2c3 to your computer and use it in GitHub Desktop.
Save figengungor/53c53cee0128a0ab9056946cca9cb2c3 to your computer and use it in GitHub Desktop.
Alignment Issue when labelText and prefixIcon used in TextField
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
routes: {
'/': (context) => HomePage(),
},
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('hintText and prefixIcon Issue'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
TextField(
decoration: InputDecoration(
isDense: true,
prefixIcon: Icon(
Icons.lock,
),
hintText: "Password",
),
obscureText: true,
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment