Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Try it out
- //The text field changes color when it is pressed
- import 'package:flutter/material.dart';
- void main() => runApp(MyApp());
- class MyApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter TextInput Border Color Example',
- home: FlutterExample(),
- );
- }
- }
- class FlutterExample extends StatefulWidget {
- @override
- _FlutterExampleState createState() => _FlutterExampleState();
- }
- class _FlutterExampleState extends State<FlutterExample> {
- final myController = TextEditingController();
- @override
- void dispose() {
- myController.dispose();
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text('TextField Border Color'),
- ),
- body: Padding(
- padding: EdgeInsets.all(16),
- child: new Theme(
- data: new ThemeData(
- primaryColor: Colors.redAccent,
- primaryColorDark: Colors.red,
- ),
- child: new TextField(
- decoration: new InputDecoration(
- border: new OutlineInputBorder(
- borderSide: new BorderSide(color: Colors.teal)),
- hintText: 'Tell us about yourself',
- helperText: 'Keep it short, this is just a demo.',
- labelText: 'Life story',
- prefixIcon: const Icon(
- Icons.person,
- color: Colors.green,
- ),
- prefixText: ' ',
- suffixText: 'USD',
- suffixStyle: const TextStyle(color: Colors.green)),
- ),
- ))
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement