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,
),
),
),
],
);
}
}
@alardizabal
Copy link
Author

The above works fine on my Pixel and a couple Android emulators I've tried. I see a number of issues on my iPhone 6 and on simulator.

iOS

  1. My keystrokes don't show up in the input field or lag significantly.
  2. It's difficult to place the cursor in specific areas in the field.
  3. After randomly tapping on keys, the backspace button can cause foreign characters to display.
    img_2159

@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