@@ -10,8 +10,9 @@ class EnvelopRefreshIndicator extends StatelessWidget {
1010
1111 static const _circleSize = 70.0 ;
1212
13+ static const _blurRadius = 10.0 ;
1314 static const _defaultShadow = [
14- BoxShadow (blurRadius: 10 , color: Colors .black26)
15+ BoxShadow (blurRadius: _blurRadius , color: Colors .black26)
1516 ];
1617
1718 const EnvelopRefreshIndicator ({
@@ -34,51 +35,59 @@ class EnvelopRefreshIndicator extends StatelessWidget {
3435 final widgetHeight = constraints.maxHeight;
3536 final letterTopWidth = (widgetWidth / 2 ) + 50 ;
3637
37- final leftValue =
38- (widgetWidth - (letterTopWidth * controller.value / 1 ))
39- .clamp (letterTopWidth - 100 , double .infinity);
38+ final leftValue = (widgetWidth +
39+ _blurRadius -
40+ ((letterTopWidth + _blurRadius) * controller.value / 1 ))
41+ .clamp (letterTopWidth - 100 , double .infinity);
4042
41- final rightValue = (widgetWidth - (widgetWidth * controller.value / 1 ))
43+ final rightShift = widgetWidth + _blurRadius;
44+ final rightValue = (rightShift - (rightShift * controller.value / 1 ))
4245 .clamp (0.0 , double .infinity);
4346
4447 final opacity = (controller.value - 1 ).clamp (0 , 0.5 ) / 0.5 ;
48+
49+ final isNotIdle = ! controller.isIdle;
4550 return Stack (
4651 children: < Widget > [
4752 Transform .scale (
4853 scale: 1 - 0.1 * controller.value.clamp (0.0 , 1.0 ),
4954 child: child,
5055 ),
51- Positioned (
52- right: rightValue,
53- child: Container (
54- height: widgetHeight,
55- width: widgetWidth,
56- decoration: const BoxDecoration (
57- color: Colors .white,
58- boxShadow: _defaultShadow,
56+ if (isNotIdle)
57+ Positioned (
58+ right: rightValue,
59+ child: Container (
60+ height: widgetHeight,
61+ width: widgetWidth,
62+ decoration: const BoxDecoration (
63+ color: Colors .white,
64+ boxShadow: _defaultShadow,
65+ ),
5966 ),
6067 ),
61- ),
62- Positioned (
63- left: leftValue,
64- child: CustomPaint (
65- painter: TrianglePainter (
66- strokeColor: Colors .white,
67- paintingStyle: PaintingStyle .fill,
68- ),
69- child: SizedBox (
70- height: widgetHeight,
71- width: letterTopWidth,
68+ if (isNotIdle)
69+ Positioned (
70+ left: leftValue,
71+ child: CustomPaint (
72+ size: Size (
73+ letterTopWidth,
74+ widgetHeight,
75+ ),
76+ painter: TrianglePainter (
77+ strokeColor: Colors .white,
78+ paintingStyle: PaintingStyle .fill,
79+ ),
7280 ),
7381 ),
74- ),
7582 if (controller.value >= 1 )
7683 Container (
7784 padding: const EdgeInsets .only (right: 100 ),
7885 child: Transform .scale (
7986 scale: controller.value,
8087 child: Opacity (
81- opacity: controller.isLoading ? 1 : opacity,
88+ opacity: controller.isLoading || controller.state.isSettling
89+ ? 1
90+ : opacity,
8291 child: Align (
8392 alignment: Alignment .center,
8493 child: Container (
@@ -91,16 +100,13 @@ class EnvelopRefreshIndicator extends StatelessWidget {
91100 shape: BoxShape .circle,
92101 ),
93102 child: Stack (
103+ fit: StackFit .expand,
94104 alignment: Alignment .center,
95105 children: < Widget > [
96- SizedBox (
97- height: double .infinity,
98- width: double .infinity,
99- child: CircularProgressIndicator (
100- valueColor:
101- const AlwaysStoppedAnimation (Colors .black),
102- value: controller.isLoading ? null : 0 ,
103- ),
106+ CircularProgressIndicator (
107+ valueColor:
108+ const AlwaysStoppedAnimation (Colors .black),
109+ value: controller.isLoading ? null : 0 ,
104110 ),
105111 const Icon (
106112 Icons .mail_outline,
0 commit comments