Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

revert the removal of splash_page

dshukertjra82105525dcb
diff --git a/examples/user-management/flutter-user-management/ios/Flutter/AppFrameworkInfo.plist b/examples/user-management/flutter-user-management/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f977a..9625e105df3 100644
--- a/examples/user-management/flutter-user-management/ios/Flutter/AppFrameworkInfo.plist
+++ b/examples/user-management/flutter-user-management/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
- <string>9.0</string>
+ <string>11.0</string>
</dict>
</plist>
diff --git a/examples/user-management/flutter-user-management/ios/Podfile.lock b/examples/user-management/flutter-user-management/ios/Podfile.lock
index 21589606edf..ce06341fd12 100644
--- a/examples/user-management/flutter-user-management/ios/Podfile.lock
+++ b/examples/user-management/flutter-user-management/ios/Podfile.lock
@@ -1,39 +1,59 @@
PODS:
+ - app_links (0.0.1):
+ - Flutter
- Flutter (1.0.0)
- - image_picker (0.0.1):
+ - image_picker_ios (0.0.1):
+ - Flutter
+ - path_provider_foundation (0.0.1):
+ - Flutter
+ - FlutterMacOS
+ - shared_preferences_foundation (0.0.1):
- Flutter
- - path_provider (0.0.1):
+ - FlutterMacOS
+ - sign_in_with_apple (0.0.1):
- Flutter
- - uni_links (0.0.1):
+ - url_launcher_ios (0.0.1):
- Flutter
- - url_launcher (0.0.1):
+ - webview_flutter_wkwebview (0.0.1):
- Flutter
DEPENDENCIES:
+ - app_links (from `.symlinks/plugins/app_links/ios`)
- Flutter (from `Flutter`)
- - image_picker (from `.symlinks/plugins/image_picker/ios`)
- - path_provider (from `.symlinks/plugins/path_provider/ios`)
- - uni_links (from `.symlinks/plugins/uni_links/ios`)
- - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
+ - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
+ - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
+ - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
+ - sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
+ - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
+ - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
EXTERNAL SOURCES:
+ app_links:
+ :path: ".symlinks/plugins/app_links/ios"
Flutter:
:path: Flutter
- image_picker:
- :path: ".symlinks/plugins/image_picker/ios"
- path_provider:
- :path: ".symlinks/plugins/path_provider/ios"
- uni_links:
- :path: ".symlinks/plugins/uni_links/ios"
- url_launcher:
- :path: ".symlinks/plugins/url_launcher/ios"
+ image_picker_ios:
+ :path: ".symlinks/plugins/image_picker_ios/ios"
+ path_provider_foundation:
+ :path: ".symlinks/plugins/path_provider_foundation/darwin"
+ shared_preferences_foundation:
+ :path: ".symlinks/plugins/shared_preferences_foundation/darwin"
+ sign_in_with_apple:
+ :path: ".symlinks/plugins/sign_in_with_apple/ios"
+ url_launcher_ios:
+ :path: ".symlinks/plugins/url_launcher_ios/ios"
+ webview_flutter_wkwebview:
+ :path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS:
- Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
- image_picker: e06f7a68f000bd36f552c1847e33cda96ed31f1f
- path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
- uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
- url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
+ app_links: 5ef33d0d295a89d9d16bb81b0e3b0d5f70d6c875
+ Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
+ image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
+ path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
+ shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
+ sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
+ url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
+ webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d
diff --git a/examples/user-management/flutter-user-management/ios/Runner.xcodeproj/project.pbxproj b/examples/user-management/flutter-user-management/ios/Runner.xcodeproj/project.pbxproj
index 7de2aa83853..ee1c7e0d9f2 100644
--- a/examples/user-management/flutter-user-management/ios/Runner.xcodeproj/project.pbxproj
+++ b/examples/user-management/flutter-user-management/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -200,10 +200,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -253,6 +255,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -340,7 +343,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -414,7 +417,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -463,7 +466,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
diff --git a/examples/user-management/flutter-user-management/ios/Runner/Info.plist b/examples/user-management/flutter-user-management/ios/Runner/Info.plist
index b52fcaf7c1e..84065d7ff84 100644
--- a/examples/user-management/flutter-user-management/ios/Runner/Info.plist
+++ b/examples/user-management/flutter-user-management/ios/Runner/Info.plist
@@ -60,5 +60,7 @@
<string>Need access to mic.</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
+ <key>UIApplicationSupportsIndirectInputEvents</key>
+ <true/>
</dict>
</plist>
diff --git a/examples/user-management/flutter-user-management/lib/main.dart b/examples/user-management/flutter-user-management/lib/main.dart
index 4687ece052a..656b7e22257 100644
--- a/examples/user-management/flutter-user-management/lib/main.dart
+++ b/examples/user-management/flutter-user-management/lib/main.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'package:supabase_quickstart/pages/account_page.dart';
import 'package:supabase_quickstart/pages/login_page.dart';
+import 'package:supabase_quickstart/pages/splash_page.dart';
Future<void> main() async {
await Supabase.initialize(
@@ -33,29 +34,13 @@ class MyApp extends StatelessWidget {
),
),
),
- home: StreamBuilder<AuthState>(
- stream: supabase.auth.onAuthStateChange,
- builder: (context, snapshot) {
- if (snapshot.hasError) {
- final error = snapshot.error;
- late String errorMessage;
- if (error is AuthException) {
- errorMessage = error.message;
- } else {
- errorMessage = 'Unexpected error occured.';
- }
- return Center(child: Text(errorMessage));
- } else if (!snapshot.hasData) {
- return const Center(child: CircularProgressIndicator());
- }
- final session = snapshot.data!.session;
- if (session == null) {
- return const LoginPage();
- } else {
- return const AccountPage();
- }
- },
- ),
+ initialRoute: '/',
+ routes: <String, WidgetBuilder>{
+ // Splash page is needed to ensure that authentication and page loading works correctly
+ '/': (_) => const SplashPage(),
+ '/login': (_) => const LoginPage(),
+ '/account': (_) => const AccountPage(),
+ },
);
}
}
diff --git a/examples/user-management/flutter-user-management/lib/pages/account_page.dart b/examples/user-management/flutter-user-management/lib/pages/account_page.dart
index 9c57f58a883..890f24e1f5c 100644
--- a/examples/user-management/flutter-user-management/lib/pages/account_page.dart
+++ b/examples/user-management/flutter-user-management/lib/pages/account_page.dart
@@ -15,7 +15,7 @@ class _AccountPageState extends State<AccountPage> {
final _websiteController = TextEditingController();
String? _avatarUrl;
- var _loading = false;
+ var _loading = true;
/// Called once a user id is received within `onAuthenticated()`
Future<void> _getProfile() async {
@@ -105,6 +105,10 @@ class _AccountPageState extends State<AccountPage> {
content: const Text('Unexpected error occurred'),
backgroundColor: Theme.of(context).colorScheme.error,
);
+ } finally {
+ if (mounted) {
+ Navigator.of(context).pushReplacementNamed('/login');
+ }
}
}
@@ -158,32 +162,34 @@ class _AccountPageState extends State<AccountPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Profile')),
- body: ListView(
- padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 12),
- children: [
- Avatar(
- imageUrl: _avatarUrl,
- onUpload: _onUpload,
- ),
- const SizedBox(height: 18),
- TextFormField(
- controller: _usernameController,
- decoration: const InputDecoration(labelText: 'User Name'),
- ),
- const SizedBox(height: 18),
- TextFormField(
- controller: _websiteController,
- decoration: const InputDecoration(labelText: 'Website'),
- ),
- const SizedBox(height: 18),
- ElevatedButton(
- onPressed: _loading ? null : _updateProfile,
- child: Text(_loading ? 'Saving...' : 'Update'),
- ),
- const SizedBox(height: 18),
- TextButton(onPressed: _signOut, child: const Text('Sign Out')),
- ],
- ),
+ body: _loading
+ ? const Center(child: CircularProgressIndicator())
+ : ListView(
+ padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 12),
+ children: [
+ Avatar(
+ imageUrl: _avatarUrl,
+ onUpload: _onUpload,
+ ),
+ const SizedBox(height: 18),
+ TextFormField(
+ controller: _usernameController,
+ decoration: const InputDecoration(labelText: 'User Name'),
+ ),
+ const SizedBox(height: 18),
+ TextFormField(
+ controller: _websiteController,
+ decoration: const InputDecoration(labelText: 'Website'),
+ ),
+ const SizedBox(height: 18),
+ ElevatedButton(
+ onPressed: _loading ? null : _updateProfile,
+ child: Text(_loading ? 'Saving...' : 'Update'),
+ ),
+ const SizedBox(height: 18),
+ TextButton(onPressed: _signOut, child: const Text('Sign Out')),
+ ],
+ ),
);
}
}
diff --git a/examples/user-management/flutter-user-management/lib/pages/login_page.dart b/examples/user-management/flutter-user-management/lib/pages/login_page.dart
index 7c96c7be784..1655d214761 100644
--- a/examples/user-management/flutter-user-management/lib/pages/login_page.dart
+++ b/examples/user-management/flutter-user-management/lib/pages/login_page.dart
@@ -14,7 +14,9 @@ class LoginPage extends StatefulWidget {
class _LoginPageState extends State<LoginPage> {
bool _isLoading = false;
+ bool _redirecting = false;
late final TextEditingController _emailController = TextEditingController();
+ late final StreamSubscription<AuthState> _authStateSubscription;
Future<void> _signIn() async {
try {
@@ -51,8 +53,22 @@ class _LoginPageState extends State<LoginPage> {
}
}
+ @override
+ void initState() {
+ _authStateSubscription = supabase.auth.onAuthStateChange.listen((data) {
+ if (_redirecting) return;
+ final session = data.session;
+ if (session != null) {
+ _redirecting = true;
+ Navigator.of(context).pushReplacementNamed('/account');
+ }
+ });
+ super.initState();
+ }
+
@override
void dispose() {
+ _authStateSubscription.cancel();
_emailController.dispose();
super.dispose();
}
diff --git a/examples/user-management/flutter-user-management/lib/pages/splash_page.dart b/examples/user-management/flutter-user-management/lib/pages/splash_page.dart
new file mode 100644
index 00000000000..82d3e80412e
--- /dev/null
+++ b/examples/user-management/flutter-user-management/lib/pages/splash_page.dart
@@ -0,0 +1,40 @@
+import 'package:flutter/material.dart';
+import 'package:supabase_quickstart/main.dart';
+
+class SplashPage extends StatefulWidget {
+ const SplashPage({super.key});
+
+ @override
+ _SplashPageState createState() => _SplashPageState();
+}
+
+class _SplashPageState extends State<SplashPage> {
+ bool _redirectCalled = false;
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ _redirect();
+ }
+
+ Future<void> _redirect() async {
+ await Future.delayed(Duration.zero);
+ if (_redirectCalled || !mounted) {
+ return;
+ }
+
+ _redirectCalled = true;
+ final session = supabase.auth.currentSession;
+ if (session != null) {
+ Navigator.of(context).pushReplacementNamed('/account');
+ } else {
+ Navigator.of(context).pushReplacementNamed('/login');
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return const Scaffold(
+ body: Center(child: CircularProgressIndicator()),
+ );
+ }
+}
diff --git a/examples/user-management/flutter-user-management/pubspec.yaml b/examples/user-management/flutter-user-management/pubspec.yaml
index 82b27ca5aea..c9a329fc2e0 100644
--- a/examples/user-management/flutter-user-management/pubspec.yaml
+++ b/examples/user-management/flutter-user-management/pubspec.yaml
@@ -1,5 +1,5 @@
name: supabase_quickstart
-description: Sample app on how to get started with Supabase on Flutter.
+description: Sample app on how to get started with Supabase on Flutter.
publish_to: 'none'
@@ -13,7 +13,7 @@ dependencies:
sdk: flutter
image_picker: ^0.8.4
- supabase_flutter: ^1.2.0
+ supabase_flutter: ^1.10.3
dev_dependencies:
flutter_test:
@@ -21,4 +21,4 @@ dev_dependencies:
lint: ^1.5.3
flutter:
- uses-material-design: true
\ No newline at end of file
+ uses-material-design: true