Twl Flutter File Generator
A Visual Studio Code extension that streamlines Flutter development by generating screens, API services, widgets, and more. It's designed for Flutter developers looking to enhance their productivity and workflow efficiency.
Features
CTRL + SHIFT + P
- Available Options:
- Generate Screens
- Generate Pages
- Insert Widgets
- Insert API Response
- Generate Translation Strings
- Generate APIs (Note: Requires API Helpers file. Compatibility may vary.)
Generate Screen
Overview: This command creates a new Flutter screen along with its components in a designated folder within the project. It prompts for folder name, main file name, and class name, and allows selecting a screen type for specific body code.
Usage:
- Command:
extension.generateScreen
- User Inputs: Folder name, main file name, class name, screen type (e.g., basic, login, signup).
- Output: New folder in
lib/screens/
, main Dart file, and components subfolder with corresponding body Dart file.
Generate API
Overview: Facilitates the creation of API service files. Prompts for API URL, request type, and parameters (for POST requests), generating a Dart file with API call functions.
Usage:
- Command:
extension.generateApi
- User Inputs: API URL, request type (GET/POST), POST parameters.
- Output: Updates
apiConstants.dart
, generates/updates API service Dart file in lib/apiServices/
.
Overview: Quickly inserts predefined Flutter widget snippets into code. Displays a list of widgets for selection.
Usage:
- Command:
extension.insertWidget
- User Input: Selection of a widget.
- Output: Inserts a widget snippet at the cursor's position in the active Dart file.
Generate Pages
Overview: Generates a basic Flutter page. Allows selection of a target folder and inputs a class name to create a new Dart file representing a StatelessWidget page.
Usage:
- Command:
extension.generatePages
- User Inputs: Target folder selection, class name for the new page.
- Output: New Dart file with a basic StatelessWidget structure.
Insert API Response
Overview: Generates code based on a selected provider function name, UI template type, and a sample JSON response.
Usage:
- Command:
extension.insertApiResponse
- User Inputs: Provider function name, UI template type, sample JSON response.
- Output: Generates Flutter code based on the selected provider function, UI template, and JSON response structure.
Generate Translation Strings
Overview: Automates the process of internationalizing Flutter applications. Scans Dart files, identifies text strings, and prepares them for translation using the get
package.
Usage:
- Command:
extension.generateTranslateStrings
- User Inputs: None (automated process)
- Output: Updates Dart files and
translations.dart
with translation keys and default English translations.
Prerequisites:
get
package included in project's dependencies.
translations.dart
file in the lib
folder.
Example:
- Before:
Text('Welcome to the app')
- After:
Text('welcome_to_the_app'.tr)
Notes:
- Designed for the
get
package for Flutter internationalization.
- Manual review of generated keys and translations is recommended.
Each command in this VS Code extension adds specific functionality to enhance productivity and efficiency in Flutter development.
Flutter GPT Content Generator Extension for VS Code
This Visual Studio Code extension enables users to generate Flutter code snippets using the Gemini API. It's designed to streamline the development process by providing quick and easy access to code generation capabilities directly within the VS Code environment.
Features
- Retrieve and Set Gemini API Key: Securely store your Gemini API key in VS Code settings for convenient access.
- Predefined Options for Code Generation: Choose from predefined options like 'Generate widget' or 'Generate Material' to tailor the code generation to your specific needs.
- Custom Prompt for Code Generation: Input a custom prompt to generate code that fits your project's requirements.
Getting Started
Install the Extension: Download and install the extension from the VS Code marketplace.
Set Up Gemini API Key:
- If you haven't already, obtain your Gemini API key from Google's API key page.
- Use the
getGeminiApiKey
function to retrieve and the setGeminiApiKey
function to save your Gemini API key in VS Code.
Generate Code:
- Select a predefined option or enter a custom prompt.
- The extension will use the Gemini API to generate Flutter code based on your input.
Usage
- Initial Setup: On first use, you'll be prompted to enter your Gemini API key. This key is stored for future sessions.
- Selecting Code Generation Options: Choose from predefined options or enter specific prompts to generate the code.
- Inserting Generated Code: The generated code will be inserted at your cursor's current position in the active editor window.
Contributing
Contributions to the extension are welcome! Please feel free to submit pull requests or raise issues on the GitHub repository.
License
This extension is released under MIT License.
Disclaimer
This extension is not officially affiliated with Google or the Gemini API service.
Enjoy coding with the Flutter GPT Content Generator Extension for VS Code!