File tree Expand file tree Collapse file tree 6 files changed +55
-3
lines changed 
packages/google_identity_services_web Expand file tree Collapse file tree 6 files changed +55
-3
lines changed Original file line number Diff line number Diff line change 1+ ## 0.2.0+1  
2+ 
3+ *  Relaxes the ` renderButton `  API so any JS-Interop Object can be its ` target ` .
4+ 
15## 0.2.0  
26
37*  Adds ` renderButton `  API to ` id.dart ` .
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import 'package:google_identity_services_web/id.dart';
99import  'package:integration_test/integration_test.dart' ;
1010import  'package:js/js.dart' ;
1111
12+ import  'src/dom.dart' ;
1213import  'utils.dart'  as  utils;
1314
1415void  main () async  {
@@ -19,6 +20,17 @@ void main() async {
1920    await  utils.installGisMock ();
2021  });
2122
23+   group ('renderButton' , () {
24+     testWidgets ('supports a js-interop target from any library' , (_) async  {
25+       final  DomElement  target =  createDomElement ('div' );
26+ 
27+       id.renderButton (target);
28+ 
29+       final  DomElement ?  button =  target.querySelector ('button' );
30+       expect (button, isNotNull);
31+     });
32+   });
33+ 
2234  group ('prompt' , () {
2335    testWidgets ('supports a moment notification callback' , (_) async  {
2436      id.initialize (IdConfiguration (client_id:  'testing_1-2-3' ));
Original file line number Diff line number Diff line change 1+ // Copyright 2013 The Flutter Authors. All rights reserved. 
2+ // Use of this source code is governed by a BSD-style license that can be 
3+ // found in the LICENSE file. 
4+ 
5+ // ignore_for_file: public_member_api_docs 
6+ 
7+ import  'package:js/js.dart' ;
8+ import  'package:js/js_util.dart'  as  js_util;
9+ 
10+ @JS ()
11+ @staticInterop 
12+ class  DomDocument  {}
13+ extension  DomDocumentExtension  on  DomDocument  {
14+   DomElement  createElement (String  name, [Object ?  options]) => 
15+       js_util.callMethod (this , 'createElement' ,
16+           < Object > [name, if  (options !=  null ) options]) as  DomElement ;
17+ }
18+ 
19+ @JS ()
20+ @staticInterop 
21+ class  DomElement  {}
22+ 
23+ extension  DomElementExtension  on  DomElement  {
24+   external  DomElement ?  querySelector (String  selector);
25+ }
26+ 
27+ @JS ('document' )
28+ external  DomDocument  get  domDocument;
29+ 
30+ DomElement  createDomElement (String  tag) =>  domDocument.createElement (tag);
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ class Id {
3333  initialize ( config )  { 
3434    this . config  =  config ; 
3535  } 
36+   renderButton ( target ,  config )  { 
37+     // Simulate rendering a button. 
38+     target . replaceChildren ( ) ; 
39+     target . dataset . buttonConfig  =  config ; 
40+     let  button  =  document . createElement ( 'button' ) ; 
41+     target . append ( button ) ; 
42+   } 
3643  prompt ( momentListener )  { 
3744    callAsync ( ( )  =>  { 
3845      if  ( this . mockCredentialResponse )  { 
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ library google_accounts_id;
1414
1515import  'package:js/js.dart' ;
1616
17- import  'dom.dart' ;
1817import  'shared.dart' ;
1918
2019/// Binding to the `google.accounts.id`  JS global. 
@@ -93,7 +92,7 @@ extension GoogleAccountsIdExtension on GoogleAccountsId {
9392  /// Method: google.accounts.id.renderButton 
9493  /// https://developers.google.com/identity/gsi/web/reference/js-reference#google.accounts.id.renderButton 
9594external  void  renderButton (
96-     DomHtmlElement  parent, [
95+     Object  parent, [
9796    GsiButtonConfiguration  options,
9897  ]);
9998
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: google_identity_services_web
22description : A Dart JS-interop layer for Google Identity Services. Google's new sign-in SDK for Web that supports multiple types of credentials. 
33repository : https://github.com/flutter/packages/tree/main/packages/google_identity_services_web 
44issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_identiy_services_web%22 
5- version : 0.2.0 
5+ version : 0.2.0+1  
66
77environment :
88  sdk : " >=2.17.0 <3.0.0" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments