Created
May 18, 2019 06:48
-
-
Save ponnamkarthik/588696d8a48faecc75fc03d1331a6177 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_demo_provider/app_state.dart'; | |
import 'package:provider/provider.dart'; | |
class TextEditWidget extends StatefulWidget { | |
@override | |
_TextEditWidgetState createState() => _TextEditWidgetState(); | |
} | |
class _TextEditWidgetState extends State<TextEditWidget> { | |
TextEditingController _textEditingController = TextEditingController(); | |
@override | |
Widget build(BuildContext context) { | |
final appState = Provider.of<AppState>(context); | |
return Container( | |
child: TextField( | |
controller: _textEditingController, | |
decoration: InputDecoration( | |
labelText: "Some Text", | |
border: OutlineInputBorder(), | |
), | |
onChanged: (changed) => appState.setDisplayText(changed), | |
onSubmitted: (submitted) => appState.setDisplayText(submitted), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment