Skip to content

Commit

Permalink
YaruBanner: add optional width parameter (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Aug 9, 2022
1 parent 08792e2 commit a7cf97c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/src/yaru_banner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class YaruBanner extends StatelessWidget {
required this.fallbackIconData,
this.nameTextOverflow,
this.summaryTextOverflow,
this.bannerWidth,
}) : super(key: key);

/// The name of the card
Expand Down Expand Up @@ -47,6 +48,9 @@ class YaruBanner extends StatelessWidget {
/// Optional [TextOverflow]
final TextOverflow? summaryTextOverflow;

/// Optional width for the banner - if null it defaults to 370.
final double? bannerWidth;

@override
Widget build(BuildContext context) {
final borderRadius = BorderRadius.circular(10);
Expand All @@ -60,6 +64,7 @@ class YaruBanner extends StatelessWidget {
? Stack(
children: [
_Banner(
width: bannerWidth,
borderRadius: borderRadius,
color: surfaceTintColor!,
title: name,
Expand Down Expand Up @@ -95,6 +100,7 @@ class YaruBanner extends StatelessWidget {
],
)
: _Banner(
width: bannerWidth,
borderRadius: borderRadius,
color: light
? Theme.of(context).backgroundColor
Expand Down Expand Up @@ -129,6 +135,7 @@ class _Banner extends StatelessWidget {
required this.subTitleTextOverflow,
this.mouseCursor,
required this.titleTextOverflow,
this.width,
}) : super(key: key);

final Color color;
Expand All @@ -140,6 +147,7 @@ class _Banner extends StatelessWidget {
final TextOverflow subTitleTextOverflow;
final TextOverflow titleTextOverflow;
final MouseCursor? mouseCursor;
final double? width;

@override
Widget build(BuildContext context) {
Expand All @@ -154,7 +162,7 @@ class _Banner extends StatelessWidget {
child: Align(
alignment: Alignment.centerLeft,
child: SizedBox(
width: 370,
width: width ?? 370,
child: ListTile(
mouseCursor: mouseCursor,
subtitle: summary != null && summary!.isNotEmpty
Expand Down

0 comments on commit a7cf97c

Please sign in to comment.