Skip to content

Instantly share code, notes, and snippets.

@alardizabal
Created March 31, 2017 16:36
Show Gist options
  • Save alardizabal/d6ddf369f3a3350ea0666c0c4290cc2e to your computer and use it in GitHub Desktop.
Save alardizabal/d6ddf369f3a3350ea0666c0c4290cc2e to your computer and use it in GitHub Desktop.
Flutter Input Widget Demo
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Input Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Input Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
InputValue _currentInput;
@override
void initState() {
super.initState();
_currentInput = const InputValue();
}
void _handleInputChange(InputValue input) {
setState(() {
_currentInput = input;
});
}
@override
Widget build(BuildContext context) {
return new Column(
children: [
new Text(_currentInput.text),
new Material(
child: new Container(
height: 64.0,
color: new Color(0xFFADD8E6),
child: new Input(
onChanged: _handleInputChange,
value: _currentInput,
),
),
),
],
);
}
}
@eseidelGoogle
Copy link

This is for flutter/flutter#8775, which I believe @cbracken is taking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment