Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename WebImage to OptionalImage to avoid name conflict #4040

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dashboard/lib/widgets/commit_author_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -45,7 +45,7 @@ class CommitAuthorAvatar extends StatelessWidget {
),
);

return WebImage(
return OptionalImage(
imageUrl: commit!.authorAvatarUrl,
placeholder: avatar,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import 'package:flutter/widgets.dart';
///
/// 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,
Expand Down
24 changes: 24 additions & 0 deletions dashboard/test/widgets/optional_image_test.dart
Original file line number Diff line number Diff line change
@@ -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,
);
});
}
15 changes: 0 additions & 15 deletions dashboard/test/widgets/web_image_test.dart

This file was deleted.