Commit 902391b0 authored by Ian Hickson's avatar Ian Hickson

Realign the slow mode banner to not overflow.

parent a05909e3
...@@ -22,7 +22,6 @@ class BannerPainter extends CustomPainter { ...@@ -22,7 +22,6 @@ class BannerPainter extends CustomPainter {
static const double kOffset = 40.0; // distance to bottom of banner, at a 45 degree angle inwards static const double kOffset = 40.0; // distance to bottom of banner, at a 45 degree angle inwards
static const double kHeight = 12.0; // height of banner static const double kHeight = 12.0; // height of banner
static const double kBottomOffset = kOffset + 0.707 * kHeight; // offset plus sqrt(2)/2 * banner height static const double kBottomOffset = kOffset + 0.707 * kHeight; // offset plus sqrt(2)/2 * banner height
static const Offset kTextAlign = const Offset(0.0, -3.0); // offset to move text up
static const double kFontSize = kHeight * 0.85; static const double kFontSize = kHeight * 0.85;
static const double kShadowBlur = 4.0; // shadow blur sigma static const double kShadowBlur = 4.0; // shadow blur sigma
static final Rect kRect = new Rect.fromLTWH(-kOffset, kOffset - kHeight, kOffset * 2.0, kHeight); static final Rect kRect = new Rect.fromLTWH(-kOffset, kOffset - kHeight, kOffset * 2.0, kHeight);
...@@ -30,7 +29,8 @@ class BannerPainter extends CustomPainter { ...@@ -30,7 +29,8 @@ class BannerPainter extends CustomPainter {
color: const Color(0xFFFFFFFF), color: const Color(0xFFFFFFFF),
fontSize: kFontSize, fontSize: kFontSize,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
textAlign: TextAlign.center textAlign: TextAlign.center,
height: 1.0
); );
@override @override
...@@ -49,10 +49,9 @@ class BannerPainter extends CustomPainter { ...@@ -49,10 +49,9 @@ class BannerPainter extends CustomPainter {
final TextPainter textPainter = new TextPainter() final TextPainter textPainter = new TextPainter()
..text = new TextSpan(style: kTextStyles, text: message) ..text = new TextSpan(style: kTextStyles, text: message)
..maxWidth = kOffset * 2.0 ..maxWidth = kOffset * 2.0
..maxHeight = kHeight
..layout(); ..layout();
textPainter.paint(canvas, kRect.topLeft.toOffset() + kTextAlign); textPainter.paint(canvas, kRect.topLeft.toOffset() + new Offset(0.0, (kRect.height - textPainter.height) / 2.0));
} }
@override @override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment