Move sync UI packages to material_ui
Some checks failed
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
sync_settings_ui tests / test (push) Waiting to run
github_device_auth tests / test (push) Has been cancelled

Flutter 3.50 deprecates package:flutter/material.dart. An app on
material_ui gives flutter/material widgets no MaterialLocalizations,
so sync_settings_ui 0.8.0 and github_device_auth 0.5.0 move first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-12 09:03:03 +01:00
parent eb9bdc5796
commit 0ef5461805
20 changed files with 223 additions and 220 deletions

View File

@ -13,7 +13,7 @@ const githubTokenUrl = 'https://github.com/login/oauth/access_token';
/// types on github.com and the URL to type it into.
class DeviceCodeResponse {
/// Creates a [DeviceCodeResponse] from its stored fields.
const DeviceCodeResponse({
const new({
required this.deviceCode,
required this.userCode,
required this.verificationUri,
@ -22,7 +22,7 @@ class DeviceCodeResponse {
});
/// Builds a [DeviceCodeResponse] from GitHub's device-code JSON response.
factory DeviceCodeResponse.fromJson(Map<String, dynamic> json) {
factory fromJson(Map<String, dynamic> json) {
return DeviceCodeResponse(
deviceCode: json['device_code'] as String,
userCode: json['user_code'] as String,
@ -51,7 +51,7 @@ class DeviceCodeResponse {
/// Raised when the device-flow authorization fails or is declined.
class DeviceAuthException implements Exception {
/// Creates a [DeviceAuthException] from GitHub's [code] and [message].
DeviceAuthException(this.code, this.message);
new(this.code, this.message);
/// GitHub error code, e.g. `access_denied`, `expired_token`.
final String code;
@ -75,7 +75,7 @@ class DeviceAuthException implements Exception {
/// - POST https://github.com/login/oauth/access_token
class GitHubDeviceAuth {
/// Creates a [GitHubDeviceAuth] for the given OAuth App [clientId].
GitHubDeviceAuth({
new({
required this.clientId,
this.scope = 'repo',
this.deviceCodeUrl = githubDeviceCodeUrl,

View File

@ -4,9 +4,9 @@ library;
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:github_device_auth/src/device_auth.dart';
import 'package:material_ui/material_ui.dart';
import 'package:url_launcher/url_launcher.dart';
/// Dialog shown during the device flow: displays the user code, opens the
@ -14,11 +14,7 @@ import 'package:url_launcher/url_launcher.dart';
/// null if cancelled / failed).
class DeviceCodeDialog extends StatefulWidget {
/// Creates the dialog for a pending device-flow grant.
const DeviceCodeDialog({
required this.device,
required this.auth,
super.key,
});
const new({required this.device, required this.auth, super.key});
/// The pending grant: user code, verification URL, poll interval.
final DeviceCodeResponse device;

View File

@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: clock
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
sha256: e51d50bca3217c9a9fa2b41a30e4a38971133f5f9ec7a3d57bae095007f1d28e
url: "https://pub.dev"
source: hosted
version: "1.1.2"
version: "1.1.3"
collection:
dependency: transitive
description:
@ -41,6 +41,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.19.1"
cupertino_ui:
dependency: transitive
description:
name: cupertino_ui
sha256: "369e39a1c5c030a6212589c3da1809920b1c2cfade7b02aade7695bfa4b88c3a"
url: "https://pub.dev"
source: hosted
version: "1.1.6"
fake_async:
dependency: transitive
description:
@ -54,6 +62,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_localizations:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -80,6 +93,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.2"
intl:
dependency: transitive
description:
name: intl
sha256: "1ca20c894b1717686a2319b8548763d812bc0aabdac580420a44c5178c57a867"
url: "https://pub.dev"
source: hosted
version: "0.20.3"
leak_tracker:
dependency: transitive
description:
@ -104,6 +125,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.2"
listen:
dependency: transitive
description:
name: listen
sha256: "47501a08016a43fcad79252439d723f50f14f88fa7bfd8a177e0a417e5c9e1f2"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
@ -120,6 +149,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.13.0"
material_ui:
dependency: "direct main"
description:
name: material_ui
sha256: "474c135fd46b56ff1d35ca982155e8863d28fbc6464d1192acf4ee53a738680e"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
meta:
dependency: transitive
description:
@ -161,10 +198,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490"
url: "https://pub.dev"
source: hosted
version: "1.12.1"
version: "1.12.2"
stream_channel:
dependency: transitive
description:
@ -193,10 +230,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11"
sha256: "0a10344e901e5b2e63819567951cb6a06673ed6b84f40462188ff5a0c41f371f"
url: "https://pub.dev"
source: hosted
version: "0.7.12"
version: "0.7.14"
typed_data:
dependency: transitive
description:
@ -273,10 +310,10 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: f36f9f3be64c6198714492bb455c11056e33e2f85d9a0b676a48301e44fdcf47
sha256: fa49e1674cb84acb900141714e6c6e1f9ae099827c24d141430ff6819db4e1bc
url: "https://pub.dev"
source: hosted
version: "2.4.2"
version: "2.4.4"
very_good_analysis:
dependency: "direct dev"
description:
@ -303,4 +340,4 @@ packages:
version: "1.1.1"
sdks:
dart: ">=3.13.0 <4.0.0"
flutter: ">=3.44.0"
flutter: ">=3.47.0"

View File

@ -4,15 +4,16 @@ description: >-
modal that drives it. Extracted from four apps that each carried a copy,
two of them byte-identical.
publish_to: 'none'
version: 0.4.0
version: 0.5.0
environment:
sdk: ^3.12.2
sdk: ^3.13.0
dependencies:
flutter:
sdk: flutter
http: 1.6.0
material_ui: 1.11.0
url_launcher: 6.3.3
dev_dependencies:

View File

@ -9,15 +9,13 @@ import 'package:http/testing.dart';
/// exercises `slow_down` does not take 15 real seconds.
Future<void> noDelay(Duration _) async {}
GitHubDeviceAuth authWith(
MockClient client, {
String scope = 'repo',
}) => GitHubDeviceAuth(
clientId: 'cid',
scope: scope,
httpClient: client,
delay: noDelay,
);
GitHubDeviceAuth authWith(MockClient client, {String scope = 'repo'}) =>
GitHubDeviceAuth(
clientId: 'cid',
scope: scope,
httpClient: client,
delay: noDelay,
);
void main() {
group('pollForToken', () {

View File

@ -9,15 +9,13 @@ import 'package:http/testing.dart';
/// exercises `slow_down` does not take 15 real seconds.
Future<void> noDelay(Duration _) async {}
GitHubDeviceAuth authWith(
MockClient client, {
String scope = 'repo',
}) => GitHubDeviceAuth(
clientId: 'cid',
scope: scope,
httpClient: client,
delay: noDelay,
);
GitHubDeviceAuth authWith(MockClient client, {String scope = 'repo'}) =>
GitHubDeviceAuth(
clientId: 'cid',
scope: scope,
httpClient: client,
delay: noDelay,
);
void main() {
group('DeviceCodeResponse.fromJson', () {

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:github_device_auth/github_device_auth.dart';
@ -35,7 +35,8 @@ GitHubDeviceAuth _auth(
/// An auth client that never gets past its first poll delay.
GitHubDeviceAuth _pendingAuth() => _auth(
MockClient(
(_) async => http.Response(jsonEncode({'error': 'authorization_pending'}), 200),
(_) async =>
http.Response(jsonEncode({'error': 'authorization_pending'}), 200),
),
delay: _neverDelay,
);

View File

@ -6,7 +6,7 @@ import 'package:data_transfer_flutter/data_transfer_flutter.dart';
/// claiming success or showing an error.
class BackupCancelled implements Exception {
/// Creates the signal.
const BackupCancelled();
const new();
}
/// An injectable local export/import delegate for [SyncSettingsScreen]'s
@ -22,11 +22,7 @@ class BackupCancelled implements Exception {
class BackupSlot {
/// Creates a [BackupSlot] labelled [label] (e.g. `'notes'`,
/// `'inventory'`), backed by [export] and [import].
const BackupSlot({
required this.label,
required this.export,
required this.import,
});
const new({required this.label, required this.export, required this.import});
/// A slot whose backup is a JSON file, using `data_transfer_flutter`.
///
@ -35,7 +31,7 @@ class BackupSlot {
/// lets the user pick a JSON file and hands the decoded object to
/// [restore]. A dismissed dialog throws [BackupCancelled] (and a cancelled
/// picker restores nothing).
factory BackupSlot.json({
factory json({
required String label,
required String fileName,
required Future<Map<String, Object?>> Function() build,

View File

@ -29,11 +29,7 @@ enum FirebaseConnectOutcome {
/// [FirebaseSyncController.connectWithGoogle] call.
class FirebaseConnectResult {
/// Creates a [FirebaseConnectResult].
const FirebaseConnectResult({
required this.outcome,
this.email,
this.message,
});
const new({required this.outcome, this.email, this.message});
/// What happened.
final FirebaseConnectOutcome outcome;

View File

@ -21,7 +21,7 @@ class FirebaseSyncController {
/// is optional because Google sign-in itself is optional per
/// app/platform (see `googleAvailable` on `SyncSettingsScreen`) --
/// [connectWithGoogle] must not be called when it is null.
FirebaseSyncController({
new({
required this.accountLoader,
required this.accountSaver,
required this.accountClearer,

View File

@ -7,9 +7,9 @@ part of 'sync_settings_screen.dart';
/// A result: a glyph, the old sentence (spoken only), and whether it is a
/// failure. Colour is the second channel: danger hue for failures.
class _Cue {
const _Cue(this.icon, this.spoken) : error = false;
const new(this.icon, this.spoken) : error = false;
const _Cue.error(this.icon, this.spoken) : error = true;
const new error(this.icon, this.spoken) : error = true;
final IconData icon;
final String spoken;
@ -18,7 +18,7 @@ class _Cue {
/// Paints a [_Cue] as a large glyph.
class _CueView extends StatelessWidget {
const _CueView(this.cue);
const new(this.cue);
final _Cue cue;
@ -39,7 +39,7 @@ class _CueView extends StatelessWidget {
/// A section heading as a glyph, spoken as [spoken].
class _Heading extends StatelessWidget {
const _Heading(this.icon, this.spoken);
const new(this.icon, this.spoken);
final IconData icon;
final String spoken;

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'package:crdt_sync/crdt_sync.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';
import 'package:sync_settings_ui/src/backup_slot.dart';
import 'package:sync_settings_ui/src/firebase_connect_result.dart';
import 'package:sync_settings_ui/src/firebase_sync_controller.dart';

View File

@ -6,7 +6,7 @@ part of 'sync_settings_screen.dart';
/// a `part` rather than an import because both sections are
/// library-private and could not be imported at all.
class _FirebaseSection extends StatelessWidget {
const _FirebaseSection({
const new({
required this.connected,
required this.busy,
required this.googleAvailable,
@ -139,7 +139,7 @@ class _FirebaseSection extends StatelessWidget {
}
class _BackupSection extends StatelessWidget {
const _BackupSection({
const new({
required this.backup,
required this.onExport,
required this.onImport,

View File

@ -11,7 +11,7 @@ part of 'sync_settings_screen.dart';
/// reached via a `ListTile` link to this one.
class SyncSettingsScreen extends StatefulWidget {
/// Creates a [SyncSettingsScreen].
const SyncSettingsScreen({
const new({
required this.accountLoader,
required this.accountSaver,
required this.accountClearer,

View File

@ -5,10 +5,10 @@ description: >-
injected closures -- no keystore or platform plugin access lives in this
package itself.
publish_to: 'none'
version: 0.7.1
version: 0.8.0
environment:
sdk: ^3.12.2
sdk: ^3.13.0
dependencies:
crdt_sync:
@ -23,6 +23,7 @@ dependencies:
path: data_transfer_flutter
flutter:
sdk: flutter
material_ui: 1.11.0
dev_dependencies:
flutter_test:

View File

@ -53,28 +53,22 @@ void main() {
expect(result.email, 'g@b.com');
});
test(
'reports signedInButNotPersisted with the stale account email when '
'the client came back non-null but no session actually stuck -- the '
'invariant this package exists to centralize',
() async {
final controller = FirebaseSyncController(
accountLoader: () async =>
const FirebaseAccount(email: 'stale@b.com', password: ''),
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => false,
firebaseFactory: () async => null,
googleFirebaseFactory: () async => _fakeClient(),
);
final result = await controller.connectWithGoogle();
expect(
result.outcome,
FirebaseConnectOutcome.signedInButNotPersisted,
);
expect(result.email, 'stale@b.com');
},
);
test('reports signedInButNotPersisted with the stale account email when '
'the client came back non-null but no session actually stuck -- the '
'invariant this package exists to centralize', () async {
final controller = FirebaseSyncController(
accountLoader: () async =>
const FirebaseAccount(email: 'stale@b.com', password: ''),
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => false,
firebaseFactory: () async => null,
googleFirebaseFactory: () async => _fakeClient(),
);
final result = await controller.connectWithGoogle();
expect(result.outcome, FirebaseConnectOutcome.signedInButNotPersisted);
expect(result.email, 'stale@b.com');
});
test(
'reports wrongAccount with the error message on FirebaseAuthError',

View File

@ -42,22 +42,19 @@ void main() {
},
);
test(
'trusts the session probe over account presence -- a marker with no '
'live session must read as not connected',
() async {
final controller = FirebaseSyncController(
accountLoader: () async =>
const FirebaseAccount(email: 'stale@b.com', password: 'x'),
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => false,
firebaseFactory: () async => null,
);
final status = await controller.loadStatus();
expect(status.connected, isFalse);
},
);
test('trusts the session probe over account presence -- a marker with no '
'live session must read as not connected', () async {
final controller = FirebaseSyncController(
accountLoader: () async =>
const FirebaseAccount(email: 'stale@b.com', password: 'x'),
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => false,
firebaseFactory: () async => null,
);
final status = await controller.loadStatus();
expect(status.connected, isFalse);
});
});
group('connectWithPassword', () {
@ -99,52 +96,46 @@ void main() {
},
);
test(
'clears the account and reports rejected with the error message when '
'firebaseFactory throws FirebaseAuthError -- reproduces the screen '
'getting stuck on "Signing in..." forever, since nothing here used '
'to catch this',
() async {
var cleared = false;
final controller = FirebaseSyncController(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async => cleared = true,
sessionProbe: () async => false,
firebaseFactory: () async => throw FirebaseAuthError('wrong password'),
);
final result = await controller.connectWithPassword(
email: 'a@b.com',
password: 'wrong',
);
expect(result.outcome, FirebaseConnectOutcome.rejected);
expect(result.message, 'wrong password');
expect(cleared, isTrue);
},
);
test('clears the account and reports rejected with the error message when '
'firebaseFactory throws FirebaseAuthError -- reproduces the screen '
'getting stuck on "Signing in..." forever, since nothing here used '
'to catch this', () async {
var cleared = false;
final controller = FirebaseSyncController(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async => cleared = true,
sessionProbe: () async => false,
firebaseFactory: () async => throw FirebaseAuthError('wrong password'),
);
final result = await controller.connectWithPassword(
email: 'a@b.com',
password: 'wrong',
);
expect(result.outcome, FirebaseConnectOutcome.rejected);
expect(result.message, 'wrong password');
expect(cleared, isTrue);
});
test(
'reports failed with the stringified error, and does not clear the '
'account, on any other failure -- a possibly-transient error is not '
'proof the credentials are wrong',
() async {
var cleared = false;
final controller = FirebaseSyncController(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async => cleared = true,
sessionProbe: () async => false,
firebaseFactory: () async => throw StateError('boom'),
);
final result = await controller.connectWithPassword(
email: 'a@b.com',
password: 'pw',
);
expect(result.outcome, FirebaseConnectOutcome.failed);
expect(result.message, contains('boom'));
expect(cleared, isFalse);
},
);
test('reports failed with the stringified error, and does not clear the '
'account, on any other failure -- a possibly-transient error is not '
'proof the credentials are wrong', () async {
var cleared = false;
final controller = FirebaseSyncController(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async => cleared = true,
sessionProbe: () async => false,
firebaseFactory: () async => throw StateError('boom'),
);
final result = await controller.connectWithPassword(
email: 'a@b.com',
password: 'pw',
);
expect(result.outcome, FirebaseConnectOutcome.failed);
expect(result.message, contains('boom'));
expect(cleared, isFalse);
});
test('reports progress stages in order on success', () async {
final stages = <String>[];

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'package:crdt_sync/crdt_sync.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sync_settings_ui/sync_settings_ui.dart';

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'package:crdt_sync/crdt_sync.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sync_settings_ui/sync_settings_ui.dart';
@ -38,7 +38,10 @@ void main() {
await tester.tap(find.bySemanticsLabel('Sign in with Google'));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('Google sign-in was cancelled.'), findsOneWidget);
expect(
find.bySemanticsLabel('Google sign-in was cancelled.'),
findsOneWidget,
);
});
testWidgets(
@ -63,10 +66,7 @@ void main() {
await tester.tap(find.bySemanticsLabel('Sign in with Google'));
await tester.pumpAndSettle();
expect(
spoken('did not save the session'),
findsOneWidget,
);
expect(spoken('did not save the session'), findsOneWidget);
},
);
@ -119,28 +119,25 @@ void main() {
expect(spoken('Sign-in failed'), findsOneWidget);
});
testWidgets(
'hides the Google button when googleAvailable is true but no '
'googleFirebaseFactory is wired -- a visible button that can never '
'succeed must not render',
(tester) async {
await tester.pumpWidget(
_wrap(
SyncSettingsScreen(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => false,
firebaseFactory: () async => null,
googleAvailable: true,
),
testWidgets('hides the Google button when googleAvailable is true but no '
'googleFirebaseFactory is wired -- a visible button that can never '
'succeed must not render', (tester) async {
await tester.pumpWidget(
_wrap(
SyncSettingsScreen(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => false,
firebaseFactory: () async => null,
googleAvailable: true,
),
);
await tester.pumpAndSettle();
),
);
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('Sign in with Google'), findsNothing);
},
);
expect(find.bySemanticsLabel('Sign in with Google'), findsNothing);
});
testWidgets('a reason renders a disabled button that explains itself', (
tester,
@ -162,7 +159,10 @@ void main() {
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('Sign in with Google'), findsOneWidget);
expect(find.bySemanticsLabel('Not available on this platform.'), findsOneWidget);
expect(
find.bySemanticsLabel('Not available on this platform.'),
findsOneWidget,
);
// Disabled, so it cannot report a misleading "cancelled".
final button = tester.widget<FilledButton>(
@ -171,9 +171,7 @@ void main() {
expect(button.onPressed, isNull);
});
testWidgets('no reason keeps the button hidden, as before', (
tester,
) async {
testWidgets('no reason keeps the button hidden, as before', (tester) async {
await tester.pumpWidget(
_wrap(
SyncSettingsScreen(

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'package:crdt_sync/crdt_sync.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sync_settings_ui/sync_settings_ui.dart';
@ -24,10 +24,7 @@ void main() {
// lose the Firebase section from the tree entirely.
setUp(() {
final binding = TestWidgetsFlutterBinding.ensureInitialized();
binding.platformDispatcher.views.first.physicalSize = const Size(
800,
2000,
);
binding.platformDispatcher.views.first.physicalSize = const Size(800, 2000);
binding.platformDispatcher.views.first.devicePixelRatio = 1.0;
addTearDown(binding.platformDispatcher.views.first.resetPhysicalSize);
addTearDown(binding.platformDispatcher.views.first.resetDevicePixelRatio);
@ -163,7 +160,10 @@ void main() {
await tester.tap(find.bySemanticsLabel('Connect Firebase'));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('Firebase rejected that account.'), findsOneWidget);
expect(
find.bySemanticsLabel('Firebase rejected that account.'),
findsOneWidget,
);
});
testWidgets(
@ -178,8 +178,7 @@ void main() {
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => false,
firebaseFactory: () async =>
throw FirebaseAuthError('bad creds'),
firebaseFactory: () async => throw FirebaseAuthError('bad creds'),
),
),
);
@ -208,42 +207,39 @@ void main() {
},
);
testWidgets(
'shows the Google button when googleAvailable, and connecting '
'succeeds',
(tester) async {
var sessionStored = false;
await tester.pumpWidget(
_wrap(
SyncSettingsScreen(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => sessionStored,
firebaseFactory: () async => null,
googleFirebaseFactory: () async {
sessionStored = true;
return _fakeClient();
},
googleAvailable: true,
),
testWidgets('shows the Google button when googleAvailable, and connecting '
'succeeds', (tester) async {
var sessionStored = false;
await tester.pumpWidget(
_wrap(
SyncSettingsScreen(
accountLoader: () async => null,
accountSaver: (_) async {},
accountClearer: () async {},
sessionProbe: () async => sessionStored,
firebaseFactory: () async => null,
googleFirebaseFactory: () async {
sessionStored = true;
return _fakeClient();
},
googleAvailable: true,
),
);
await tester.pumpAndSettle();
),
);
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('Sign in with Google'), findsOneWidget);
// The password form is collapsed behind its ExpansionTile when
// Google is offered -- only the field labels prove that; the tile's
// own title text is present either way.
expect(
find.widgetWithIcon(TextField, Icons.alternate_email),
findsNothing,
);
await tester.tap(find.bySemanticsLabel('Sign in with Google'));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('Sign in with Google'), findsOneWidget);
// The password form is collapsed behind its ExpansionTile when
// Google is offered -- only the field labels prove that; the tile's
// own title text is present either way.
expect(
find.widgetWithIcon(TextField, Icons.alternate_email),
findsNothing,
);
await tester.tap(find.bySemanticsLabel('Sign in with Google'));
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('Connected to Firebase.'), findsOneWidget);
},
);
expect(find.bySemanticsLabel('Connected to Firebase.'), findsOneWidget);
});
});
}