|
1 | 1 | import 'dart:math';
|
2 | 2 | import 'package:flutter/material.dart';
|
3 | 3 |
|
| 4 | +/// Animation that displays a [text] element, coloring it to look like sloshing |
| 5 | +/// water is filling it up. |
| 6 | +/// |
| 7 | +///  |
4 | 8 | class TextLiquidFill extends StatefulWidget {
|
5 | 9 | /// Gives [TextStyle] to the text string.
|
6 | 10 | ///
|
@@ -68,6 +72,7 @@ class TextLiquidFill extends StatefulWidget {
|
68 | 72 | assert(null != waveColor),
|
69 | 73 | super(key: key);
|
70 | 74 |
|
| 75 | + /// Creates the mutable state for this widget. See [StatefulWidget.createState]. |
71 | 76 | @override
|
72 | 77 | _TextLiquidFillState createState() => _TextLiquidFillState();
|
73 | 78 | }
|
@@ -126,7 +131,7 @@ class _TextLiquidFillState extends State<TextLiquidFill>
|
126 | 131 | animation: _waveController,
|
127 | 132 | builder: (BuildContext context, Widget child) {
|
128 | 133 | return CustomPaint(
|
129 |
| - painter: WavePainter( |
| 134 | + painter: _WavePainter( |
130 | 135 | textKey: _textKey,
|
131 | 136 | waveAnimation: _waveController,
|
132 | 137 | percentValue: _loadValue.value,
|
@@ -164,15 +169,15 @@ class _TextLiquidFillState extends State<TextLiquidFill>
|
164 | 169 | }
|
165 | 170 | }
|
166 | 171 |
|
167 |
| -class WavePainter extends CustomPainter { |
| 172 | +class _WavePainter extends CustomPainter { |
168 | 173 | final _pi2 = 2 * pi;
|
169 | 174 | final GlobalKey textKey;
|
170 | 175 | final Animation<double> waveAnimation;
|
171 | 176 | final double percentValue;
|
172 | 177 | final double boxHeight;
|
173 | 178 | final Color waveColor;
|
174 | 179 |
|
175 |
| - WavePainter({ |
| 180 | + _WavePainter({ |
176 | 181 | @required this.textKey,
|
177 | 182 | this.waveAnimation,
|
178 | 183 | this.percentValue,
|
|
0 commit comments