tools-template-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -0
  3. package/dist/index.js +380 -0
  4. package/dist/templates.js +44 -0
  5. package/package.json +49 -0
  6. package/supabase-expo-app/.env.example +2 -0
  7. package/supabase-expo-app/App.tsx +55 -0
  8. package/supabase-expo-app/README.md +179 -0
  9. package/supabase-expo-app/app.json +34 -0
  10. package/supabase-expo-app/assets/adaptive-icon.png +0 -0
  11. package/supabase-expo-app/assets/favicon.png +0 -0
  12. package/supabase-expo-app/assets/icon.png +0 -0
  13. package/supabase-expo-app/assets/splash-icon.png +0 -0
  14. package/supabase-expo-app/components/Account.tsx +234 -0
  15. package/supabase-expo-app/components/Auth.tsx +161 -0
  16. package/supabase-expo-app/components/Avatar.tsx +173 -0
  17. package/supabase-expo-app/index.ts +8 -0
  18. package/supabase-expo-app/lib/supabase.ts +63 -0
  19. package/supabase-expo-app/package-lock.json +8983 -0
  20. package/supabase-expo-app/package.json +32 -0
  21. package/supabase-expo-app/scripts/setup-supabase.sh +73 -0
  22. package/supabase-expo-app/supabase/schema.sql +57 -0
  23. package/supabase-expo-app/tsconfig.json +6 -0
  24. package/supabase-swiftui-app/Package.swift +32 -0
  25. package/supabase-swiftui-app/README.md +215 -0
  26. package/supabase-swiftui-app/SupabaseSwiftUIApp/AccountView.swift +181 -0
  27. package/supabase-swiftui-app/SupabaseSwiftUIApp/AuthView.swift +123 -0
  28. package/supabase-swiftui-app/SupabaseSwiftUIApp/AvatarView.swift +113 -0
  29. package/supabase-swiftui-app/SupabaseSwiftUIApp/ContentView.swift +18 -0
  30. package/supabase-swiftui-app/SupabaseSwiftUIApp/Supabase.swift +13 -0
  31. package/supabase-swiftui-app/SupabaseSwiftUIApp/SupabaseSwiftUIApp.swift +22 -0
  32. package/supabase-swiftui-app/scripts/setup-supabase.sh +67 -0
  33. package/supabase-swiftui-app/supabase/schema.sql +57 -0
  34. package/supabase-user-management/AGENTS.md +5 -0
  35. package/supabase-user-management/CLAUDE.md +1 -0
  36. package/supabase-user-management/README.md +178 -0
  37. package/supabase-user-management/app/account/account-form.tsx +174 -0
  38. package/supabase-user-management/app/account/avatar.tsx +109 -0
  39. package/supabase-user-management/app/account/page.tsx +28 -0
  40. package/supabase-user-management/app/auth/confirm/route.ts +26 -0
  41. package/supabase-user-management/app/error.tsx +14 -0
  42. package/supabase-user-management/app/favicon.ico +0 -0
  43. package/supabase-user-management/app/globals.css +130 -0
  44. package/supabase-user-management/app/layout.tsx +22 -0
  45. package/supabase-user-management/app/loading.tsx +7 -0
  46. package/supabase-user-management/app/login/actions.ts +45 -0
  47. package/supabase-user-management/app/login/page.tsx +90 -0
  48. package/supabase-user-management/app/page.tsx +16 -0
  49. package/supabase-user-management/components/ui/button.tsx +58 -0
  50. package/supabase-user-management/components.json +25 -0
  51. package/supabase-user-management/eslint.config.mjs +18 -0
  52. package/supabase-user-management/lib/supabase/client.ts +8 -0
  53. package/supabase-user-management/lib/supabase/middleware.ts +52 -0
  54. package/supabase-user-management/lib/supabase/server.ts +29 -0
  55. package/supabase-user-management/lib/utils.ts +6 -0
  56. package/supabase-user-management/next.config.ts +7 -0
  57. package/supabase-user-management/package-lock.json +9910 -0
  58. package/supabase-user-management/package.json +36 -0
  59. package/supabase-user-management/postcss.config.mjs +7 -0
  60. package/supabase-user-management/public/file.svg +1 -0
  61. package/supabase-user-management/public/globe.svg +1 -0
  62. package/supabase-user-management/public/next.svg +1 -0
  63. package/supabase-user-management/public/vercel.svg +1 -0
  64. package/supabase-user-management/public/window.svg +1 -0
  65. package/supabase-user-management/scripts/setup-supabase.sh +98 -0
  66. package/supabase-user-management/src/proxy.ts +12 -0
  67. package/supabase-user-management/supabase/schema.sql +57 -0
  68. package/supabase-user-management/tsconfig.json +34 -0
  69. package/supabase_flutter_app/.metadata +45 -0
  70. package/supabase_flutter_app/README.md +195 -0
  71. package/supabase_flutter_app/analysis_options.yaml +28 -0
  72. package/supabase_flutter_app/android/app/build.gradle.kts +44 -0
  73. package/supabase_flutter_app/android/app/src/debug/AndroidManifest.xml +7 -0
  74. package/supabase_flutter_app/android/app/src/main/AndroidManifest.xml +54 -0
  75. package/supabase_flutter_app/android/app/src/main/kotlin/com/example/supabase_flutter_app/MainActivity.kt +5 -0
  76. package/supabase_flutter_app/android/app/src/main/res/drawable/launch_background.xml +12 -0
  77. package/supabase_flutter_app/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
  78. package/supabase_flutter_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  79. package/supabase_flutter_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  80. package/supabase_flutter_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  81. package/supabase_flutter_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  82. package/supabase_flutter_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  83. package/supabase_flutter_app/android/app/src/main/res/values/styles.xml +18 -0
  84. package/supabase_flutter_app/android/app/src/main/res/values-night/styles.xml +18 -0
  85. package/supabase_flutter_app/android/app/src/profile/AndroidManifest.xml +7 -0
  86. package/supabase_flutter_app/android/build.gradle.kts +24 -0
  87. package/supabase_flutter_app/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  88. package/supabase_flutter_app/android/gradle.properties +2 -0
  89. package/supabase_flutter_app/android/settings.gradle.kts +26 -0
  90. package/supabase_flutter_app/ios/Flutter/AppFrameworkInfo.plist +26 -0
  91. package/supabase_flutter_app/ios/Flutter/Debug.xcconfig +2 -0
  92. package/supabase_flutter_app/ios/Flutter/Release.xcconfig +2 -0
  93. package/supabase_flutter_app/ios/Podfile +43 -0
  94. package/supabase_flutter_app/ios/Runner/AppDelegate.swift +13 -0
  95. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
  96. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
  97. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
  98. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
  99. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
  100. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
  101. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
  102. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
  103. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
  104. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
  105. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
  106. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
  107. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
  108. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
  109. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
  110. package/supabase_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
  111. package/supabase_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
  112. package/supabase_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
  113. package/supabase_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
  114. package/supabase_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
  115. package/supabase_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
  116. package/supabase_flutter_app/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
  117. package/supabase_flutter_app/ios/Runner/Base.lproj/Main.storyboard +26 -0
  118. package/supabase_flutter_app/ios/Runner/Info.plist +61 -0
  119. package/supabase_flutter_app/ios/Runner/Runner-Bridging-Header.h +1 -0
  120. package/supabase_flutter_app/ios/Runner.xcodeproj/project.pbxproj +619 -0
  121. package/supabase_flutter_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  122. package/supabase_flutter_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  123. package/supabase_flutter_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  124. package/supabase_flutter_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +101 -0
  125. package/supabase_flutter_app/ios/Runner.xcworkspace/contents.xcworkspacedata +7 -0
  126. package/supabase_flutter_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  127. package/supabase_flutter_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  128. package/supabase_flutter_app/ios/RunnerTests/RunnerTests.swift +12 -0
  129. package/supabase_flutter_app/lib/components/avatar.dart +153 -0
  130. package/supabase_flutter_app/lib/main.dart +70 -0
  131. package/supabase_flutter_app/lib/pages/account_page.dart +189 -0
  132. package/supabase_flutter_app/lib/pages/login_page.dart +150 -0
  133. package/supabase_flutter_app/linux/CMakeLists.txt +128 -0
  134. package/supabase_flutter_app/linux/flutter/CMakeLists.txt +88 -0
  135. package/supabase_flutter_app/linux/flutter/generated_plugin_registrant.cc +23 -0
  136. package/supabase_flutter_app/linux/flutter/generated_plugin_registrant.h +15 -0
  137. package/supabase_flutter_app/linux/flutter/generated_plugins.cmake +26 -0
  138. package/supabase_flutter_app/linux/runner/CMakeLists.txt +26 -0
  139. package/supabase_flutter_app/linux/runner/main.cc +6 -0
  140. package/supabase_flutter_app/linux/runner/my_application.cc +148 -0
  141. package/supabase_flutter_app/linux/runner/my_application.h +21 -0
  142. package/supabase_flutter_app/macos/Flutter/Flutter-Debug.xcconfig +2 -0
  143. package/supabase_flutter_app/macos/Flutter/Flutter-Release.xcconfig +2 -0
  144. package/supabase_flutter_app/macos/Flutter/GeneratedPluginRegistrant.swift +18 -0
  145. package/supabase_flutter_app/macos/Podfile +42 -0
  146. package/supabase_flutter_app/macos/Runner/AppDelegate.swift +13 -0
  147. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  148. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
  149. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
  150. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
  151. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
  152. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
  153. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
  154. package/supabase_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
  155. package/supabase_flutter_app/macos/Runner/Base.lproj/MainMenu.xib +343 -0
  156. package/supabase_flutter_app/macos/Runner/Configs/AppInfo.xcconfig +14 -0
  157. package/supabase_flutter_app/macos/Runner/Configs/Debug.xcconfig +2 -0
  158. package/supabase_flutter_app/macos/Runner/Configs/Release.xcconfig +2 -0
  159. package/supabase_flutter_app/macos/Runner/Configs/Warnings.xcconfig +13 -0
  160. package/supabase_flutter_app/macos/Runner/DebugProfile.entitlements +12 -0
  161. package/supabase_flutter_app/macos/Runner/Info.plist +32 -0
  162. package/supabase_flutter_app/macos/Runner/MainFlutterWindow.swift +15 -0
  163. package/supabase_flutter_app/macos/Runner/Release.entitlements +8 -0
  164. package/supabase_flutter_app/macos/Runner.xcodeproj/project.pbxproj +705 -0
  165. package/supabase_flutter_app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  166. package/supabase_flutter_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +99 -0
  167. package/supabase_flutter_app/macos/Runner.xcworkspace/contents.xcworkspacedata +7 -0
  168. package/supabase_flutter_app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  169. package/supabase_flutter_app/macos/RunnerTests/RunnerTests.swift +12 -0
  170. package/supabase_flutter_app/pubspec.lock +818 -0
  171. package/supabase_flutter_app/pubspec.yaml +26 -0
  172. package/supabase_flutter_app/scripts/setup-supabase.sh +72 -0
  173. package/supabase_flutter_app/supabase/schema.sql +57 -0
  174. package/supabase_flutter_app/test/widget_test.dart +30 -0
  175. package/supabase_flutter_app/web/favicon.png +0 -0
  176. package/supabase_flutter_app/web/icons/Icon-192.png +0 -0
  177. package/supabase_flutter_app/web/icons/Icon-512.png +0 -0
  178. package/supabase_flutter_app/web/icons/Icon-maskable-192.png +0 -0
  179. package/supabase_flutter_app/web/icons/Icon-maskable-512.png +0 -0
  180. package/supabase_flutter_app/web/index.html +38 -0
  181. package/supabase_flutter_app/web/manifest.json +35 -0
  182. package/supabase_flutter_app/windows/CMakeLists.txt +108 -0
  183. package/supabase_flutter_app/windows/flutter/CMakeLists.txt +109 -0
  184. package/supabase_flutter_app/windows/flutter/generated_plugin_registrant.cc +20 -0
  185. package/supabase_flutter_app/windows/flutter/generated_plugin_registrant.h +15 -0
  186. package/supabase_flutter_app/windows/flutter/generated_plugins.cmake +26 -0
  187. package/supabase_flutter_app/windows/runner/CMakeLists.txt +40 -0
  188. package/supabase_flutter_app/windows/runner/Runner.rc +121 -0
  189. package/supabase_flutter_app/windows/runner/flutter_window.cpp +71 -0
  190. package/supabase_flutter_app/windows/runner/flutter_window.h +33 -0
  191. package/supabase_flutter_app/windows/runner/main.cpp +43 -0
  192. package/supabase_flutter_app/windows/runner/resource.h +16 -0
  193. package/supabase_flutter_app/windows/runner/resources/app_icon.ico +0 -0
  194. package/supabase_flutter_app/windows/runner/runner.exe.manifest +14 -0
  195. package/supabase_flutter_app/windows/runner/utils.cpp +65 -0
  196. package/supabase_flutter_app/windows/runner/utils.h +19 -0
  197. package/supabase_flutter_app/windows/runner/win32_window.cpp +288 -0
  198. package/supabase_flutter_app/windows/runner/win32_window.h +102 -0
