Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/js-bhavyansh/textinput
A simple Flutter app that allows users to input and display text in real-time
https://github.com/js-bhavyansh/textinput
dart flutter text-input
Last synced: 19 days ago
JSON representation
A simple Flutter app that allows users to input and display text in real-time
- Host: GitHub
- URL: https://github.com/js-bhavyansh/textinput
- Owner: js-bhavyansh
- Created: 2024-10-20T13:34:35.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2024-10-31T15:52:10.000Z (20 days ago)
- Last Synced: 2024-10-31T16:33:36.328Z (20 days ago)
- Topics: dart, flutter, text-input
- Language: C++
- Homepage:
- Size: 262 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flutter Demo App
This is a simple Flutter demo app that allows users to input text and display it on the screen. Users can type their thoughts in the text field, and upon pressing the "Post" button, their input will be displayed on the home page.
## Features
- Text input field
- Clear button to reset the input
- Display user input in real-time## Preview
## Code Snippet
Here is the code for the `HomePage` widget:
```dart
class HomePage extends StatefulWidget {
const HomePage({super.key});@override
State createState() => _HomePageState();
}class _HomePageState extends State {
// Use this controller to get what the user typed
final _textController = TextEditingController();// Store user text input into a variable
String userPost = '';@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
// Display Text
Expanded(
child: Center(child: Text(userPost, style: const TextStyle(fontSize: 30))),
),// Text Input
TextField(
controller: _textController,
decoration: InputDecoration(
hintText: 'What\'s on your mind?',
border: const OutlineInputBorder(),
suffixIcon: IconButton(
onPressed: () {
// Clear what's currently in the text field
_textController.clear();
},
icon: const Icon(Icons.clear)
)
)
),// Post Button
MaterialButton(
onPressed: () {
setState(() {
// Update our string variable to get the new user input
userPost = _textController.text;
});
},
color: Colors.blue,
child: const Text('Post', style: TextStyle(color: Colors.white)),
)
],
),
),
);
}
}
```## Getting Started
To run this project on your local machine:
1. Clone the repository and open it in your IDE:
```bash
git clone https://github.com/Bhavyansh03-tech/PageView.git
```
2. Run the project on an emulator or a physical device.
```bash
flutter run
```## Contributing
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
1. Fork the repository.
2. Create your feature branch (`git checkout -b feature/your-feature`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin feature/your-feature`).
5. Create a new Pull Request.## Contact
For questions or feedback, please contact [@Bhavyansh03-tech](https://github.com/Bhavyansh03-tech) on GitHub or connect with me on [LinkedIn](https://www.linkedin.com/in/bhavyansh03/).
---