Spaces:
Sleeping
Sleeping
Claude commited on
Commit ·
37d0b8b
1
Parent(s): 7bb506c
Fix AC3: Replace all invalid card IDs with valid CARD_CATALOG entries
Browse files- Updated AI prompt card suggestions to use only valid card IDs
- Fixed fitness fallback variants (workout_exercise, calorie_goal, etc.)
- Fixed banking fallback variants (transfer_form, investment_item, etc.)
- Fixed rider fallback variants (delivery_tracker, map_location, etc.)
- Fixed ecommerce fallback variants (brand_showcase, category_grid, etc.)
- Fixed social fallback variants (social_post_card, reel_preview, etc.)
- Fixed generic default variants with valid card types
This ensures _generate_cards_code() can find all cards in CARD_CATALOG
and generate proper Flutter widgets instead of falling back to generic cards.
agents/flutter_screen_generator.py
CHANGED
|
@@ -556,14 +556,14 @@ JSON Plan:"""
|
|
| 556 |
# Get all background names for AI
|
| 557 |
bg_list = "\n".join([f"- {bg_id} ({info['name']}, {info['complexity']})" for bg_id, info in self.BACKGROUND_CATALOG.items()])
|
| 558 |
|
| 559 |
-
# Get card suggestions based on app type
|
| 560 |
card_suggestions = {
|
| 561 |
-
"fitness": ["
|
| 562 |
-
"banking": ["account_balance", "transaction_item", "credit_card", "
|
| 563 |
-
"rider": ["
|
| 564 |
-
"ecommerce": ["product_vertical", "product_rating", "flash_sale", "cart_item", "wishlist_item", "product_grid_compact", "order_tracking", "
|
| 565 |
-
"social": ["
|
| 566 |
-
"generic": ["
|
| 567 |
}
|
| 568 |
cards_list = card_suggestions.get(app_type, card_suggestions["generic"])
|
| 569 |
cards_str = ", ".join(cards_list)
|
|
@@ -681,7 +681,7 @@ JSON:"""
|
|
| 681 |
"background": "waves_smooth",
|
| 682 |
"header": "stats_header",
|
| 683 |
"footer": "floating_fab",
|
| 684 |
-
"cards": ["
|
| 685 |
"texts": {
|
| 686 |
"header_title": "Workout Tracker",
|
| 687 |
"header_subtitle": "Today's Progress",
|
|
@@ -695,7 +695,7 @@ JSON:"""
|
|
| 695 |
"background": "gradient_linear",
|
| 696 |
"header": "minimal",
|
| 697 |
"footer": "gesture_bar",
|
| 698 |
-
"cards": ["
|
| 699 |
"texts": {
|
| 700 |
"header_title": "Active Session",
|
| 701 |
"header_subtitle": "",
|
|
@@ -709,7 +709,7 @@ JSON:"""
|
|
| 709 |
"background": "geometric_circles",
|
| 710 |
"header": "tabs",
|
| 711 |
"footer": "animated_pills",
|
| 712 |
-
"cards": ["
|
| 713 |
"texts": {
|
| 714 |
"header_title": "Fitness Hub",
|
| 715 |
"header_subtitle": "Your Weekly Goals",
|
|
@@ -723,7 +723,7 @@ JSON:"""
|
|
| 723 |
"background": "abstract_particles",
|
| 724 |
"header": "avatar_search",
|
| 725 |
"footer": "classic_expanded",
|
| 726 |
-
"cards": ["
|
| 727 |
"texts": {
|
| 728 |
"header_title": "Level Up",
|
| 729 |
"header_subtitle": "Achievements & Rewards",
|
|
@@ -739,7 +739,7 @@ JSON:"""
|
|
| 739 |
"background": "gradient_radial",
|
| 740 |
"header": "minimal",
|
| 741 |
"footer": "minimal_icons",
|
| 742 |
-
"cards": ["account_balance", "transaction_item", "credit_card", "
|
| 743 |
"texts": {
|
| 744 |
"header_title": "My Accounts",
|
| 745 |
"header_subtitle": "Secure Banking",
|
|
@@ -753,7 +753,7 @@ JSON:"""
|
|
| 753 |
"background": "gradient_linear",
|
| 754 |
"header": "tabs",
|
| 755 |
"footer": "classic_expanded",
|
| 756 |
-
"cards": ["
|
| 757 |
"texts": {
|
| 758 |
"header_title": "Financial Hub",
|
| 759 |
"header_subtitle": "Account Overview",
|
|
@@ -767,7 +767,7 @@ JSON:"""
|
|
| 767 |
"background": "waves_minimal",
|
| 768 |
"header": "collapsible",
|
| 769 |
"footer": "animated_pills",
|
| 770 |
-
"cards": ["
|
| 771 |
"texts": {
|
| 772 |
"header_title": "Wealth Manager",
|
| 773 |
"header_subtitle": "Premium Services",
|
|
@@ -781,7 +781,7 @@ JSON:"""
|
|
| 781 |
"background": "pattern_lines",
|
| 782 |
"header": "avatar_search",
|
| 783 |
"footer": "gesture_bar",
|
| 784 |
-
"cards": ["
|
| 785 |
"texts": {
|
| 786 |
"header_title": "Smart Banking",
|
| 787 |
"header_subtitle": "Quick Actions",
|
|
@@ -797,7 +797,7 @@ JSON:"""
|
|
| 797 |
"background": "waves_sharp",
|
| 798 |
"header": "stats_header",
|
| 799 |
"footer": "floating_fab",
|
| 800 |
-
"cards": ["
|
| 801 |
"texts": {
|
| 802 |
"header_title": "On Delivery",
|
| 803 |
"header_subtitle": "Today's Earnings",
|
|
@@ -811,7 +811,7 @@ JSON:"""
|
|
| 811 |
"background": "gradient_diagonal",
|
| 812 |
"header": "collapsible",
|
| 813 |
"footer": "minimal_icons",
|
| 814 |
-
"cards": ["
|
| 815 |
"texts": {
|
| 816 |
"header_title": "Navigate",
|
| 817 |
"header_subtitle": "Active Route",
|
|
@@ -825,7 +825,7 @@ JSON:"""
|
|
| 825 |
"background": "abstract_crystalline",
|
| 826 |
"header": "tabs",
|
| 827 |
"footer": "classic_expanded",
|
| 828 |
-
"cards": ["
|
| 829 |
"texts": {
|
| 830 |
"header_title": "Rider Hub",
|
| 831 |
"header_subtitle": "Weekly Performance",
|
|
@@ -839,7 +839,7 @@ JSON:"""
|
|
| 839 |
"background": "geometric_stripes",
|
| 840 |
"header": "avatar_search",
|
| 841 |
"footer": "animated_pills",
|
| 842 |
-
"cards": ["
|
| 843 |
"texts": {
|
| 844 |
"header_title": "Rider Community",
|
| 845 |
"header_subtitle": "Leaderboard & Friends",
|
|
@@ -855,7 +855,7 @@ JSON:"""
|
|
| 855 |
"background": "gradient_mesh",
|
| 856 |
"header": "avatar_search",
|
| 857 |
"footer": "floating_fab",
|
| 858 |
-
"cards": ["product_vertical", "product_rating", "flash_sale", "
|
| 859 |
"texts": {
|
| 860 |
"header_title": "Shop",
|
| 861 |
"header_subtitle": "Discover Products",
|
|
@@ -869,7 +869,7 @@ JSON:"""
|
|
| 869 |
"background": "pattern_dots",
|
| 870 |
"header": "minimal",
|
| 871 |
"footer": "classic_expanded",
|
| 872 |
-
"cards": ["product_grid_compact", "
|
| 873 |
"texts": {
|
| 874 |
"header_title": "Store",
|
| 875 |
"header_subtitle": "Featured Collection",
|
|
@@ -883,7 +883,7 @@ JSON:"""
|
|
| 883 |
"background": "abstract_rays",
|
| 884 |
"header": "collapsible",
|
| 885 |
"footer": "animated_pills",
|
| 886 |
-
"cards": ["product_featured", "
|
| 887 |
"texts": {
|
| 888 |
"header_title": "Luxury Collection",
|
| 889 |
"header_subtitle": "Exclusive Items",
|
|
@@ -897,7 +897,7 @@ JSON:"""
|
|
| 897 |
"background": "waves_curved",
|
| 898 |
"header": "tabs",
|
| 899 |
"footer": "gesture_bar",
|
| 900 |
-
"cards": ["flash_sale", "
|
| 901 |
"texts": {
|
| 902 |
"header_title": "Flash Deals",
|
| 903 |
"header_subtitle": "Limited Time Offers",
|
|
@@ -913,7 +913,7 @@ JSON:"""
|
|
| 913 |
"background": "organic_fluid",
|
| 914 |
"header": "avatar_search",
|
| 915 |
"footer": "minimal_icons",
|
| 916 |
-
"cards": ["
|
| 917 |
"texts": {
|
| 918 |
"header_title": "Feed",
|
| 919 |
"header_subtitle": "What's Happening",
|
|
@@ -927,7 +927,7 @@ JSON:"""
|
|
| 927 |
"background": "gradient_sweep",
|
| 928 |
"header": "minimal",
|
| 929 |
"footer": "gesture_bar",
|
| 930 |
-
"cards": ["
|
| 931 |
"texts": {
|
| 932 |
"header_title": "Stories",
|
| 933 |
"header_subtitle": "24h Updates",
|
|
@@ -941,7 +941,7 @@ JSON:"""
|
|
| 941 |
"background": "geometric_hexagons",
|
| 942 |
"header": "tabs",
|
| 943 |
"footer": "floating_fab",
|
| 944 |
-
"cards": ["
|
| 945 |
"texts": {
|
| 946 |
"header_title": "Create",
|
| 947 |
"header_subtitle": "Your Studio",
|
|
@@ -955,7 +955,7 @@ JSON:"""
|
|
| 955 |
"background": "abstract_constellation",
|
| 956 |
"header": "collapsible",
|
| 957 |
"footer": "animated_pills",
|
| 958 |
-
"cards": ["notification_card", "
|
| 959 |
"texts": {
|
| 960 |
"header_title": "Activity",
|
| 961 |
"header_subtitle": "Your Network",
|
|
@@ -973,7 +973,7 @@ JSON:"""
|
|
| 973 |
"background": "gradient_linear",
|
| 974 |
"header": "minimal",
|
| 975 |
"footer": "minimal_icons",
|
| 976 |
-
"cards": ["
|
| 977 |
"description": "Simple and clean",
|
| 978 |
"texts": {
|
| 979 |
"header_title": "Home",
|
|
@@ -987,7 +987,7 @@ JSON:"""
|
|
| 987 |
"background": "waves_layered",
|
| 988 |
"header": "avatar_search",
|
| 989 |
"footer": "floating_fab",
|
| 990 |
-
"cards": ["
|
| 991 |
"description": "Active and social",
|
| 992 |
"texts": {
|
| 993 |
"header_title": "Dashboard",
|
|
@@ -1001,7 +1001,7 @@ JSON:"""
|
|
| 1001 |
"background": "abstract_voronoi",
|
| 1002 |
"header": "tabs",
|
| 1003 |
"footer": "animated_pills",
|
| 1004 |
-
"cards": ["
|
| 1005 |
"description": "Professional look",
|
| 1006 |
"texts": {
|
| 1007 |
"header_title": "Overview",
|
|
@@ -1015,7 +1015,7 @@ JSON:"""
|
|
| 1015 |
"background": "organic_blobs",
|
| 1016 |
"header": "collapsible",
|
| 1017 |
"footer": "classic_expanded",
|
| 1018 |
-
"cards": ["
|
| 1019 |
"description": "Fun and creative",
|
| 1020 |
"texts": {
|
| 1021 |
"header_title": "Creative Hub",
|
|
|
|
| 556 |
# Get all background names for AI
|
| 557 |
bg_list = "\n".join([f"- {bg_id} ({info['name']}, {info['complexity']})" for bg_id, info in self.BACKGROUND_CATALOG.items()])
|
| 558 |
|
| 559 |
+
# Get card suggestions based on app type (only valid CARD_CATALOG IDs)
|
| 560 |
card_suggestions = {
|
| 561 |
+
"fitness": ["workout_exercise", "step_counter", "calorie_goal", "heart_rate", "achievement_badge", "weight_progress", "sleep_tracker", "water_intake", "nutrition_log"],
|
| 562 |
+
"banking": ["account_balance", "transaction_item", "credit_card", "transfer_form", "investment_item", "crypto_wallet", "bill_payment", "budget_category", "loan_summary"],
|
| 563 |
+
"rider": ["delivery_tracker", "map_location", "order_item", "message_preview", "stats_metric", "stats_progress", "leaderboard_entry", "achievement_badge"],
|
| 564 |
+
"ecommerce": ["product_vertical", "product_rating", "flash_sale", "cart_item", "wishlist_item", "product_grid_compact", "order_tracking", "offer_coupon", "brand_showcase"],
|
| 565 |
+
"social": ["social_post_card", "social_story_card", "profile_user_card", "comment_thread", "reaction_bar", "follower_item", "event_card", "poll_card", "notification_card"],
|
| 566 |
+
"generic": ["stats_metric", "task_item", "notification_card", "review_card", "article_card", "video_card", "stats_progress", "alert_card"]
|
| 567 |
}
|
| 568 |
cards_list = card_suggestions.get(app_type, card_suggestions["generic"])
|
| 569 |
cards_str = ", ".join(cards_list)
|
|
|
|
| 681 |
"background": "waves_smooth",
|
| 682 |
"header": "stats_header",
|
| 683 |
"footer": "floating_fab",
|
| 684 |
+
"cards": ["workout_exercise", "step_counter", "calorie_goal", "heart_rate"],
|
| 685 |
"texts": {
|
| 686 |
"header_title": "Workout Tracker",
|
| 687 |
"header_subtitle": "Today's Progress",
|
|
|
|
| 695 |
"background": "gradient_linear",
|
| 696 |
"header": "minimal",
|
| 697 |
"footer": "gesture_bar",
|
| 698 |
+
"cards": ["workout_exercise", "heart_rate", "timer_widget"],
|
| 699 |
"texts": {
|
| 700 |
"header_title": "Active Session",
|
| 701 |
"header_subtitle": "",
|
|
|
|
| 709 |
"background": "geometric_circles",
|
| 710 |
"header": "tabs",
|
| 711 |
"footer": "animated_pills",
|
| 712 |
+
"cards": ["weight_progress", "achievement_badge", "sleep_tracker", "leaderboard_entry"],
|
| 713 |
"texts": {
|
| 714 |
"header_title": "Fitness Hub",
|
| 715 |
"header_subtitle": "Your Weekly Goals",
|
|
|
|
| 723 |
"background": "abstract_particles",
|
| 724 |
"header": "avatar_search",
|
| 725 |
"footer": "classic_expanded",
|
| 726 |
+
"cards": ["achievement_badge", "stats_progress", "quest_card", "leaderboard_entry"],
|
| 727 |
"texts": {
|
| 728 |
"header_title": "Level Up",
|
| 729 |
"header_subtitle": "Achievements & Rewards",
|
|
|
|
| 739 |
"background": "gradient_radial",
|
| 740 |
"header": "minimal",
|
| 741 |
"footer": "minimal_icons",
|
| 742 |
+
"cards": ["account_balance", "transaction_item", "credit_card", "stats_metric"],
|
| 743 |
"texts": {
|
| 744 |
"header_title": "My Accounts",
|
| 745 |
"header_subtitle": "Secure Banking",
|
|
|
|
| 753 |
"background": "gradient_linear",
|
| 754 |
"header": "tabs",
|
| 755 |
"footer": "classic_expanded",
|
| 756 |
+
"cards": ["transfer_form", "bill_payment", "investment_item", "budget_category"],
|
| 757 |
"texts": {
|
| 758 |
"header_title": "Financial Hub",
|
| 759 |
"header_subtitle": "Account Overview",
|
|
|
|
| 767 |
"background": "waves_minimal",
|
| 768 |
"header": "collapsible",
|
| 769 |
"footer": "animated_pills",
|
| 770 |
+
"cards": ["crypto_wallet", "investment_item", "stats_chart", "loan_summary"],
|
| 771 |
"texts": {
|
| 772 |
"header_title": "Wealth Manager",
|
| 773 |
"header_subtitle": "Premium Services",
|
|
|
|
| 781 |
"background": "pattern_lines",
|
| 782 |
"header": "avatar_search",
|
| 783 |
"footer": "gesture_bar",
|
| 784 |
+
"cards": ["budget_category", "stats_progress", "statement_month", "bill_payment"],
|
| 785 |
"texts": {
|
| 786 |
"header_title": "Smart Banking",
|
| 787 |
"header_subtitle": "Quick Actions",
|
|
|
|
| 797 |
"background": "waves_sharp",
|
| 798 |
"header": "stats_header",
|
| 799 |
"footer": "floating_fab",
|
| 800 |
+
"cards": ["order_item", "delivery_tracker", "stats_metric", "message_preview"],
|
| 801 |
"texts": {
|
| 802 |
"header_title": "On Delivery",
|
| 803 |
"header_subtitle": "Today's Earnings",
|
|
|
|
| 811 |
"background": "gradient_diagonal",
|
| 812 |
"header": "collapsible",
|
| 813 |
"footer": "minimal_icons",
|
| 814 |
+
"cards": ["map_location", "delivery_tracker", "timer_widget", "contact_card"],
|
| 815 |
"texts": {
|
| 816 |
"header_title": "Navigate",
|
| 817 |
"header_subtitle": "Active Route",
|
|
|
|
| 825 |
"background": "abstract_crystalline",
|
| 826 |
"header": "tabs",
|
| 827 |
"footer": "classic_expanded",
|
| 828 |
+
"cards": ["stats_progress", "stats_metric", "stats_comparison", "stats_chart"],
|
| 829 |
"texts": {
|
| 830 |
"header_title": "Rider Hub",
|
| 831 |
"header_subtitle": "Weekly Performance",
|
|
|
|
| 839 |
"background": "geometric_stripes",
|
| 840 |
"header": "avatar_search",
|
| 841 |
"footer": "animated_pills",
|
| 842 |
+
"cards": ["leaderboard_entry", "profile_user_card", "quest_card", "achievement_badge"],
|
| 843 |
"texts": {
|
| 844 |
"header_title": "Rider Community",
|
| 845 |
"header_subtitle": "Leaderboard & Friends",
|
|
|
|
| 855 |
"background": "gradient_mesh",
|
| 856 |
"header": "avatar_search",
|
| 857 |
"footer": "floating_fab",
|
| 858 |
+
"cards": ["product_vertical", "product_rating", "flash_sale", "brand_showcase"],
|
| 859 |
"texts": {
|
| 860 |
"header_title": "Shop",
|
| 861 |
"header_subtitle": "Discover Products",
|
|
|
|
| 869 |
"background": "pattern_dots",
|
| 870 |
"header": "minimal",
|
| 871 |
"footer": "classic_expanded",
|
| 872 |
+
"cards": ["product_grid_compact", "category_grid", "wishlist_item", "order_tracking"],
|
| 873 |
"texts": {
|
| 874 |
"header_title": "Store",
|
| 875 |
"header_subtitle": "Featured Collection",
|
|
|
|
| 883 |
"background": "abstract_rays",
|
| 884 |
"header": "collapsible",
|
| 885 |
"footer": "animated_pills",
|
| 886 |
+
"cards": ["product_featured", "product_badge", "brand_showcase", "pricing_plan"],
|
| 887 |
"texts": {
|
| 888 |
"header_title": "Luxury Collection",
|
| 889 |
"header_subtitle": "Exclusive Items",
|
|
|
|
| 897 |
"background": "waves_curved",
|
| 898 |
"header": "tabs",
|
| 899 |
"footer": "gesture_bar",
|
| 900 |
+
"cards": ["flash_sale", "offer_coupon", "cart_item", "order_summary"],
|
| 901 |
"texts": {
|
| 902 |
"header_title": "Flash Deals",
|
| 903 |
"header_subtitle": "Limited Time Offers",
|
|
|
|
| 913 |
"background": "organic_fluid",
|
| 914 |
"header": "avatar_search",
|
| 915 |
"footer": "minimal_icons",
|
| 916 |
+
"cards": ["social_post_card", "social_story_card", "profile_user_card", "comment_thread"],
|
| 917 |
"texts": {
|
| 918 |
"header_title": "Feed",
|
| 919 |
"header_subtitle": "What's Happening",
|
|
|
|
| 927 |
"background": "gradient_sweep",
|
| 928 |
"header": "minimal",
|
| 929 |
"footer": "gesture_bar",
|
| 930 |
+
"cards": ["social_story_card", "reel_preview", "live_streaming", "follower_item"],
|
| 931 |
"texts": {
|
| 932 |
"header_title": "Stories",
|
| 933 |
"header_subtitle": "24h Updates",
|
|
|
|
| 941 |
"background": "geometric_hexagons",
|
| 942 |
"header": "tabs",
|
| 943 |
"footer": "floating_fab",
|
| 944 |
+
"cards": ["stats_chart", "video_card", "stats_progress", "notification_card"],
|
| 945 |
"texts": {
|
| 946 |
"header_title": "Create",
|
| 947 |
"header_subtitle": "Your Studio",
|
|
|
|
| 955 |
"background": "abstract_constellation",
|
| 956 |
"header": "collapsible",
|
| 957 |
"footer": "animated_pills",
|
| 958 |
+
"cards": ["notification_card", "follower_item", "event_card", "poll_card"],
|
| 959 |
"texts": {
|
| 960 |
"header_title": "Activity",
|
| 961 |
"header_subtitle": "Your Network",
|
|
|
|
| 973 |
"background": "gradient_linear",
|
| 974 |
"header": "minimal",
|
| 975 |
"footer": "minimal_icons",
|
| 976 |
+
"cards": ["stats_metric", "task_item", "notification_card", "alert_card"],
|
| 977 |
"description": "Simple and clean",
|
| 978 |
"texts": {
|
| 979 |
"header_title": "Home",
|
|
|
|
| 987 |
"background": "waves_layered",
|
| 988 |
"header": "avatar_search",
|
| 989 |
"footer": "floating_fab",
|
| 990 |
+
"cards": ["article_card", "video_card", "stats_progress", "notification_card"],
|
| 991 |
"description": "Active and social",
|
| 992 |
"texts": {
|
| 993 |
"header_title": "Dashboard",
|
|
|
|
| 1001 |
"background": "abstract_voronoi",
|
| 1002 |
"header": "tabs",
|
| 1003 |
"footer": "animated_pills",
|
| 1004 |
+
"cards": ["pricing_plan", "review_card", "stats_chart", "offer_coupon"],
|
| 1005 |
"description": "Professional look",
|
| 1006 |
"texts": {
|
| 1007 |
"header_title": "Overview",
|
|
|
|
| 1015 |
"background": "organic_blobs",
|
| 1016 |
"header": "collapsible",
|
| 1017 |
"footer": "classic_expanded",
|
| 1018 |
+
"cards": ["video_card", "project_card", "article_card", "social_post_card"],
|
| 1019 |
"description": "Fun and creative",
|
| 1020 |
"texts": {
|
| 1021 |
"header_title": "Creative Hub",
|