mirror of
https://github.com/flutter/packages.git
synced 2025-06-28 22:02:38 +08:00
[google_sign_in] Update (web) example app. (#5634)
## Changes **google_sign_in:** * Updates web bootstrap following [Flutter Web initialization docs](https://docs.flutter.dev/platform-integration/web/initialization#skipping-this-step). * Uses the recent [`web_only` library](https://pub.dev/documentation/google_sign_in_web/0.12.3/web_only/web_only-library.html) to `renderButton`. * Updates dependencies so it can compile with `--wasm`. (opportunistic weekend commit) **google_identity_services_web:** * Adds missing `CredentialSelectBy.fedcm_auto` enum value. * Bump patch version + changelog. ## Issues * Fixes https://github.com/flutter/flutter/issues/139852 * Missing bit of https://github.com/flutter/flutter/issues/138202 ## Testing * Deployed to: https://dit-gis-test.web.app
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
## 0.3.0+2
|
||||||
|
|
||||||
|
* Adds `fedcm_auto` to `CredentialSelectBy` enum.
|
||||||
|
* Adds `unknown_reason` to all `Moment*Reason` enums.
|
||||||
|
|
||||||
## 0.3.0+1
|
## 0.3.0+1
|
||||||
|
|
||||||
* Corrects 0.3.0 changelog entry about the minimum Flutter/Dart dependencies.
|
* Corrects 0.3.0 changelog entry about the minimum Flutter/Dart dependencies.
|
||||||
|
@ -118,7 +118,10 @@ enum MomentSkippedReason {
|
|||||||
tap_outside('tap_outside'),
|
tap_outside('tap_outside'),
|
||||||
|
|
||||||
/// issuing_failed
|
/// issuing_failed
|
||||||
issuing_failed('issuing_failed');
|
issuing_failed('issuing_failed'),
|
||||||
|
|
||||||
|
/// Unknown reason
|
||||||
|
unknown_reason('unknown_reason');
|
||||||
|
|
||||||
///
|
///
|
||||||
const MomentSkippedReason(String reason) : _reason = reason;
|
const MomentSkippedReason(String reason) : _reason = reason;
|
||||||
@ -137,7 +140,10 @@ enum MomentDismissedReason {
|
|||||||
cancel_called('cancel_called'),
|
cancel_called('cancel_called'),
|
||||||
|
|
||||||
/// flow_restarted
|
/// flow_restarted
|
||||||
flow_restarted('flow_restarted');
|
flow_restarted('flow_restarted'),
|
||||||
|
|
||||||
|
/// Unknown reason
|
||||||
|
unknown_reason('unknown_reason');
|
||||||
|
|
||||||
///
|
///
|
||||||
const MomentDismissedReason(String reason) : _reason = reason;
|
const MomentDismissedReason(String reason) : _reason = reason;
|
||||||
@ -207,7 +213,10 @@ enum CredentialSelectBy {
|
|||||||
btn_confirm_add_session('btn_confirm_add_session'),
|
btn_confirm_add_session('btn_confirm_add_session'),
|
||||||
|
|
||||||
/// A user with an existing session used the browser's "FedCM" flow.
|
/// A user with an existing session used the browser's "FedCM" flow.
|
||||||
fedcm('fedcm');
|
fedcm('fedcm'),
|
||||||
|
|
||||||
|
/// A fedcm authentication without user intervention.
|
||||||
|
fedcm_auto('fedcm_auto');
|
||||||
|
|
||||||
///
|
///
|
||||||
const CredentialSelectBy(String selectBy) : _selectBy = selectBy;
|
const CredentialSelectBy(String selectBy) : _selectBy = selectBy;
|
||||||
|
@ -2,7 +2,7 @@ name: google_identity_services_web
|
|||||||
description: A Dart JS-interop layer for Google Identity Services. Google's new sign-in SDK for Web that supports multiple types of credentials.
|
description: A Dart JS-interop layer for Google Identity Services. Google's new sign-in SDK for Web that supports multiple types of credentials.
|
||||||
repository: https://github.com/flutter/packages/tree/main/packages/google_identity_services_web
|
repository: https://github.com/flutter/packages/tree/main/packages/google_identity_services_web
|
||||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_identiy_services_web%22
|
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_identiy_services_web%22
|
||||||
version: 0.3.0+1
|
version: 0.3.0+2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.2.0 <4.0.0"
|
sdk: ">=3.2.0 <4.0.0"
|
||||||
|
@ -3,13 +3,11 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart';
|
import 'package:google_sign_in_web/web_only.dart' as web;
|
||||||
import 'package:google_sign_in_web/google_sign_in_web.dart' as web;
|
|
||||||
|
|
||||||
import 'stub.dart';
|
import 'stub.dart';
|
||||||
|
|
||||||
/// Renders a web-only SIGN IN button.
|
/// Renders a web-only SIGN IN button.
|
||||||
Widget buildSignInButton({HandleSignInFn? onPressed}) {
|
Widget buildSignInButton({HandleSignInFn? onPressed}) {
|
||||||
return (GoogleSignInPlatform.instance as web.GoogleSignInPlugin)
|
return web.renderButton();
|
||||||
.renderButton();
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ description: Example of Google Sign-In plugin.
|
|||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ^3.2.0
|
||||||
flutter: ">=3.10.0"
|
flutter: ">=3.16.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
@ -16,8 +16,7 @@ dependencies:
|
|||||||
# The example app is bundled with the plugin so we use a path dependency on
|
# The example app is bundled with the plugin so we use a path dependency on
|
||||||
# the parent directory to use the current plugin's version.
|
# the parent directory to use the current plugin's version.
|
||||||
path: ../
|
path: ../
|
||||||
google_sign_in_platform_interface: ^2.4.0
|
google_sign_in_web: ^0.12.3
|
||||||
google_sign_in_web: ^0.12.0
|
|
||||||
http: ">=0.13.0 <2.0.0"
|
http: ">=0.13.0 <2.0.0"
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
@ -7,8 +7,17 @@ found in the LICENSE file. -->
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="google-signin-client_id" content="your-client_id.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="your-client_id.apps.googleusercontent.com">
|
||||||
<title>Google Sign-in Example</title>
|
<title>Google Sign-in Example</title>
|
||||||
|
<script src="flutter.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="main.dart.js" type="application/javascript"></script>
|
<script>
|
||||||
|
window.addEventListener('load', function(ev) {
|
||||||
|
_flutter.loader.loadEntrypoint({
|
||||||
|
onEntrypointLoaded: function(engineInitializer) {
|
||||||
|
engineInitializer.autoStart();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user