The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: remove SizedBox that are directly under body of Scaffold
dshukertjr2d9326db7c38
diff --git a/examples/todo-list/flutter-todo-list/lib/main.dart b/examples/todo-list/flutter-todo-list/lib/main.dartindex 3080e75fd38..83778d010c6 100644--- a/examples/todo-list/flutter-todo-list/lib/main.dart+++ b/examples/todo-list/flutter-todo-list/lib/main.dart@@ -22,8 +22,7 @@ class MyApp extends StatelessWidget {Widget build(BuildContext context) {return MaterialApp(debugShowCheckedModeBanner: false,- theme: ThemeData.dark(),- darkTheme: ThemeData(+ theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: Colors.black,outlinedButtonTheme: OutlinedButtonThemeData(style: OutlinedButton.styleFrom(@@ -35,6 +34,19 @@ class MyApp extends StatelessWidget {padding: const EdgeInsets.all(16),),),+ elevatedButtonTheme: ElevatedButtonThemeData(+ style: ElevatedButton.styleFrom(+ primary: Colors.white,+ onPrimary: Colors.black,+ textStyle: const TextStyle(+ fontWeight: FontWeight.bold,+ ),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(12),+ ),+ padding: const EdgeInsets.all(16),+ ),+ ),textTheme: const TextTheme(bodyText1: TextStyle(color: Colors.white),bodyText2: TextStyle(color: Colors.white),@@ -63,29 +75,30 @@ class MyHomePageState extends State<MyHomePage> {@overrideWidget build(BuildContext context) {return Scaffold(- body: SizedBox(- height: double.infinity,- width: double.infinity,- child: Column(- mainAxisAlignment: MainAxisAlignment.center,- crossAxisAlignment: CrossAxisAlignment.center,- children: [- SvgPicture.asset("assets/supabase-dark.svg", width: 200),- largeGap,- OutlinedButton(- child: const Text("Sign In"),- onPressed: () {- Navigator.pushNamed(context, "/signin");- },- ),- smallGap,- OutlinedButton(- child: const Text("Sign Up"),- onPressed: () {- Navigator.pushNamed(context, "/signup");- },- )- ],+ body: Center(+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 300),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ SvgPicture.asset("assets/supabase-dark.svg", width: 200),+ largeGap,+ OutlinedButton(+ child: const Text("Sign In"),+ onPressed: () {+ Navigator.pushNamed(context, "/signin");+ },+ ),+ smallGap,+ OutlinedButton(+ child: const Text("Sign Up"),+ onPressed: () {+ Navigator.pushNamed(context, "/signup");+ },+ )+ ],+ ),),),);diff --git a/examples/todo-list/flutter-todo-list/lib/screens/signin.dart b/examples/todo-list/flutter-todo-list/lib/screens/signin.dartindex e187080c2d6..2d5531adaa0 100644--- a/examples/todo-list/flutter-todo-list/lib/screens/signin.dart+++ b/examples/todo-list/flutter-todo-list/lib/screens/signin.dart@@ -17,59 +17,60 @@ class _SignInPageState extends State<SignInPage> {@overrideWidget build(BuildContext context) {return Scaffold(- body: SizedBox(- height: double.infinity,- width: double.infinity,- child: Column(- mainAxisAlignment: MainAxisAlignment.center,- crossAxisAlignment: CrossAxisAlignment.center,- children: [- SvgPicture.asset("assets/supabase-dark.svg", width: 200),- largeGap,- textFeildCustom(- "Email",- _emailController,- ),- smallGap,- textFeildCustom(- "Password",- _passwordController,- ),- smallGap,- loading- ? Container(- height: 50,- width: 50,- decoration: BoxDecoration(- color: Colors.white,- borderRadius: BorderRadius.circular(50),- ),- child: const Center(- child: CircularProgressIndicator(),- ),- )- : OutlinedButton(- child: const Text("Sign In"),- onPressed: () async {- setState(() {- loading = true;- });- var value = await AuthSupabase.loginUser(- email: _emailController.text,- password: _passwordController.text);- setState(() {- loading = false;- });- if (value != null) {- Navigator.pushReplacementNamed(context, '/todo');- } else {- snackbarAlert(- context: context,- message: "Invalid Email or Password");- }- },- )- ],+ body: Center(+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 300),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ SvgPicture.asset("assets/supabase-dark.svg", width: 200),+ largeGap,+ textFeildCustom(+ "Email",+ _emailController,+ ),+ smallGap,+ textFeildCustom(+ "Password",+ _passwordController,+ ),+ smallGap,+ loading+ ? Container(+ height: 50,+ width: 50,+ decoration: BoxDecoration(+ color: Colors.white,+ borderRadius: BorderRadius.circular(50),+ ),+ child: const Center(+ child: CircularProgressIndicator(),+ ),+ )+ : ElevatedButton(+ child: const Text("Sign In"),+ onPressed: () async {+ setState(() {+ loading = true;+ });+ var value = await AuthSupabase.loginUser(+ email: _emailController.text,+ password: _passwordController.text);+ setState(() {+ loading = false;+ });+ if (value != null) {+ Navigator.pushReplacementNamed(context, '/todo');+ } else {+ snackbarAlert(+ context: context,+ message: "Invalid Email or Password");+ }+ },+ )+ ],+ ),),),);diff --git a/examples/todo-list/flutter-todo-list/lib/screens/signup.dart b/examples/todo-list/flutter-todo-list/lib/screens/signup.dartindex f185e473d2f..7c7bdfd6a90 100644--- a/examples/todo-list/flutter-todo-list/lib/screens/signup.dart+++ b/examples/todo-list/flutter-todo-list/lib/screens/signup.dart@@ -18,44 +18,46 @@ class _SignUpPageState extends State<SignUpPage> {@overrideWidget build(BuildContext context) {return Scaffold(- body: SizedBox(- height: double.infinity,- width: double.infinity,- child: Column(- mainAxisAlignment: MainAxisAlignment.center,- crossAxisAlignment: CrossAxisAlignment.center,- children: [- SvgPicture.asset("assets/supabase-dark.svg", width: 200),- largeGap,- textFeildCustom(- "Full Name",- _nameController,- ),- smallGap,- textFeildCustom(- "Email",- _emailController,- ),- smallGap,- textFeildCustom(- "Password",- _passwordController,- ),- smallGap,- OutlinedButton(- child: const Text("Sign Up"),- onPressed: () async {- var value = await AuthSupabase.createAccount(- email: _emailController.text,- password: _passwordController.text);- if (value == true) {- CrudSupabase.addUser(- name: _nameController.text, email: _emailController.text);- Navigator.pushReplacementNamed(context, "/signin");- }- },- )- ],+ body: Center(+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 300),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ SvgPicture.asset("assets/supabase-dark.svg", width: 200),+ largeGap,+ textFeildCustom(+ "Full Name",+ _nameController,+ ),+ smallGap,+ textFeildCustom(+ "Email",+ _emailController,+ ),+ smallGap,+ textFeildCustom(+ "Password",+ _passwordController,+ ),+ smallGap,+ ElevatedButton(+ child: const Text("Sign Up"),+ onPressed: () async {+ var value = await AuthSupabase.createAccount(+ email: _emailController.text,+ password: _passwordController.text);+ if (value == true) {+ CrudSupabase.addUser(+ name: _nameController.text,+ email: _emailController.text);+ Navigator.pushReplacementNamed(context, "/signin");+ }+ },+ )+ ],+ ),),),);diff --git a/examples/todo-list/flutter-todo-list/lib/screens/todo.dart b/examples/todo-list/flutter-todo-list/lib/screens/todo.dartindex 4060b079bee..7d5f56f6769 100644--- a/examples/todo-list/flutter-todo-list/lib/screens/todo.dart+++ b/examples/todo-list/flutter-todo-list/lib/screens/todo.dart@@ -24,9 +24,9 @@ class _TodoPageState extends State<TodoPage> {userName = nameVal[0]['name'];});List<dynamic> value = await CrudSupabase.getTodo();- value.forEach((element) {+ for (var element in value) {todos.add(element);- });+ }setState(() {loading = false;});@@ -34,9 +34,8 @@ class _TodoPageState extends State<TodoPage> {@overridevoid initState() {- // TODO: implement initState- super.initState();initFunc();+ super.initState();}@override@@ -49,32 +48,6 @@ class _TodoPageState extends State<TodoPage> {@overrideWidget build(BuildContext context) {return Scaffold(- floatingActionButton: FloatingActionButton(- backgroundColor: const Color(0xff33b27b),- onPressed: () {- displayTextInputDialog(context, () async {- await CrudSupabase.addTodo(- task: _taskEditingController.text,- due: _dueEditingController.text,- );- Navigator.pop(context);- setState(() {- loading = true;- });-- List<dynamic> value = await CrudSupabase.getTodo();- todos.clear();- setState(() {});- value.forEach((element) {- todos.add(element);- });- setState(() {- loading = false;- });- }, _taskEditingController, _dueEditingController);- },- child: const Icon(Icons.add),- ),appBar: AppBar(backgroundColor: Colors.black,automaticallyImplyLeading: false,@@ -117,9 +90,9 @@ class _TodoPageState extends State<TodoPage> {await CrudSupabase.getTodo();todos.clear();setState(() {});- value.forEach((element) {+ for (var element in value) {todos.add(element);- });+ }setState(() {loading = false;});@@ -127,11 +100,11 @@ class _TodoPageState extends State<TodoPage> {},title: Text(todos[index]["task"],- style: TextStyle(color: Colors.white),+ style: const TextStyle(color: Colors.white),),subtitle: Text(todos[index]["due"],- style: TextStyle(color: Colors.white),+ style: const TextStyle(color: Colors.white),),leading: GestureDetector(onTap: () async {@@ -144,9 +117,9 @@ class _TodoPageState extends State<TodoPage> {await CrudSupabase.getTodo();todos.clear();setState(() {});- value.forEach((element) {+ for (var element in value) {todos.add(element);- });+ }setState(() {loading = false;});@@ -168,9 +141,9 @@ class _TodoPageState extends State<TodoPage> {await CrudSupabase.getTodo();todos.clear();setState(() {});- value.forEach((element) {+ for (var element in value) {todos.add(element);- });+ }setState(() {loading = false;});@@ -202,6 +175,32 @@ class _TodoPageState extends State<TodoPage> {);},)),+ floatingActionButton: FloatingActionButton(+ backgroundColor: const Color(0xff33b27b),+ onPressed: () {+ displayTextInputDialog(context, () async {+ await CrudSupabase.addTodo(+ task: _taskEditingController.text,+ due: _dueEditingController.text,+ );+ Navigator.pop(context);+ setState(() {+ loading = true;+ });++ List<dynamic> value = await CrudSupabase.getTodo();+ todos.clear();+ setState(() {});+ for (var element in value) {+ todos.add(element);+ }+ setState(() {+ loading = false;+ });+ }, _taskEditingController, _dueEditingController);+ },+ child: const Icon(Icons.add),+ ),);}}