Skip to content

Commit

Permalink
YaruBanner: remove fallback icon / safe network image (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed Sep 25, 2022
1 parent 91d3cc6 commit eae5a4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 28 deletions.
2 changes: 0 additions & 2 deletions example/lib/pages/banner_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:yaru_icons/yaru_icons.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

class BannerPage extends StatelessWidget {
Expand All @@ -22,7 +21,6 @@ class BannerPage extends StatelessWidget {
YaruBanner(
name: 'YaruBanner $i',
summary: 'Description',
fallbackIconData: YaruIcons.ubuntu_logo_large,
icon: Image.asset('assets/ubuntuhero.jpg'),
onTap: () => showAboutDialog(context: context),
)
Expand Down
1 change: 0 additions & 1 deletion example/lib/pages/tabbed_page_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class _TabbedPagePageState extends State<TabbedPagePage> {
YaruBanner(
name: 'YaruBanner $i',
summary: 'Description',
fallbackIconData: YaruIcons.ubuntu_logo_large,
icon: Image.asset('assets/ubuntuhero.jpg'),
onTap: () => showAboutDialog(context: context),
)
Expand Down
30 changes: 5 additions & 25 deletions lib/src/utilities/yaru_banner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class YaruBanner extends StatelessWidget {
this.watermark = false,
required this.name,
this.summary,
this.url,
this.icon,
required this.fallbackIconData,
required this.icon,
this.nameTextOverflow,
this.summaryTextOverflow,
this.bannerWidth,
Expand All @@ -27,9 +25,6 @@ class YaruBanner extends StatelessWidget {
/// A summary string shown in the second line.
final String? summary;

/// The url to include a [YaruSafeImage].
final String? url;

/// An optional callback
final Function()? onTap;

Expand All @@ -41,10 +36,7 @@ class YaruBanner extends StatelessWidget {
final bool watermark;

/// The [Widget] used as the trailing icon.
final Widget? icon;

/// If the icon is not loaded this fallback icon is displayed.
final IconData fallbackIconData;
final Widget icon;

final TextOverflow? nameTextOverflow;

Expand Down Expand Up @@ -76,11 +68,7 @@ class YaruBanner extends StatelessWidget {
title: name,
summary: summary,
elevation: light ? 4 : 6,
icon: icon ??
YaruSafeImage(
url: url,
fallBackIconData: fallbackIconData,
),
icon: icon,
titleTextOverflow:
nameTextOverflow ?? TextOverflow.ellipsis,
subTitleTextOverflow:
Expand All @@ -97,10 +85,7 @@ class YaruBanner extends StatelessWidget {
opacity: 0.1,
child: SizedBox(
height: 130,
child: YaruSafeImage(
url: url,
fallBackIconData: fallbackIconData,
),
child: icon,
),
),
),
Expand All @@ -115,12 +100,7 @@ class YaruBanner extends StatelessWidget {
? Theme.of(context).colorScheme.background
: Theme.of(context).colorScheme.onSurface.withOpacity(0.01),
elevation: light ? 2 : 1,
icon: icon ??
YaruSafeImage(
url: url,
fallBackIconData: fallbackIconData,
iconSize: 50,
),
icon: icon,
title: name,
summary: summary,
titleTextOverflow: nameTextOverflow ?? TextOverflow.ellipsis,
Expand Down

0 comments on commit eae5a4d

Please sign in to comment.