add flutter template

This commit is contained in:
kkk123321 2024-02-26 09:13:45 +00:00
parent 093e5ced5a
commit ddccd9baa3
4 changed files with 63 additions and 1 deletions

View File

@ -158,6 +158,30 @@ Return only the full code in <svg></svg> tags.
Do not include markdown "```" or "```svg" at the start or end.
"""
IMPORTED_CODE_FLUTTER_SYSTEM_PROMPT = """
You are an expert Flutter web developer.
- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.
- Repeat elements as needed. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "<!-- Repeat for each news item -->" or bad things will happen.
- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.
- Generate running code like so:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
....
Return only the full code of the widget.
Do not include markdown "```" or "```dart" at the start or end.
The return result must only include the code."""
IMPORTED_CODE_SYSTEM_PROMPTS = SystemPrompts(
html_tailwind=IMPORTED_CODE_TAILWIND_SYSTEM_PROMPT,
react_tailwind=IMPORTED_CODE_REACT_TAILWIND_SYSTEM_PROMPT,
@ -166,4 +190,5 @@ IMPORTED_CODE_SYSTEM_PROMPTS = SystemPrompts(
vue_tailwind=IMPORTED_CODE_VUE_TAILWIND_SYSTEM_PROMPT,
vue_css=IMPORTED_CODE_VUE_CSS_SYSTEM_PROMPT,
svg=IMPORTED_CODE_SVG_SYSTEM_PROMPT,
flutter=IMPORTED_CODE_FLUTTER_SYSTEM_PROMPT
)

View File

@ -219,6 +219,39 @@ Do not include markdown "```" or "```svg" at the start or end.
"""
FLUTTER_PROMPT = """
You are an expert Flutter web developer
You take screenshots of a reference web page from the user, and then build single page apps
using Flutter Material UI.
You might also be given a screenshot(The second image) of a web page that you have already built, and asked to
update it to look more like the reference image(The first image).
- Make sure the app looks exactly like the screenshot.
- Pay close attention to background color, text color, font size, font family,
padding, margin, border, etc. Match the colors and sizes exactly.
- Use the exact text from the screenshot.
- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.
- Repeat elements as needed to match the screenshot. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "<!-- Repeat for each news item -->" or bad things will happen.
- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.
- Generate running code like so:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
....
Return only the full code of the widget.
Do not include markdown "```" or "```dart" at the start or end.
The return result must only include the code.
"""
SYSTEM_PROMPTS = SystemPrompts(
html_tailwind=HTML_TAILWIND_SYSTEM_PROMPT,
react_tailwind=REACT_TAILWIND_SYSTEM_PROMPT,
@ -227,4 +260,5 @@ SYSTEM_PROMPTS = SystemPrompts(
vue_tailwind=VUE_TAILWIND_SYSTEM_PROMPT,
vue_css=VUE_CSS_PROMPT,
svg=SVG_SYSTEM_PROMPT,
flutter=FLUTTER_PROMPT,
)

View File

@ -9,6 +9,7 @@ class SystemPrompts(TypedDict):
vue_tailwind: str
vue_css: str
svg: str
flutter:str
Stack = Literal[
@ -19,4 +20,5 @@ Stack = Literal[
"vue_tailwind",
"vue_css",
"svg",
"flutter",
]

View File

@ -8,6 +8,7 @@ export enum Stack {
IONIC_TAILWIND = "ionic_tailwind",
SVG = "svg",
FLUTTER = "flutter",
}
export const STACK_DESCRIPTIONS: {
@ -19,6 +20,6 @@ export const STACK_DESCRIPTIONS: {
vue_tailwind: { components: ["Vue", "Tailwind"], inBeta: true },
vue_css: { components: ["Vue","CSS"], inBeta: true },
ionic_tailwind: { components: ["Ionic", "Tailwind"], inBeta: true },
svg: { components: ["SVG"], inBeta: true },
flutter: { components: ["Flutter"], inBeta: true },
};