社交媒体应用
致力于开发一款开源社交媒体应用。
截图
| 登录 | 登录错误 | 注册 |
|---|---|---|
![]() |
![]() |
![]() |
| 编辑资料 | 填写完毕的个人资料编辑 | 个人资料 |
|---|---|---|
![]() |
![]() |
![]() |
入门
要运行此项目,您需要在 Supbase 上创建一个账户。
- 创建账户后,从 Supabase SQL 编辑器运行以下查询以创建所需的表。
-- Create a table for Profiles
create table if not exists profiles (
id uuid references auth.users on delete cascade not null,
updated_at timestamp with time zone,
created_at timestamp with time zone,
user_name text unique,
email text unique,
name text,
avatar_url text,
website text,
about text,
primary key (id),
unique(user_name),
unique(email)
);
alter table profiles enable row level security;
create policy "Public profiles are viewable by everyone."
on profiles for select
using ( true );
create policy "Users can insert their own profile."
on profiles for insert
with check ( auth.role() = 'anon' );
create policy "Users can update own profile."
on profiles for update
using ( auth.uid() = id );
-- Set up Realtime!
begin;
drop publication if exists supabase_realtime;
create publication supabase_realtime;
commit;
alter publication supabase_realtime add table profiles;
-- Set up Storage!
insert into storage.buckets (id, name)
values ('avatars', 'avatars');
create policy "Avatar images are publicly accessible."
on storage.objects for select
using ( bucket_id = 'avatars' );
create policy "Anyone can upload an avatar."
on storage.objects for insert
with check ( bucket_id = 'avatars' );
create policy "Anyone can update an avatar."
on storage.objects for update
with check ( bucket_id = 'avatars' );
-
转到
Authentication=>settings并确保Disable email confirmations已激活或启用。

-
成功运行上述查询后,获取 Base url 和 Base key,并在运行 flutter 应用时将其传递给命令行参数。
flutte run --dart-define=BASE_URL=supabase_base_url --dart-define=BASE_KEY=supabase_base_key
就是这样!您将能够运行此应用程序,如果您在任何步骤卡住了,请给我发消息。
让我们一起创造一个开源的替代现有社交媒体应用程序。
生成文件
flutter pub run build_runner build
如果代码生成失败,请尝试使用标志
--delete-conflicting-outputs运行它





