Skip to content
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
1 change: 0 additions & 1 deletion case_study/memory_leaks/images_1/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class MyHomePageState extends State<MyHomePage>
imgUrl,
width: 750.0,
height: 500,
scale: 1.0,
fit: BoxFit.fitWidth,
loadingBuilder: (
BuildContext context,
Expand Down
48 changes: 32 additions & 16 deletions packages/devtools_app/lib/src/flutter/banner_messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ class BannerMessage extends StatelessWidget {
@required this.backgroundColor,
@required this.foregroundColor,
@required this.screenId,
@required this.headerText,
}) : super(key: key);

final List<TextSpan> textSpans;
final Color backgroundColor;
final Color foregroundColor;
final String screenId;
final String headerText;

@override
Widget build(BuildContext context) {
Expand All @@ -139,25 +141,37 @@ class BannerMessage extends StatelessWidget {
margin: const EdgeInsets.only(bottom: denseRowSpacing),
child: Padding(
padding: const EdgeInsets.all(defaultSpacing),
child: Row(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: RichText(
text: TextSpan(
children: textSpans,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
headerText,
style: Theme.of(context)
.textTheme
.headline6
.copyWith(color: foregroundColor),
),
),
),
const SizedBox(width: denseSpacing),
CircularIconButton(
icon: Icons.close,
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
// TODO(kenz): animate the removal of this message.
onPressed: () =>
Provider.of<BannerMessagesController>(context, listen: false)
CircularIconButton(
icon: Icons.close,
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
// TODO(kenz): animate the removal of this message.
onPressed: () => Provider.of<BannerMessagesController>(
context,
listen: false)
.removeMessage(this, dismiss: true),
),
],
),
const SizedBox(height: defaultSpacing),
RichText(
text: TextSpan(
children: textSpans,
),
),
],
),
Expand All @@ -177,6 +191,7 @@ class _BannerError extends BannerMessage {
backgroundColor: devtoolsError,
foregroundColor: foreground,
screenId: screenId,
headerText: 'ERROR',
);

static const foreground = Colors.white;
Expand All @@ -195,6 +210,7 @@ class _BannerWarning extends BannerMessage {
backgroundColor: devtoolsWarning,
foregroundColor: foreground,
screenId: screenId,
headerText: 'WARNING',
);

static const foreground = Colors.black87;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,21 @@ const testMessage1 = BannerMessage(
backgroundColor: Colors.black,
foregroundColor: Colors.white,
screenId: testMessage1ScreenId,
headerText: 'WARNING',
);
const testMessage2 = BannerMessage(
key: k2,
textSpans: [TextSpan(text: 'Test Message 2')],
backgroundColor: Colors.black,
foregroundColor: Colors.white,
screenId: testMessage2ScreenId,
headerText: 'WARNING',
);
const testMessage3 = BannerMessage(
key: k3,
textSpans: [TextSpan(text: 'Test Message 3')],
backgroundColor: Colors.black,
foregroundColor: Colors.white,
screenId: testMessage3ScreenId,
headerText: 'WARNING',
);