Skip to content

Instantly share code, notes, and snippets.

@timsneath
Created September 3, 2019 09:04
Show Gist options
  • Select an option

  • Save timsneath/284c320678435bd29ae6e7f7aa73d1ce to your computer and use it in GitHub Desktop.

Select an option

Save timsneath/284c320678435bd29ae6e7f7aa73d1ce to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Text Editing Demo',
home: SafeArea(
child: MyTextControllerDemo(),
));
}
}
class MyTextControllerDemo extends StatefulWidget {
@override
_MyTextControllerDemoState createState() => _MyTextControllerDemoState();
}
class _MyTextControllerDemoState extends State<MyTextControllerDemo> {
TextEditingController _textEditingController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: EdgeInsets.all(10.0),
child: Card(
color: Colors.transparent,
elevation: 8,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(16.0)),
child: Container(
height: 50.0,
padding: EdgeInsets.symmetric(horizontal: 16.0),
color: Theme.of(context).accentColor,
child: TextField(
decoration: InputDecoration(
icon: Icon(Icons.search),
border: InputBorder.none,
hintStyle: TextStyle(fontSize: 18),
hintText: 'hint'),
textInputAction: TextInputAction.search,
cursorColor: Colors.black,
style: TextStyle(fontSize: 18),
controller: _textEditingController,
),
))),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment