From dd8313511d2fbceb21481c85ea543295e16015f1 Mon Sep 17 00:00:00 2001 From: Valentin Vignal Date: Tue, 28 Sep 2021 23:18:46 +0800 Subject: [PATCH 01/16] :bug: Use a transparent image as a placeholder --- .../google_sign_in/lib/widgets.dart | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index 18f9973454f6..09a9eec5103c 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -106,10 +106,59 @@ class GoogleUserCircleAvatar extends StatelessWidget { FadeInImage.memoryNetwork( // This creates a transparent placeholder image, so that // [placeholder] shows through. - placeholder: Uint8List((size.round() * size.round())), + placeholder: _kTransparentImage, image: sizedPhotoUrl, ) ]), )); } } + +/// This is an transparent 1x1 gif image +final Uint8List _kTransparentImage = Uint8List.fromList( + [ + 71, + 73, + 70, + 56, + 57, + 97, + 1, + 0, + 1, + 0, + 128, + 0, + 0, + 255, + 255, + 255, + 0, + 0, + 0, + 33, + 249, + 4, + 1, + 0, + 0, + 0, + 0, + 44, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 2, + 68, + 1, + 0, + 59, + ], +); From 4ffd27f8d14d19738a1a468729af2f40d8c1a5df Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 30 Sep 2021 20:23:21 +0800 Subject: [PATCH 02/16] :bookmark: Modify version in pubspec and CHANGELOG --- packages/google_sign_in/google_sign_in/CHANGELOG.md | 4 ++++ packages/google_sign_in/google_sign_in/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 6107560ce610..558b1770d67c 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.1.2 + +Change the placeholder of the GoogleUserCircleAvatar to a transparent image. + ## 5.1.1 * Update minimum Flutter SDK to 2.5 and iOS deployment target to 9.0. diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index aa0a686776fb..7ee6ba3b0fc4 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android and iOS. repository: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.1.1 +version: 5.1.2 environment: sdk: ">=2.14.0 <3.0.0" From 8008688cbea9737eefa826368c8794d9850a820d Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 30 Sep 2021 21:55:16 +0800 Subject: [PATCH 03/16] :white_check_mark: Write a test to make sur the GoogleUserCircleAvatar successfully builds --- .../google_sign_in/test/widgets_test.dart | 572 ++++++++++++++++++ 1 file changed, 572 insertions(+) create mode 100644 packages/google_sign_in/google_sign_in/test/widgets_test.dart diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart new file mode 100644 index 000000000000..5a7dd46a8e3f --- /dev/null +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -0,0 +1,572 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:google_sign_in/google_sign_in.dart'; + +/// A instantiable class that extends [GoogleIdentity] +class _TestGoogleIdentity extends GoogleIdentity { + _TestGoogleIdentity({ + required this.id, + required this.email, + this.displayName, + this.photoUrl, + }); + + final String id; + final String email; + + final String? displayName; + + final String? photoUrl; +} + +/// A mocked [HttpClient] which always returns a [_MockHttpRequest]. +class _MockHttpClient implements HttpClient { + @override + bool autoUncompress = true; + + @override + Duration? connectionTimeout; + + @override + Duration idleTimeout = const Duration(seconds: 15); + + @override + int? maxConnectionsPerHost; + + @override + String? userAgent; + + @override + void addCredentials( + Uri url, String realm, HttpClientCredentials credentials) {} + + @override + void addProxyCredentials( + String host, int port, String realm, HttpClientCredentials credentials) {} + + @override + set authenticate( + Future Function(Uri url, String scheme, String realm)? f) {} + + @override + set authenticateProxy( + Future Function(String host, int port, String scheme, String realm)? + f) {} + + @override + set badCertificateCallback( + bool Function(X509Certificate cert, String host, int port)? callback) {} + + @override + void close({bool force = false}) {} + + @override + Future delete(String host, int port, String path) { + throw UnimplementedError(); + } + + @override + Future deleteUrl(Uri url) { + throw UnimplementedError(); + } + + @override + set findProxy(String Function(Uri url)? f) {} + + @override + Future get(String host, int port, String path) { + throw UnimplementedError(); + } + + @override + Future getUrl(Uri url) { + return Future.value(_MockHttpRequest()); + } + + @override + Future head(String host, int port, String path) { + throw UnimplementedError(); + } + + @override + Future headUrl(Uri url) { + throw UnimplementedError(); + } + + @override + Future open( + String method, String host, int port, String path) { + throw UnimplementedError(); + } + + @override + Future openUrl(String method, Uri url) { + throw UnimplementedError(); + } + + @override + Future patch(String host, int port, String path) { + throw UnimplementedError(); + } + + @override + Future patchUrl(Uri url) { + throw UnimplementedError(); + } + + @override + Future post(String host, int port, String path) { + throw UnimplementedError(); + } + + @override + Future postUrl(Uri url) { + throw UnimplementedError(); + } + + @override + Future put(String host, int port, String path) { + throw UnimplementedError(); + } + + @override + Future putUrl(Uri url) { + throw UnimplementedError(); + } +} + +/// A mocked [HttpClientRequest] which always returns a [_MockHttpClientResponse]. +class _MockHttpRequest extends HttpClientRequest { + @override + late Encoding encoding; + + @override + final HttpHeaders headers = _MockHttpHeaders(); + + @override + void add(List data) {} + + @override + void addError(Object error, [StackTrace? stackTrace]) {} + + @override + Future addStream(Stream> stream) { + throw UnimplementedError(); + } + + @override + Future close() { + return Future.value(_MockHttpResponse()); + } + + @override + void abort([Object? exception, StackTrace? stackTrace]) {} + + @override + HttpConnectionInfo? get connectionInfo => null; + + @override + List get cookies => []; + + @override + Future get done async => _MockHttpResponse(); + + @override + Future flush() { + return Future.value(); + } + + @override + String get method => ''; + + @override + Uri get uri => Uri(); + + @override + void write(Object? obj) {} + + @override + void writeAll(Iterable objects, [String separator = '']) {} + + @override + void writeCharCode(int charCode) {} + + @override + void writeln([Object? obj = '']) {} +} + +/// This is an transparent 1x1 gif image +final Uint8List _kTransparentImage = Uint8List.fromList( + [ + 71, + 73, + 70, + 56, + 57, + 97, + 1, + 0, + 1, + 0, + 128, + 0, + 0, + 255, + 255, + 255, + 0, + 0, + 0, + 33, + 249, + 4, + 1, + 0, + 0, + 0, + 0, + 44, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 2, + 2, + 68, + 1, + 0, + 59, + ], +); + +/// A mocked [HttpClientResponse] which is empty and has a [statusCode] of 200 +/// and returns a 1x1 transparent image. +class _MockHttpResponse implements HttpClientResponse { + final Stream _delegate = + Stream.value(_kTransparentImage); + + @override + final HttpHeaders headers = _MockHttpHeaders(); + + @override + X509Certificate? get certificate => null; + + @override + HttpConnectionInfo? get connectionInfo => null; + + @override + int get contentLength => -1; + + @override + HttpClientResponseCompressionState get compressionState { + return HttpClientResponseCompressionState.decompressed; + } + + @override + List get cookies => []; + + @override + Future detachSocket() { + return Future.error(UnsupportedError('Mocked response')); + } + + @override + bool get isRedirect => false; + + @override + StreamSubscription listen(void Function(Uint8List event)? onData, + {Function? onError, void Function()? onDone, bool? cancelOnError}) { + return _delegate.listen(onData, + onError: onError, onDone: onDone, cancelOnError: cancelOnError); + } + + @override + bool get persistentConnection => false; + + @override + String get reasonPhrase => ''; + + @override + Future redirect( + [String? method, Uri? url, bool? followLoops]) { + return Future.error( + UnsupportedError('Mocked response')); + } + + @override + List get redirects => []; + + @override + int get statusCode => 200; + + @override + Future any(bool Function(Uint8List element) test) { + return _delegate.any(test); + } + + @override + Stream asBroadcastStream({ + void Function(StreamSubscription subscription)? onListen, + void Function(StreamSubscription subscription)? onCancel, + }) { + return _delegate.asBroadcastStream(onListen: onListen, onCancel: onCancel); + } + + @override + Stream asyncExpand(Stream? Function(Uint8List event) convert) { + return _delegate.asyncExpand(convert); + } + + @override + Stream asyncMap(FutureOr Function(Uint8List event) convert) { + return _delegate.asyncMap(convert); + } + + @override + Stream cast() { + return _delegate.cast(); + } + + @override + Future contains(Object? needle) { + return _delegate.contains(needle); + } + + @override + Stream distinct( + [bool Function(Uint8List previous, Uint8List next)? equals]) { + return _delegate.distinct(equals); + } + + @override + Future drain([E? futureValue]) { + return _delegate.drain(futureValue); + } + + @override + Future elementAt(int index) { + return _delegate.elementAt(index); + } + + @override + Future every(bool Function(Uint8List element) test) { + return _delegate.every(test); + } + + @override + Stream expand(Iterable Function(Uint8List element) convert) { + return _delegate.expand(convert); + } + + @override + Future get first => _delegate.first; + + @override + Future firstWhere( + bool Function(Uint8List element) test, { + List Function()? orElse, + }) { + return _delegate.firstWhere(test, + orElse: orElse == null + ? null + : () { + return Uint8List.fromList(orElse()); + }); + } + + @override + Future fold( + S initialValue, S Function(S previous, Uint8List element) combine) { + return _delegate.fold(initialValue, combine); + } + + @override + Future forEach(void Function(Uint8List element) action) { + return _delegate.forEach(action); + } + + @override + Stream handleError( + Function onError, { + bool Function(dynamic error)? test, + }) { + return _delegate.handleError(onError, test: test); + } + + @override + bool get isBroadcast => _delegate.isBroadcast; + + @override + Future get isEmpty => _delegate.isEmpty; + + @override + Future join([String separator = '']) { + return _delegate.join(separator); + } + + @override + Future get last => _delegate.last; + + @override + Future lastWhere( + bool Function(Uint8List element) test, { + List Function()? orElse, + }) { + return _delegate.lastWhere(test, + orElse: orElse == null + ? null + : () { + return Uint8List.fromList(orElse()); + }); + } + + @override + Future get length => _delegate.length; + + @override + Stream map(S Function(Uint8List event) convert) { + return _delegate.map(convert); + } + + @override + Future pipe(StreamConsumer> streamConsumer) { + return _delegate.cast>().pipe(streamConsumer); + } + + @override + Future reduce( + List Function(Uint8List previous, Uint8List element) combine) { + return _delegate.reduce((Uint8List previous, Uint8List element) { + return Uint8List.fromList(combine(previous, element)); + }); + } + + @override + Future get single => _delegate.single; + + @override + Future singleWhere(bool Function(Uint8List element) test, + {List Function()? orElse}) { + return _delegate.singleWhere(test, + orElse: orElse == null + ? null + : () { + return Uint8List.fromList(orElse()); + }); + } + + @override + Stream skip(int count) { + return _delegate.skip(count); + } + + @override + Stream skipWhile(bool Function(Uint8List element) test) { + return _delegate.skipWhile(test); + } + + @override + Stream take(int count) { + return _delegate.take(count); + } + + @override + Stream takeWhile(bool Function(Uint8List element) test) { + return _delegate.takeWhile(test); + } + + @override + Stream timeout( + Duration timeLimit, { + void Function(EventSink sink)? onTimeout, + }) { + return _delegate.timeout(timeLimit, onTimeout: onTimeout); + } + + @override + Future> toList() { + return _delegate.toList(); + } + + @override + Future> toSet() { + return _delegate.toSet(); + } + + @override + Stream transform(StreamTransformer, S> streamTransformer) { + return _delegate.cast>().transform(streamTransformer); + } + + @override + Stream where(bool Function(Uint8List event) test) { + return _delegate.where(test); + } +} + +/// A mocked [HttpHeaders] that ignores all writes. +class _MockHttpHeaders extends HttpHeaders { + @override + List? operator [](String name) => []; + + @override + void add(String name, Object value, {bool preserveHeaderCase = false}) {} + + @override + void clear() {} + + @override + void forEach(void Function(String name, List values) f) {} + + @override + void noFolding(String name) {} + + @override + void remove(String name, Object value) {} + + @override + void removeAll(String name) {} + + @override + void set(String name, Object value, {bool preserveHeaderCase = false}) {} + + @override + String? value(String name) => null; +} + +void main() { + testWidgets('It should build th GoogleUserCircleAvatar successfully', + (WidgetTester tester) async { + final GoogleIdentity identity = _TestGoogleIdentity( + email: 'email@email.com', + id: 'userId', + photoUrl: 'photoUrl', + ); + tester.binding.window.physicalSizeTestValue = Size(100, 100); + + await HttpOverrides.runZoned( + () async { + await tester.pumpWidget(MaterialApp( + home: SizedBox( + height: 100, + width: 100, + child: GoogleUserCircleAvatar( + identity: identity, + ), + ), + )); + }, + createHttpClient: (SecurityContext? c) => _MockHttpClient(), + ); + }); +} From 80484512b260d57a45e5ef20987eff736c3ba1b1 Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 30 Sep 2021 22:03:39 +0800 Subject: [PATCH 04/16] :art: _kTransparentImage -> _transparentImage as it is not a const --- packages/google_sign_in/google_sign_in/lib/widgets.dart | 4 ++-- packages/google_sign_in/google_sign_in/test/widgets_test.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index 09a9eec5103c..03b0527f9fd5 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -106,7 +106,7 @@ class GoogleUserCircleAvatar extends StatelessWidget { FadeInImage.memoryNetwork( // This creates a transparent placeholder image, so that // [placeholder] shows through. - placeholder: _kTransparentImage, + placeholder: _transparentImage, image: sizedPhotoUrl, ) ]), @@ -115,7 +115,7 @@ class GoogleUserCircleAvatar extends StatelessWidget { } /// This is an transparent 1x1 gif image -final Uint8List _kTransparentImage = Uint8List.fromList( +final Uint8List _transparentImage = Uint8List.fromList( [ 71, 73, diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 5a7dd46a8e3f..556877653def 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -201,7 +201,7 @@ class _MockHttpRequest extends HttpClientRequest { } /// This is an transparent 1x1 gif image -final Uint8List _kTransparentImage = Uint8List.fromList( +final Uint8List _transparentImage = Uint8List.fromList( [ 71, 73, @@ -253,7 +253,7 @@ final Uint8List _kTransparentImage = Uint8List.fromList( /// and returns a 1x1 transparent image. class _MockHttpResponse implements HttpClientResponse { final Stream _delegate = - Stream.value(_kTransparentImage); + Stream.value(_transparentImage); @override final HttpHeaders headers = _MockHttpHeaders(); From 75725efaa6cc9c5d82ee0ba5c5d7774e3a48b4aa Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 30 Sep 2021 22:07:59 +0800 Subject: [PATCH 05/16] :page_facing_up: Add license block to test/widgets_test.dart --- packages/google_sign_in/google_sign_in/test/widgets_test.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 556877653def..762587955899 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:async'; import 'dart:convert'; import 'dart:io'; From a54232dbfe52100a2f4b817c2df1a334901981c6 Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Tue, 26 Oct 2021 22:42:56 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20=20=20Use=20fixed?= =?UTF-8?q?-width=20hex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../google_sign_in/lib/widgets.dart | 86 +++++++++---------- .../google_sign_in/test/widgets_test.dart | 86 +++++++++---------- 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index 03b0527f9fd5..5cf0aeac9660 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -117,48 +117,48 @@ class GoogleUserCircleAvatar extends StatelessWidget { /// This is an transparent 1x1 gif image final Uint8List _transparentImage = Uint8List.fromList( [ - 71, - 73, - 70, - 56, - 57, - 97, - 1, - 0, - 1, - 0, - 128, - 0, - 0, - 255, - 255, - 255, - 0, - 0, - 0, - 33, - 249, - 4, - 1, - 0, - 0, - 0, - 0, - 44, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 2, - 2, - 68, - 1, - 0, - 59, + 0x47, + 0x49, + 0x46, + 0x38, + 0x39, + 0x61, + 0x01, + 0x00, + 0x01, + 0x00, + 0x80, + 0x00, + 0x00, + 0xFF, + 0xFF, + 0xFF, + 0x00, + 0x00, + 0x00, + 0x21, + 0xF9, + 0x04, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x2C, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x00, + 0x02, + 0x02, + 0x44, + 0x01, + 0x00, + 0x3B, ], ); diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 762587955899..a91043bb88a5 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -207,49 +207,49 @@ class _MockHttpRequest extends HttpClientRequest { /// This is an transparent 1x1 gif image final Uint8List _transparentImage = Uint8List.fromList( [ - 71, - 73, - 70, - 56, - 57, - 97, - 1, - 0, - 1, - 0, - 128, - 0, - 0, - 255, - 255, - 255, - 0, - 0, - 0, - 33, - 249, - 4, - 1, - 0, - 0, - 0, - 0, - 44, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 2, - 2, - 68, - 1, - 0, - 59, + 0x47, + 0x49, + 0x46, + 0x38, + 0x39, + 0x61, + 0x01, + 0x00, + 0x01, + 0x00, + 0x80, + 0x00, + 0x00, + 0xFF, + 0xFF, + 0xFF, + 0x00, + 0x00, + 0x00, + 0x21, + 0xF9, + 0x04, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x2C, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x00, + 0x02, + 0x02, + 0x44, + 0x01, + 0x00, + 0x3B, ], ); From 9a9d6d4b95c3e522011899a0ab10736c97a1affc Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Tue, 26 Oct 2021 22:44:08 +0800 Subject: [PATCH 07/16] :fire: Remove unused constructor parameter --- .../google_sign_in/google_sign_in/test/widgets_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index a91043bb88a5..a5b47d93ff5e 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -16,16 +16,16 @@ class _TestGoogleIdentity extends GoogleIdentity { _TestGoogleIdentity({ required this.id, required this.email, - this.displayName, this.photoUrl, }); final String id; final String email; - final String? displayName; - final String? photoUrl; + + @override + String? get displayName => null; } /// A mocked [HttpClient] which always returns a [_MockHttpRequest]. From b18a8e2f0089e7dcb78a9716b61314219bd7d13d Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Tue, 26 Oct 2021 22:45:13 +0800 Subject: [PATCH 08/16] :recycle: Use Fake --- .../google_sign_in/test/widgets_test.dart | 434 +----------------- 1 file changed, 3 insertions(+), 431 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index a5b47d93ff5e..fc2ca468836b 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; @@ -29,179 +28,22 @@ class _TestGoogleIdentity extends GoogleIdentity { } /// A mocked [HttpClient] which always returns a [_MockHttpRequest]. -class _MockHttpClient implements HttpClient { +class _MockHttpClient extends Fake implements HttpClient { @override bool autoUncompress = true; - @override - Duration? connectionTimeout; - - @override - Duration idleTimeout = const Duration(seconds: 15); - - @override - int? maxConnectionsPerHost; - - @override - String? userAgent; - - @override - void addCredentials( - Uri url, String realm, HttpClientCredentials credentials) {} - - @override - void addProxyCredentials( - String host, int port, String realm, HttpClientCredentials credentials) {} - - @override - set authenticate( - Future Function(Uri url, String scheme, String realm)? f) {} - - @override - set authenticateProxy( - Future Function(String host, int port, String scheme, String realm)? - f) {} - - @override - set badCertificateCallback( - bool Function(X509Certificate cert, String host, int port)? callback) {} - - @override - void close({bool force = false}) {} - - @override - Future delete(String host, int port, String path) { - throw UnimplementedError(); - } - - @override - Future deleteUrl(Uri url) { - throw UnimplementedError(); - } - - @override - set findProxy(String Function(Uri url)? f) {} - - @override - Future get(String host, int port, String path) { - throw UnimplementedError(); - } - @override Future getUrl(Uri url) { return Future.value(_MockHttpRequest()); } - - @override - Future head(String host, int port, String path) { - throw UnimplementedError(); - } - - @override - Future headUrl(Uri url) { - throw UnimplementedError(); - } - - @override - Future open( - String method, String host, int port, String path) { - throw UnimplementedError(); - } - - @override - Future openUrl(String method, Uri url) { - throw UnimplementedError(); - } - - @override - Future patch(String host, int port, String path) { - throw UnimplementedError(); - } - - @override - Future patchUrl(Uri url) { - throw UnimplementedError(); - } - - @override - Future post(String host, int port, String path) { - throw UnimplementedError(); - } - - @override - Future postUrl(Uri url) { - throw UnimplementedError(); - } - - @override - Future put(String host, int port, String path) { - throw UnimplementedError(); - } - - @override - Future putUrl(Uri url) { - throw UnimplementedError(); - } } /// A mocked [HttpClientRequest] which always returns a [_MockHttpClientResponse]. -class _MockHttpRequest extends HttpClientRequest { - @override - late Encoding encoding; - - @override - final HttpHeaders headers = _MockHttpHeaders(); - - @override - void add(List data) {} - - @override - void addError(Object error, [StackTrace? stackTrace]) {} - - @override - Future addStream(Stream> stream) { - throw UnimplementedError(); - } - +class _MockHttpRequest extends Fake implements HttpClientRequest { @override Future close() { return Future.value(_MockHttpResponse()); } - - @override - void abort([Object? exception, StackTrace? stackTrace]) {} - - @override - HttpConnectionInfo? get connectionInfo => null; - - @override - List get cookies => []; - - @override - Future get done async => _MockHttpResponse(); - - @override - Future flush() { - return Future.value(); - } - - @override - String get method => ''; - - @override - Uri get uri => Uri(); - - @override - void write(Object? obj) {} - - @override - void writeAll(Iterable objects, [String separator = '']) {} - - @override - void writeCharCode(int charCode) {} - - @override - void writeln([Object? obj = '']) {} } /// This is an transparent 1x1 gif image @@ -255,19 +97,10 @@ final Uint8List _transparentImage = Uint8List.fromList( /// A mocked [HttpClientResponse] which is empty and has a [statusCode] of 200 /// and returns a 1x1 transparent image. -class _MockHttpResponse implements HttpClientResponse { +class _MockHttpResponse extends Fake implements HttpClientResponse { final Stream _delegate = Stream.value(_transparentImage); - @override - final HttpHeaders headers = _MockHttpHeaders(); - - @override - X509Certificate? get certificate => null; - - @override - HttpConnectionInfo? get connectionInfo => null; - @override int get contentLength => -1; @@ -276,17 +109,6 @@ class _MockHttpResponse implements HttpClientResponse { return HttpClientResponseCompressionState.decompressed; } - @override - List get cookies => []; - - @override - Future detachSocket() { - return Future.error(UnsupportedError('Mocked response')); - } - - @override - bool get isRedirect => false; - @override StreamSubscription listen(void Function(Uint8List event)? onData, {Function? onError, void Function()? onDone, bool? cancelOnError}) { @@ -294,258 +116,8 @@ class _MockHttpResponse implements HttpClientResponse { onError: onError, onDone: onDone, cancelOnError: cancelOnError); } - @override - bool get persistentConnection => false; - - @override - String get reasonPhrase => ''; - - @override - Future redirect( - [String? method, Uri? url, bool? followLoops]) { - return Future.error( - UnsupportedError('Mocked response')); - } - - @override - List get redirects => []; - @override int get statusCode => 200; - - @override - Future any(bool Function(Uint8List element) test) { - return _delegate.any(test); - } - - @override - Stream asBroadcastStream({ - void Function(StreamSubscription subscription)? onListen, - void Function(StreamSubscription subscription)? onCancel, - }) { - return _delegate.asBroadcastStream(onListen: onListen, onCancel: onCancel); - } - - @override - Stream asyncExpand(Stream? Function(Uint8List event) convert) { - return _delegate.asyncExpand(convert); - } - - @override - Stream asyncMap(FutureOr Function(Uint8List event) convert) { - return _delegate.asyncMap(convert); - } - - @override - Stream cast() { - return _delegate.cast(); - } - - @override - Future contains(Object? needle) { - return _delegate.contains(needle); - } - - @override - Stream distinct( - [bool Function(Uint8List previous, Uint8List next)? equals]) { - return _delegate.distinct(equals); - } - - @override - Future drain([E? futureValue]) { - return _delegate.drain(futureValue); - } - - @override - Future elementAt(int index) { - return _delegate.elementAt(index); - } - - @override - Future every(bool Function(Uint8List element) test) { - return _delegate.every(test); - } - - @override - Stream expand(Iterable Function(Uint8List element) convert) { - return _delegate.expand(convert); - } - - @override - Future get first => _delegate.first; - - @override - Future firstWhere( - bool Function(Uint8List element) test, { - List Function()? orElse, - }) { - return _delegate.firstWhere(test, - orElse: orElse == null - ? null - : () { - return Uint8List.fromList(orElse()); - }); - } - - @override - Future fold( - S initialValue, S Function(S previous, Uint8List element) combine) { - return _delegate.fold(initialValue, combine); - } - - @override - Future forEach(void Function(Uint8List element) action) { - return _delegate.forEach(action); - } - - @override - Stream handleError( - Function onError, { - bool Function(dynamic error)? test, - }) { - return _delegate.handleError(onError, test: test); - } - - @override - bool get isBroadcast => _delegate.isBroadcast; - - @override - Future get isEmpty => _delegate.isEmpty; - - @override - Future join([String separator = '']) { - return _delegate.join(separator); - } - - @override - Future get last => _delegate.last; - - @override - Future lastWhere( - bool Function(Uint8List element) test, { - List Function()? orElse, - }) { - return _delegate.lastWhere(test, - orElse: orElse == null - ? null - : () { - return Uint8List.fromList(orElse()); - }); - } - - @override - Future get length => _delegate.length; - - @override - Stream map(S Function(Uint8List event) convert) { - return _delegate.map(convert); - } - - @override - Future pipe(StreamConsumer> streamConsumer) { - return _delegate.cast>().pipe(streamConsumer); - } - - @override - Future reduce( - List Function(Uint8List previous, Uint8List element) combine) { - return _delegate.reduce((Uint8List previous, Uint8List element) { - return Uint8List.fromList(combine(previous, element)); - }); - } - - @override - Future get single => _delegate.single; - - @override - Future singleWhere(bool Function(Uint8List element) test, - {List Function()? orElse}) { - return _delegate.singleWhere(test, - orElse: orElse == null - ? null - : () { - return Uint8List.fromList(orElse()); - }); - } - - @override - Stream skip(int count) { - return _delegate.skip(count); - } - - @override - Stream skipWhile(bool Function(Uint8List element) test) { - return _delegate.skipWhile(test); - } - - @override - Stream take(int count) { - return _delegate.take(count); - } - - @override - Stream takeWhile(bool Function(Uint8List element) test) { - return _delegate.takeWhile(test); - } - - @override - Stream timeout( - Duration timeLimit, { - void Function(EventSink sink)? onTimeout, - }) { - return _delegate.timeout(timeLimit, onTimeout: onTimeout); - } - - @override - Future> toList() { - return _delegate.toList(); - } - - @override - Future> toSet() { - return _delegate.toSet(); - } - - @override - Stream transform(StreamTransformer, S> streamTransformer) { - return _delegate.cast>().transform(streamTransformer); - } - - @override - Stream where(bool Function(Uint8List event) test) { - return _delegate.where(test); - } -} - -/// A mocked [HttpHeaders] that ignores all writes. -class _MockHttpHeaders extends HttpHeaders { - @override - List? operator [](String name) => []; - - @override - void add(String name, Object value, {bool preserveHeaderCase = false}) {} - - @override - void clear() {} - - @override - void forEach(void Function(String name, List values) f) {} - - @override - void noFolding(String name) {} - - @override - void remove(String name, Object value) {} - - @override - void removeAll(String name) {} - - @override - void set(String name, Object value, {bool preserveHeaderCase = false}) {} - - @override - String? value(String name) => null; } void main() { From 316afbf2683842ded6f5136c33d9ace22623b2db Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Tue, 26 Oct 2021 23:13:29 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=F0=9F=94=80=20=20Fix=20merge=20conflict?= =?UTF-8?q?=20with=20master.=20Update=20version=20number=20and=20override?= =?UTF-8?q?=20serverAuthCode=20in=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/google_sign_in/google_sign_in/CHANGELOG.md | 4 ++++ packages/google_sign_in/google_sign_in/pubspec.yaml | 2 +- packages/google_sign_in/google_sign_in/test/widgets_test.dart | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 6f4ccebf8dc3..b16b5f9f5e79 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.2.1 + + Change the placeholder of the GoogleUserCircleAvatar to a transparent image. + ## 5.2.0 * Add `GoogleSignInAccount.serverAuthCode`. Mark `GoogleSignInAuthentication.serverAuthCode` as deprecated. diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index 91114c6b0491..03e583a662d8 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android and iOS. repository: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.2.0 +version: 5.2.1 environment: sdk: ">=2.14.0 <3.0.0" diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index fc2ca468836b..77fe891814eb 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -25,6 +25,9 @@ class _TestGoogleIdentity extends GoogleIdentity { @override String? get displayName => null; + + @override + String? get serverAuthCode => null; } /// A mocked [HttpClient] which always returns a [_MockHttpRequest]. From 166822e424e711ef303a8e53e85090ca9215d4ef Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 28 Oct 2021 20:28:20 +0800 Subject: [PATCH 10/16] :art: Use comment to format data blobs --- .../google_sign_in/lib/widgets.dart | 47 ++----------------- .../google_sign_in/test/widgets_test.dart | 47 ++----------------- 2 files changed, 8 insertions(+), 86 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index 5cf0aeac9660..d4cef08d1ebf 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -117,48 +117,9 @@ class GoogleUserCircleAvatar extends StatelessWidget { /// This is an transparent 1x1 gif image final Uint8List _transparentImage = Uint8List.fromList( [ - 0x47, - 0x49, - 0x46, - 0x38, - 0x39, - 0x61, - 0x01, - 0x00, - 0x01, - 0x00, - 0x80, - 0x00, - 0x00, - 0xFF, - 0xFF, - 0xFF, - 0x00, - 0x00, - 0x00, - 0x21, - 0xF9, - 0x04, - 0x01, - 0x00, - 0x00, - 0x00, - 0x00, - 0x2C, - 0x00, - 0x00, - 0x00, - 0x00, - 0x01, - 0x00, - 0x01, - 0x00, - 0x00, - 0x02, - 0x02, - 0x44, - 0x01, - 0x00, - 0x3B, + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // + 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, 0x01, 0x00, // + 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // + 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3B ], ); diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 77fe891814eb..88bab3c48a7c 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -52,49 +52,10 @@ class _MockHttpRequest extends Fake implements HttpClientRequest { /// This is an transparent 1x1 gif image final Uint8List _transparentImage = Uint8List.fromList( [ - 0x47, - 0x49, - 0x46, - 0x38, - 0x39, - 0x61, - 0x01, - 0x00, - 0x01, - 0x00, - 0x80, - 0x00, - 0x00, - 0xFF, - 0xFF, - 0xFF, - 0x00, - 0x00, - 0x00, - 0x21, - 0xF9, - 0x04, - 0x01, - 0x00, - 0x00, - 0x00, - 0x00, - 0x2C, - 0x00, - 0x00, - 0x00, - 0x00, - 0x01, - 0x00, - 0x01, - 0x00, - 0x00, - 0x02, - 0x02, - 0x44, - 0x01, - 0x00, - 0x3B, + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // + 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, 0x01, 0x00, // + 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // + 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3B // ], ); From 03c48da555ff873b84a64a0ff8ce86d214389ae4 Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 28 Oct 2021 20:29:29 +0800 Subject: [PATCH 11/16] :bulb: Improve comment of _transparentImage --- packages/google_sign_in/google_sign_in/lib/widgets.dart | 2 +- .../google_sign_in/google_sign_in/test/widgets_test.dart | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index d4cef08d1ebf..24938a465abf 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -114,7 +114,7 @@ class GoogleUserCircleAvatar extends StatelessWidget { } } -/// This is an transparent 1x1 gif image +/// This is an transparent 1x1 gif image. final Uint8List _transparentImage = Uint8List.fromList( [ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 88bab3c48a7c..21a0926f8a68 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -49,7 +49,10 @@ class _MockHttpRequest extends Fake implements HttpClientRequest { } } -/// This is an transparent 1x1 gif image +/// Arbitrary valid image returned by the [_MockHttpResponse]. +/// +/// This is an transparent 1x1 gif image. +/// It doesn't have to match the placeholder used in [GoogleUserCircleAvatar] final Uint8List _transparentImage = Uint8List.fromList( [ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // @@ -60,7 +63,7 @@ final Uint8List _transparentImage = Uint8List.fromList( ); /// A mocked [HttpClientResponse] which is empty and has a [statusCode] of 200 -/// and returns a 1x1 transparent image. +/// and returns valid image. class _MockHttpResponse extends Fake implements HttpClientResponse { final Stream _delegate = Stream.value(_transparentImage); From bf0f524ff4b92aa6df3cf3ef44100ad70e098267 Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 28 Oct 2021 20:29:53 +0800 Subject: [PATCH 12/16] :pencil2: Fix typo in test description --- packages/google_sign_in/google_sign_in/test/widgets_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 21a0926f8a68..2f17c0140fd1 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -88,7 +88,7 @@ class _MockHttpResponse extends Fake implements HttpClientResponse { } void main() { - testWidgets('It should build th GoogleUserCircleAvatar successfully', + testWidgets('It should build the GoogleUserCircleAvatar successfully', (WidgetTester tester) async { final GoogleIdentity identity = _TestGoogleIdentity( email: 'email@email.com', From 1d2638af1732baeb8b65fecff455785e97344ad1 Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Thu, 28 Oct 2021 20:33:08 +0800 Subject: [PATCH 13/16] :bulb: Add another forgotten "." --- packages/google_sign_in/google_sign_in/test/widgets_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 2f17c0140fd1..2abc0ee1c094 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -52,7 +52,7 @@ class _MockHttpRequest extends Fake implements HttpClientRequest { /// Arbitrary valid image returned by the [_MockHttpResponse]. /// /// This is an transparent 1x1 gif image. -/// It doesn't have to match the placeholder used in [GoogleUserCircleAvatar] +/// It doesn't have to match the placeholder used in [GoogleUserCircleAvatar]. final Uint8List _transparentImage = Uint8List.fromList( [ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // From 4d170907b8e1228ffc945d831680b5d63425d224 Mon Sep 17 00:00:00 2001 From: ValentinVignal Date: Sat, 30 Oct 2021 00:46:20 +0800 Subject: [PATCH 14/16] :bento: Add resources/transparentImage.gif --- .../google_sign_in/google_sign_in/lib/widgets.dart | 6 ++++-- .../google_sign_in/resources/README.md | 7 +++++++ .../google_sign_in/resources/transparentImage.gif | Bin 0 -> 42 bytes .../google_sign_in/test/widgets_test.dart | 6 ++++-- 4 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 packages/google_sign_in/google_sign_in/resources/README.md create mode 100644 packages/google_sign_in/google_sign_in/resources/transparentImage.gif diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index 24938a465abf..5753936f2eb6 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -115,11 +115,13 @@ class GoogleUserCircleAvatar extends StatelessWidget { } /// This is an transparent 1x1 gif image. +/// +/// Those bytes come from `resources/transparentImage.dart`. final Uint8List _transparentImage = Uint8List.fromList( [ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // - 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, 0x01, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x21, 0xf9, 0x04, 0x01, 0x00, // 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // - 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3B + 0x00, 0x02, 0x01, 0x44, 0x00, 0x3B ], ); diff --git a/packages/google_sign_in/google_sign_in/resources/README.md b/packages/google_sign_in/google_sign_in/resources/README.md new file mode 100644 index 000000000000..b3f0383a6695 --- /dev/null +++ b/packages/google_sign_in/google_sign_in/resources/README.md @@ -0,0 +1,7 @@ +`transparentImage.gif` is a 1x1 transparent gif which comes from [this wikimedia page](https://commons.wikimedia.org/wiki/File:Transparent.gif): + +![](transparentImage.gif) + +This is the image used a placeholder for the `GoogleCircleAvatar` widget. + +The variable `_transparentImage` in `lib/widgets.dart` is the list of bytes of `transparentImage.gif`. \ No newline at end of file diff --git a/packages/google_sign_in/google_sign_in/resources/transparentImage.gif b/packages/google_sign_in/google_sign_in/resources/transparentImage.gif new file mode 100644 index 0000000000000000000000000000000000000000..f191b280ce91e6cb8c387735c10ef9bc5da6c83b GIT binary patch literal 42 ocmZ?wbhEHbWMp7uXkY+=|Ns9h{$ybUF?B!$NQQxl(S^Yp0J!f4_W%F@ literal 0 HcmV?d00001 diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 2abc0ee1c094..569ae3d3b8a5 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -53,12 +53,14 @@ class _MockHttpRequest extends Fake implements HttpClientRequest { /// /// This is an transparent 1x1 gif image. /// It doesn't have to match the placeholder used in [GoogleUserCircleAvatar]. +/// +/// Those bytes come from `resources/transparentImage.dart`. final Uint8List _transparentImage = Uint8List.fromList( [ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // - 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04, 0x01, 0x00, // + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x21, 0xf9, 0x04, 0x01, 0x00, // 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // - 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3B // + 0x00, 0x02, 0x01, 0x44, 0x00, 0x3B ], ); From 6c69b63068e228b7a0eed2ab4d9a5020f3ac5503 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Fri, 29 Oct 2021 10:18:08 -0700 Subject: [PATCH 15/16] Fix comment --- packages/google_sign_in/google_sign_in/lib/widgets.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/lib/widgets.dart b/packages/google_sign_in/google_sign_in/lib/widgets.dart index 5753936f2eb6..c031cb2b6eca 100644 --- a/packages/google_sign_in/google_sign_in/lib/widgets.dart +++ b/packages/google_sign_in/google_sign_in/lib/widgets.dart @@ -116,7 +116,7 @@ class GoogleUserCircleAvatar extends StatelessWidget { /// This is an transparent 1x1 gif image. /// -/// Those bytes come from `resources/transparentImage.dart`. +/// Those bytes come from `resources/transparentImage.gif`. final Uint8List _transparentImage = Uint8List.fromList( [ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, // From 3291d1b5cf0e988a2b270d939969fb597569e17e Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Fri, 29 Oct 2021 10:18:41 -0700 Subject: [PATCH 16/16] Fix comment --- packages/google_sign_in/google_sign_in/test/widgets_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_sign_in/google_sign_in/test/widgets_test.dart b/packages/google_sign_in/google_sign_in/test/widgets_test.dart index 569ae3d3b8a5..f7bd6f803e7c 100644 --- a/packages/google_sign_in/google_sign_in/test/widgets_test.dart +++ b/packages/google_sign_in/google_sign_in/test/widgets_test.dart @@ -54,7 +54,7 @@ class _MockHttpRequest extends Fake implements HttpClientRequest { /// This is an transparent 1x1 gif image. /// It doesn't have to match the placeholder used in [GoogleUserCircleAvatar]. /// -/// Those bytes come from `resources/transparentImage.dart`. +/// Those bytes come from `resources/transparentImage.gif`. final Uint8List _transparentImage = Uint8List.fromList( [ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, //