Rename WebImage to OptionalImage to avoid name conflict (#4040)
Renames `WebImage` to `OptionalImage` to avoid naming conflicts with the upcoming `WebImage` widget in the Flutter Framework.
This fixes the "customer_tests" suite in the WebImage PR in the framework: https://github.com/flutter/flutter/pull/157755
diff --git a/dashboard/lib/widgets/commit_author_avatar.dart b/dashboard/lib/widgets/commit_author_avatar.dart
index 08bab74..4522508 100644
--- a/dashboard/lib/widgets/commit_author_avatar.dart
+++ b/dashboard/lib/widgets/commit_author_avatar.dart
@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
import '../model/commit.pb.dart';
-import 'web_image.dart';
+import 'optional_image.dart';
/// Shows the appropriate avatar for a [Commit]'s author.
///
@@ -45,7 +45,7 @@
),
);
- return WebImage(
+ return OptionalImage(
imageUrl: commit!.authorAvatarUrl,
placeholder: avatar,
);
diff --git a/dashboard/lib/widgets/web_image.dart b/dashboard/lib/widgets/optional_image.dart
similarity index 96%
rename from dashboard/lib/widgets/web_image.dart
rename to dashboard/lib/widgets/optional_image.dart
index ab90092..bed4f12 100644
--- a/dashboard/lib/widgets/web_image.dart
+++ b/dashboard/lib/widgets/optional_image.dart
@@ -11,8 +11,8 @@
///
/// This bypasses network image provider when testing to not surface the
/// HTTP errors in tests by default.
-class WebImage extends StatelessWidget {
- const WebImage({
+class OptionalImage extends StatelessWidget {
+ const OptionalImage({
super.key,
bool? enabled,
this.imageUrl,
diff --git a/dashboard/test/widgets/optional_image_test.dart b/dashboard/test/widgets/optional_image_test.dart
new file mode 100644
index 0000000..b4f275f
--- /dev/null
+++ b/dashboard/test/widgets/optional_image_test.dart
@@ -0,0 +1,24 @@
+// Copyright 2019 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 'package:flutter_dashboard/widgets/optional_image.dart';
+
+import 'package:flutter_test/flutter_test.dart';
+
+void main() {
+ testWidgets('OptionalImage.enabled', (WidgetTester tester) async {
+ expect(
+ const OptionalImage(imageUrl: 'url').enabled,
+ isFalse,
+ ); // because this is a test
+ expect(
+ const OptionalImage(imageUrl: 'url', enabled: false).enabled,
+ isFalse,
+ );
+ expect(
+ const OptionalImage(imageUrl: 'url', enabled: true).enabled,
+ isTrue,
+ );
+ });
+}
diff --git a/dashboard/test/widgets/web_image_test.dart b/dashboard/test/widgets/web_image_test.dart
deleted file mode 100644
index e584f1f..0000000
--- a/dashboard/test/widgets/web_image_test.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2019 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 'package:flutter_dashboard/widgets/web_image.dart';
-
-import 'package:flutter_test/flutter_test.dart';
-
-void main() {
- testWidgets('WebImage.enabled', (WidgetTester tester) async {
- expect(const WebImage(imageUrl: 'url').enabled, isFalse); // because this is a test
- expect(const WebImage(imageUrl: 'url', enabled: false).enabled, isFalse);
- expect(const WebImage(imageUrl: 'url', enabled: true).enabled, isTrue);
- });
-}