🧱 Add login with apple to web
This commit is contained in:
parent
b3786827ef
commit
484ded03b1
@ -565,6 +565,10 @@ class _LoginLookupScreen extends HookConsumerWidget {
|
|||||||
try {
|
try {
|
||||||
final credential = await SignInWithApple.getAppleIDCredential(
|
final credential = await SignInWithApple.getAppleIDCredential(
|
||||||
scopes: [AppleIDAuthorizationScopes.email],
|
scopes: [AppleIDAuthorizationScopes.email],
|
||||||
|
webAuthenticationOptions: WebAuthenticationOptions(
|
||||||
|
clientId: 'dev.solsynth.solarpass',
|
||||||
|
redirectUri: Uri.parse('https://nt.solian.app/auth/callback/apple'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (context.mounted) showLoadingModal(context);
|
if (context.mounted) showLoadingModal(context);
|
||||||
@ -591,6 +595,7 @@ class _LoginLookupScreen extends HookConsumerWidget {
|
|||||||
if (context.mounted) Navigator.pop(context, true);
|
if (context.mounted) Navigator.pop(context, true);
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err is SignInWithAppleCredentialsException) return;
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
if (context.mounted) hideLoadingModal(context);
|
if (context.mounted) hideLoadingModal(context);
|
||||||
@ -626,13 +631,13 @@ class _LoginLookupScreen extends HookConsumerWidget {
|
|||||||
onSubmitted: isBusy.value ? null : (_) => performNewTicket(),
|
onSubmitted: isBusy.value ? null : (_) => performNewTicket(),
|
||||||
).padding(horizontal: 7),
|
).padding(horizontal: 7),
|
||||||
Row(
|
Row(
|
||||||
spacing: 4,
|
spacing: 6,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text("loginOr").tr().fontSize(11).opacity(0.85),
|
Text("loginOr").tr().fontSize(11).opacity(0.85),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
IconButton.filled(
|
IconButton.filledTonal(
|
||||||
onPressed: () async {},
|
onPressed: () async {},
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
@ -642,7 +647,7 @@ class _LoginLookupScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
tooltip: 'Google',
|
tooltip: 'Google',
|
||||||
),
|
),
|
||||||
IconButton.filled(
|
IconButton.filledTonal(
|
||||||
onPressed: () async {},
|
onPressed: () async {},
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
@ -652,7 +657,7 @@ class _LoginLookupScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
tooltip: 'Microsoft',
|
tooltip: 'Microsoft',
|
||||||
),
|
),
|
||||||
IconButton.filled(
|
IconButton.filledTonal(
|
||||||
onPressed: withApple,
|
onPressed: withApple,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
icon: SvgPicture.asset(
|
icon: SvgPicture.asset(
|
||||||
@ -663,7 +668,7 @@ class _LoginLookupScreen extends HookConsumerWidget {
|
|||||||
tooltip: 'Apple Account',
|
tooltip: 'Apple Account',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
).padding(horizontal: 8, top: 8, bottom: 4),
|
).padding(horizontal: 8, vertical: 8),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
@ -4,6 +4,7 @@ import 'package:gap/gap.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:island/models/post.dart';
|
import 'package:island/models/post.dart';
|
||||||
import 'package:island/pods/network.dart';
|
import 'package:island/pods/network.dart';
|
||||||
|
import 'package:island/pods/userinfo.dart';
|
||||||
import 'package:island/services/responsive.dart';
|
import 'package:island/services/responsive.dart';
|
||||||
import 'package:island/widgets/app_scaffold.dart';
|
import 'package:island/widgets/app_scaffold.dart';
|
||||||
import 'package:island/widgets/post/post_item.dart';
|
import 'package:island/widgets/post/post_item.dart';
|
||||||
@ -29,6 +30,7 @@ class PostDetailScreen extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final post = ref.watch(postProvider(id));
|
final post = ref.watch(postProvider(id));
|
||||||
|
final user = ref.watch(userInfoProvider);
|
||||||
|
|
||||||
final isWide = isWideScreen(context);
|
final isWide = isWideScreen(context);
|
||||||
|
|
||||||
@ -58,6 +60,7 @@ class PostDetailScreen extends HookConsumerWidget {
|
|||||||
SliverGap(MediaQuery.of(context).padding.bottom + 80),
|
SliverGap(MediaQuery.of(context).padding.bottom + 80),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
if (user.value != null)
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user