Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
Create new Flutter app with the default structure.
Sign in to like and favorite skills
Create new Flutter app with the default structure. Now, let's think step-by-step and add two widgets: 1. Create a simple button widget in independent file with reasoning: - Add an ElevatedButton inside the `body` of the `Scaffold`. - Set the `child` to a Text widget (e.g., "Click Me"). - Provide an `onPressed` function that prints to console. - Explain: - Why ElevatedButton is used. - The purpose of the `child` and `onPressed`. 2. Create a TextField with a label reasoning: - Wrap the TextField inside a `Column` along with a `Text` widget as a label. - Optionally, use `Padding` for spacing. - Explain: - Why a `Text` is used as a label. - The role of `TextField`. - How `controller` can be used to read text input.
make button and textfield reusable widget and show output on popup
Created a new
widgets directory structure:
lib/ ├── main.dart └── widgets/ ├── custom_button.dart └── custom_text_field.dart
Implemented reusable widgets:
CustomButton: A reusable button widget with customizable propertiesCustomTextField: A reusable text field widget with built-in labelAdded popup functionality:
showDialog with AlertDialogUpdated documentation:
class CustomButton extends StatelessWidget { final String buttonText; final VoidCallback onPressed; final Color? backgroundColor; final Color? textColor; // ... implementation }
class CustomTextField extends StatelessWidget { final TextEditingController controller; final String label; final String hintText; final bool obscureText; final TextInputType keyboardType; // ... implementation }
void _showOutputDialog(String text) { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: const Text('Text Field Output'), content: Text(text.isEmpty ? 'No text entered' : text), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(), child: const Text('Close'), ), ], ); }, ); }
Reusable Components
Popup Functionality
Code Organization
flutter_app/ ├── lib/ │ ├── main.dart │ └── widgets/ │ ├── custom_button.dart │ └── custom_text_field.dart └── README.md