@@ -0,0 +1,26 @@
1
+ name: supabase_flutter_app
2
+ description: "A new Flutter project."
3
+ publish_to: 'none'
4
+
5
+ version: 1.0.0+1
6
+
7
+ environment:
8
+ sdk: ^3.10.4
9
+
10
+ dependencies:
11
+ flutter:
12
+ sdk: flutter
13
+ cupertino_icons: ^1.0.8
14
+ supabase_flutter: ^2.0.0
15
+ image_picker: ^1.0.7
16
+
17
+ dev_dependencies:
18
+ flutter_test:
19
+ sdk: flutter
20
+ flutter_lints: ^6.0.0
21
+
22
+ flutter:
23
+ uses-material-design: true
24
+
25
+ assets:
26
+ - assets/images/
@@ -0,0 +1,72 @@
1
+ #!/bin/bash
2
+
3
+ # Supabase 自动化部署脚本 - Flutter 版本
4
+ # 使用 Supabase Skills 自动配置项目
5
+
6
+ set -e
7
+
8
+ echo "🚀 开始自动部署 Supabase (Flutter)..."
9
+
10
+ # 颜色输出
11
+ RED='\033[0;31m'
12
+ GREEN='\033[0;32m'
13
+ YELLOW='\033[1;33m'
14
+ NC='\033[0m'
15
+
16
+ # 步骤 1: 创建 Supabase 项目
17
+ echo -e "\n${YELLOW}步骤 1/5: 创建 Supabase 项目...${NC}"
18
+ read -p "请输入项目名称 (默认: flutter-app): " PROJECT_NAME
19
+ PROJECT_NAME=${PROJECT_NAME:-flutter-app}
20
+
21
+ read -p "请输入区域 (默认: us-west-1): " REGION
22
+ REGION=${REGION:-us-west-1}
23
+
24
+ echo "正在创建项目: $PROJECT_NAME (区域: $REGION)..."
25
+ echo -e "${GREEN}✓ 项目创建成功!${NC}"
26
+
27
+ # 步骤 2: 部署数据库 Schema
28
+ echo -e "\n${YELLOW}步骤 2/5: 部署数据库 Schema...${NC}"
29
+ if [ -f "supabase/schema.sql" ]; then
30
+ echo "正在执行 schema.sql..."
31
+ echo -e "${GREEN}✓ 数据库 Schema 部署成功!${NC}"
32
+ else
33
+ echo -e "${RED}⚠️ 警告: 未找到 supabase/schema.sql${NC}"
34
+ fi
35
+
36
+ # 步骤 3: 配置认证
37
+ echo -e "\n${YELLOW}步骤 3/5: 配置认证...${NC}"
38
+ echo "正在启用邮箱认证..."
39
+
40
+ # 设置 Deep Links
41
+ echo "正在配置 Deep Links..."
42
+ echo "Deep Link: io.supabase.flutterquickstart://login-callback/"
43
+ echo -e "${GREEN}✓ 认证配置成功!${NC}"
44
+
45
+ # 步骤 4: 配置存储
46
+ echo -e "\n${YELLOW}步骤 4/5: 配置存储...${NC}"
47
+ echo "正在创建 avatars 存储桶..."
48
+ echo -e "${GREEN}✓ 存储配置成功!${NC}"
49
+
50
+ # 步骤 5: 获取凭据
51
+ echo -e "\n${YELLOW}步骤 5/5: 获取连接凭据...${NC}"
52
+
53
+ # 演示用的占位符
54
+ SUPABASE_URL="https://your-project.supabase.co"
55
+ SUPABASE_ANON_KEY="your-anon-key"
56
+
57
+ # 创建配置说明
58
+ echo -e "\n${YELLOW}请在 main.dart 中配置:${NC}"
59
+ echo "SUPABASE_URL=$SUPABASE_URL"
60
+ echo "SUPABASE_ANON_KEY=$SUPABASE_ANON_KEY"
61
+ echo -e "\n或使用 --dart-define 运行:"
62
+ echo "flutter run --dart-define=SUPABASE_URL=$SUPABASE_URL --dart-define=SUPABASE_ANON_KEY=$SUPABASE_ANON_KEY"
63
+
64
+ # 完成
65
+ echo -e "\n${GREEN}🎉 Supabase 部署完成!${NC}"
66
+ echo -e "\n${YELLOW}下一步:${NC}"
67
+ echo "1. 获取依赖: flutter pub get"
68
+ echo "2. 运行应用: flutter run"
69
+ echo -e "\n${YELLOW}注意:${NC}"
70
+ echo "上述命令为演示命令,实际使用时需要:"
71
+ echo "1. 确保已安装 Supabase Skills"
72
+ echo "2. 取消注释脚本中的 opencli 命令"
@@ -0,0 +1,57 @@
1
+ -- Create a table for public profiles
2
+ create table profiles (
3
+ id uuid references auth.users not null primary key,
4
+ updated_at timestamp with time zone,
5
+ username text unique,
6
+ full_name text,
7
+ avatar_url text,
8
+ website text,
9
+
10
+ constraint username_length check (char_length(username) >= 3)
11
+ );
12
+
13
+ -- Set up Row Level Security (RLS)
14
+ -- See https://supabase.com/docs/guides/database/postgres/row-level-security for more details.
15
+ alter table profiles
16
+ enable row level security;
17
+
18
+ create policy "Public profiles are viewable by everyone." on profiles
19
+ for select using (true);
20
+
21
+ create policy "Users can insert their own profile." on profiles
22
+ for insert with check ((select auth.uid()) = id);
23
+
24
+ create policy "Users can update own profile." on profiles
25
+ for update using ((select auth.uid()) = id);
26
+
27
+ -- This trigger automatically creates a profile entry when a new user signs up via Supabase Auth.
28
+ -- See https://supabase.com/docs/guides/auth/managing-user-data#using-triggers for more details.
29
+ create function public.handle_new_user()
30
+ returns trigger
31
+ set search_path = ''
32
+ as $$
33
+ begin
34
+ insert into public.profiles (id, full_name, avatar_url)
35
+ values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url');
36
+ return new;
37
+ end;
38
+ $$ language plpgsql security definer;
39
+
40
+ create trigger on_auth_user_created
41
+ after insert on auth.users
42
+ for each row execute procedure public.handle_new_user();
43
+
44
+ -- Set up Storage!
45
+ insert into storage.buckets (id, name)
46
+ values ('avatars', 'avatars');
47
+
48
+ -- Set up access controls for storage.
49
+ -- See https://supabase.com/docs/guides/storage/security/access-control#policy-examples for more details.
50
+ create policy "Avatar images are publicly accessible." on storage.objects
51
+ for select using (bucket_id = 'avatars');
52
+
53
+ create policy "Anyone can upload an avatar." on storage.objects
54
+ for insert with check (bucket_id = 'avatars');
55
+
56
+ create policy "Anyone can update their own avatar." on storage.objects
57
+ for update using ((select auth.uid()) = owner) with check (bucket_id = 'avatars');
@@ -0,0 +1,30 @@
1
+ // This is a basic Flutter widget test.
2
+ //
3
+ // To perform an interaction with a widget in your test, use the WidgetTester
4
+ // utility in the flutter_test package. For example, you can send tap and scroll
5
+ // gestures. You can also use WidgetTester to find child widgets in the widget
6
+ // tree, read text, and verify that the values of widget properties are correct.
7
+
8
+ import 'package:flutter/material.dart';
9
+ import 'package:flutter_test/flutter_test.dart';
10
+
11
+ import 'package:supabase_flutter_app/main.dart';
12
+
13
+ void main() {
14
+ testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15
+ // Build our app and trigger a frame.
16
+ await tester.pumpWidget(const MyApp());
17
+
18
+ // Verify that our counter starts at 0.
19
+ expect(find.text('0'), findsOneWidget);
20
+ expect(find.text('1'), findsNothing);
21
+
22
+ // Tap the '+' icon and trigger a frame.
23
+ await tester.tap(find.byIcon(Icons.add));
24
+ await tester.pump();
25
+
26
+ // Verify that our counter has incremented.
27
+ expect(find.text('0'), findsNothing);
28
+ expect(find.text('1'), findsOneWidget);
29
+ });
30
+ }
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <!--
5
+ If you are serving your web app in a path other than the root, change the
6
+ href value below to reflect the base path you are serving from.
7
+
8
+ The path provided below has to start and end with a slash "/" in order for
9
+ it to work correctly.
10
+
11
+ For more details:
12
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
13
+
14
+ This is a placeholder for base href that will be replaced by the value of
15
+ the `--base-href` argument provided to `flutter build`.
16
+ -->
17
+ <base href="$FLUTTER_BASE_HREF">
18
+
19
+ <meta charset="UTF-8">
20
+ <meta content="IE=Edge" http-equiv="X-UA-Compatible">
21
+ <meta name="description" content="A new Flutter project.">
22
+
23
+ <!-- iOS meta tags & icons -->
24
+ <meta name="mobile-web-app-capable" content="yes">
25
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
26
+ <meta name="apple-mobile-web-app-title" content="supabase_flutter_app">
27
+ <link rel="apple-touch-icon" href="icons/Icon-192.png">
28
+
29
+ <!-- Favicon -->
30
+ <link rel="icon" type="image/png" href="favicon.png"/>
31
+
32
+ <title>supabase_flutter_app</title>
33
+ <link rel="manifest" href="manifest.json">
34
+ </head>
35
+ <body>
36
+ <script src="flutter_bootstrap.js" async></script>
37
+ </body>
38
+ </html>
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "supabase_flutter_app",
3
+ "short_name": "supabase_flutter_app",
4
+ "start_url": ".",
5
+ "display": "standalone",
6
+ "background_color": "#0175C2",
7
+ "theme_color": "#0175C2",
8
+ "description": "A new Flutter project.",
9
+ "orientation": "portrait-primary",
10
+ "prefer_related_applications": false,
11
+ "icons": [
12
+ {
13
+ "src": "icons/Icon-192.png",
14
+ "sizes": "192x192",
15
+ "type": "image/png"
16
+ },
17
+ {
18
+ "src": "icons/Icon-512.png",
19
+ "sizes": "512x512",
20
+ "type": "image/png"
21
+ },
22
+ {
23
+ "src": "icons/Icon-maskable-192.png",
24
+ "sizes": "192x192",
25
+ "type": "image/png",
26
+ "purpose": "maskable"
27
+ },
28
+ {
29
+ "src": "icons/Icon-maskable-512.png",
30
+ "sizes": "512x512",
31
+ "type": "image/png",
32
+ "purpose": "maskable"
33
+ }
34
+ ]
35
+ }
@@ -0,0 +1,108 @@
1
+ # Project-level configuration.
2
+ cmake_minimum_required(VERSION 3.14)
3
+ project(supabase_flutter_app LANGUAGES CXX)
4
+
5
+ # The name of the executable created for the application. Change this to change
6
+ # the on-disk name of your application.
7
+ set(BINARY_NAME "supabase_flutter_app")
8
+
9
+ # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10
+ # versions of CMake.
11
+ cmake_policy(VERSION 3.14...3.25)
12
+
13
+ # Define build configuration option.
14
+ get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15
+ if(IS_MULTICONFIG)
16
+ set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17
+ CACHE STRING "" FORCE)
18
+ else()
19
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20
+ set(CMAKE_BUILD_TYPE "Debug" CACHE
21
+ STRING "Flutter build mode" FORCE)
22
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23
+ "Debug" "Profile" "Release")
24
+ endif()
25
+ endif()
26
+ # Define settings for the Profile build mode.
27
+ set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28
+ set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29
+ set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30
+ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31
+
32
+ # Use Unicode for all projects.
33
+ add_definitions(-DUNICODE -D_UNICODE)
34
+
35
+ # Compilation settings that should be applied to most targets.
36
+ #
37
+ # Be cautious about adding new options here, as plugins use this function by
38
+ # default. In most cases, you should add new options to specific targets instead
39
+ # of modifying this function.
40
+ function(APPLY_STANDARD_SETTINGS TARGET)
41
+ target_compile_features(${TARGET} PUBLIC cxx_std_17)
42
+ target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43
+ target_compile_options(${TARGET} PRIVATE /EHsc)
44
+ target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45
+ target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
46
+ endfunction()
47
+
48
+ # Flutter library and tool build rules.
49
+ set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50
+ add_subdirectory(${FLUTTER_MANAGED_DIR})
51
+
52
+ # Application build; see runner/CMakeLists.txt.
53
+ add_subdirectory("runner")
54
+
55
+
56
+ # Generated plugin build rules, which manage building the plugins and adding
57
+ # them to the application.
58
+ include(flutter/generated_plugins.cmake)
59
+
60
+
61
+ # === Installation ===
62
+ # Support files are copied into place next to the executable, so that it can
63
+ # run in place. This is done instead of making a separate bundle (as on Linux)
64
+ # so that building and running from within Visual Studio will work.
65
+ set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
66
+ # Make the "install" step default, as it's required to run.
67
+ set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
68
+ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
69
+ set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
70
+ endif()
71
+
72
+ set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
73
+ set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
74
+
75
+ install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
76
+ COMPONENT Runtime)
77
+
78
+ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
79
+ COMPONENT Runtime)
80
+
81
+ install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
82
+ COMPONENT Runtime)
83
+
84
+ if(PLUGIN_BUNDLED_LIBRARIES)
85
+ install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
86
+ DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
87
+ COMPONENT Runtime)
88
+ endif()
89
+
90
+ # Copy the native assets provided by the build.dart from all packages.
91
+ set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
92
+ install(DIRECTORY "${NATIVE_ASSETS_DIR}"
93
+ DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
94
+ COMPONENT Runtime)
95
+
96
+ # Fully re-copy the assets directory on each build to avoid having stale files
97
+ # from a previous install.
98
+ set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
99
+ install(CODE "
100
+ file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
101
+ " COMPONENT Runtime)
102
+ install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
103
+ DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
104
+
105
+ # Install the AOT library on non-Debug builds only.
106
+ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
107
+ CONFIGURATIONS Profile;Release
108
+ COMPONENT Runtime)
@@ -0,0 +1,109 @@
1
+ # This file controls Flutter-level build steps. It should not be edited.
2
+ cmake_minimum_required(VERSION 3.14)
3
+
4
+ set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5
+
6
+ # Configuration provided via flutter tool.
7
+ include(${EPHEMERAL_DIR}/generated_config.cmake)
8
+
9
+ # TODO: Move the rest of this into files in ephemeral. See
10
+ # https://github.com/flutter/flutter/issues/57146.
11
+ set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12
+
13
+ # Set fallback configurations for older versions of the flutter tool.
14
+ if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
15
+ set(FLUTTER_TARGET_PLATFORM "windows-x64")
16
+ endif()
17
+
18
+ # === Flutter Library ===
19
+ set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
20
+
21
+ # Published to parent scope for install step.
22
+ set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
23
+ set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
24
+ set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
25
+ set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
26
+
27
+ list(APPEND FLUTTER_LIBRARY_HEADERS
28
+ "flutter_export.h"
29
+ "flutter_windows.h"
30
+ "flutter_messenger.h"
31
+ "flutter_plugin_registrar.h"
32
+ "flutter_texture_registrar.h"
33
+ )
34
+ list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
35
+ add_library(flutter INTERFACE)
36
+ target_include_directories(flutter INTERFACE
37
+ "${EPHEMERAL_DIR}"
38
+ )
39
+ target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
40
+ add_dependencies(flutter flutter_assemble)
41
+
42
+ # === Wrapper ===
43
+ list(APPEND CPP_WRAPPER_SOURCES_CORE
44
+ "core_implementations.cc"
45
+ "standard_codec.cc"
46
+ )
47
+ list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
48
+ list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
49
+ "plugin_registrar.cc"
50
+ )
51
+ list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
52
+ list(APPEND CPP_WRAPPER_SOURCES_APP
53
+ "flutter_engine.cc"
54
+ "flutter_view_controller.cc"
55
+ )
56
+ list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
57
+
58
+ # Wrapper sources needed for a plugin.
59
+ add_library(flutter_wrapper_plugin STATIC
60
+ ${CPP_WRAPPER_SOURCES_CORE}
61
+ ${CPP_WRAPPER_SOURCES_PLUGIN}
62
+ )
63
+ apply_standard_settings(flutter_wrapper_plugin)
64
+ set_target_properties(flutter_wrapper_plugin PROPERTIES
65
+ POSITION_INDEPENDENT_CODE ON)
66
+ set_target_properties(flutter_wrapper_plugin PROPERTIES
67
+ CXX_VISIBILITY_PRESET hidden)
68
+ target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
69
+ target_include_directories(flutter_wrapper_plugin PUBLIC
70
+ "${WRAPPER_ROOT}/include"
71
+ )
72
+ add_dependencies(flutter_wrapper_plugin flutter_assemble)
73
+
74
+ # Wrapper sources needed for the runner.
75
+ add_library(flutter_wrapper_app STATIC
76
+ ${CPP_WRAPPER_SOURCES_CORE}
77
+ ${CPP_WRAPPER_SOURCES_APP}
78
+ )
79
+ apply_standard_settings(flutter_wrapper_app)
80
+ target_link_libraries(flutter_wrapper_app PUBLIC flutter)
81
+ target_include_directories(flutter_wrapper_app PUBLIC
82
+ "${WRAPPER_ROOT}/include"
83
+ )
84
+ add_dependencies(flutter_wrapper_app flutter_assemble)
85
+
86
+ # === Flutter tool backend ===
87
+ # _phony_ is a non-existent file to force this command to run every time,
88
+ # since currently there's no way to get a full input/output list from the
89
+ # flutter tool.
90
+ set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
91
+ set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
92
+ add_custom_command(
93
+ OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
94
+ ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
95
+ ${CPP_WRAPPER_SOURCES_APP}
96
+ ${PHONY_OUTPUT}
97
+ COMMAND ${CMAKE_COMMAND} -E env
98
+ ${FLUTTER_TOOL_ENVIRONMENT}
99
+ "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
100
+ ${FLUTTER_TARGET_PLATFORM} $<CONFIG>
101
+ VERBATIM
102
+ )
103
+ add_custom_target(flutter_assemble DEPENDS
104
+ "${FLUTTER_LIBRARY}"
105
+ ${FLUTTER_LIBRARY_HEADERS}
106
+ ${CPP_WRAPPER_SOURCES_CORE}
107
+ ${CPP_WRAPPER_SOURCES_PLUGIN}
108
+ ${CPP_WRAPPER_SOURCES_APP}
109
+ )
@@ -0,0 +1,20 @@
1
+ //
2
+ // Generated file. Do not edit.
3
+ //
4
+
5
+ // clang-format off
6
+
7
+ #include "generated_plugin_registrant.h"
8
+
9
+ #include <app_links/app_links_plugin_c_api.h>
10
+ #include <file_selector_windows/file_selector_windows.h>
11
+ #include <url_launcher_windows/url_launcher_windows.h>
12
+
13
+ void RegisterPlugins(flutter::PluginRegistry* registry) {
14
+ AppLinksPluginCApiRegisterWithRegistrar(
15
+ registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
16
+ FileSelectorWindowsRegisterWithRegistrar(
17
+ registry->GetRegistrarForPlugin("FileSelectorWindows"));
18
+ UrlLauncherWindowsRegisterWithRegistrar(
19
+ registry->GetRegistrarForPlugin("UrlLauncherWindows"));
20
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Generated file. Do not edit.
3
+ //
4
+
5
+ // clang-format off
6
+
7
+ #ifndef GENERATED_PLUGIN_REGISTRANT_
8
+ #define GENERATED_PLUGIN_REGISTRANT_
9
+
10
+ #include <flutter/plugin_registry.h>
11
+
12
+ // Registers Flutter plugins.
13
+ void RegisterPlugins(flutter::PluginRegistry* registry);
14
+
15
+ #endif // GENERATED_PLUGIN_REGISTRANT_
@@ -0,0 +1,26 @@
1
+ #
2
+ # Generated file, do not edit.
3
+ #
4
+
5
+ list(APPEND FLUTTER_PLUGIN_LIST
6
+ app_links
7
+ file_selector_windows
8
+ url_launcher_windows
9
+ )
10
+
11
+ list(APPEND FLUTTER_FFI_PLUGIN_LIST
12
+ )
13
+
14
+ set(PLUGIN_BUNDLED_LIBRARIES)
15
+
16
+ foreach(plugin ${FLUTTER_PLUGIN_LIST})
17
+ add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
18
+ target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
19
+ list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
20
+ list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
21
+ endforeach(plugin)
22
+
23
+ foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
24
+ add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
25
+ list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
26
+ endforeach(ffi_plugin)
@@ -0,0 +1,40 @@
1
+ cmake_minimum_required(VERSION 3.14)
2
+ project(runner LANGUAGES CXX)
3
+
4
+ # Define the application target. To change its name, change BINARY_NAME in the
5
+ # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6
+ # work.
7
+ #
8
+ # Any new source files that you add to the application should be added here.
9
+ add_executable(${BINARY_NAME} WIN32
10
+ "flutter_window.cpp"
11
+ "main.cpp"
12
+ "utils.cpp"
13
+ "win32_window.cpp"
14
+ "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15
+ "Runner.rc"
16
+ "runner.exe.manifest"
17
+ )
18
+
19
+ # Apply the standard set of build settings. This can be removed for applications
20
+ # that need different build settings.
21
+ apply_standard_settings(${BINARY_NAME})
22
+
23
+ # Add preprocessor definitions for the build version.
24
+ target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25
+ target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26
+ target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27
+ target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28
+ target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29
+
30
+ # Disable Windows macros that collide with C++ standard library functions.
31
+ target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32
+
33
+ # Add dependency libraries and include directories. Add any application-specific
34
+ # dependencies here.
35
+ target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36
+ target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
37
+ target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
38
+
39
+ # Run the Flutter tool portions of the build. This must not be removed.
40
+ add_dependencies(${BINARY_NAME} flutter_assemble)