Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 1e5ae6e

Browse files
committed
[Code Format] stepper
1 parent 5eff8a0 commit 1e5ae6e

File tree

1 file changed

+32
-34
lines changed

1 file changed

+32
-34
lines changed

Runtime/material/stepper.cs

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,28 @@ public override State createState() {
8181
}
8282
}
8383

84-
public class _StepperState : TickerProviderStateMixin<Stepper> {
85-
readonly TextStyle _kStepStyleLight = new TextStyle(
84+
class _StepperState : TickerProviderStateMixin<Stepper> {
85+
static readonly TextStyle _kStepStyleLight = new TextStyle(
8686
fontSize: 12.0f,
8787
color: Colors.white
8888
);
8989

90-
readonly TextStyle _kStepStyleDark = new TextStyle(
90+
static readonly TextStyle _kStepStyleDark = new TextStyle(
9191
fontSize: 12.0f,
9292
color: Colors.black87
9393
);
9494

95-
readonly Color _kErrorLight = Colors.red;
96-
readonly Color _kErrorDark = Colors.red.shade400;
97-
readonly Color _kCircleActiveLight = Colors.white;
98-
readonly Color _kCircleActiveDark = Colors.black87;
99-
readonly Color _kDisabledLight = Colors.black38;
100-
readonly Color _kDisabledDark = Colors.white30;
101-
readonly float _kStepSize = 24.0f;
102-
readonly float _kTriangleHeight = 24.0f * 0.866025f;
95+
static readonly Color _kErrorLight = Colors.red;
96+
static readonly Color _kErrorDark = Colors.red.shade400;
97+
static readonly Color _kCircleActiveLight = Colors.white;
98+
static readonly Color _kCircleActiveDark = Colors.black87;
99+
static readonly Color _kDisabledLight = Colors.black38;
100+
static readonly Color _kDisabledDark = Colors.white30;
101+
static readonly float _kStepSize = 24.0f;
102+
static readonly float _kTriangleHeight = 24.0f * 0.866025f;
103103

104104
List<GlobalKey> _keys;
105-
public Dictionary<int, StepState> _oldStates = new Dictionary<int, StepState>();
106-
105+
Dictionary<int, StepState> _oldStates = new Dictionary<int, StepState>();
107106

108107
public override void initState() {
109108
base.initState();
@@ -157,24 +156,24 @@ Widget _buildCircleChild(int index, bool oldState) {
157156
case StepState.disabled:
158157
return new Text(
159158
(index + 1).ToString(),
160-
style: isDarkActive ? this._kStepStyleDark : this._kStepStyleLight
159+
style: isDarkActive ? _kStepStyleDark : _kStepStyleLight
161160
);
162161
case StepState.editing:
163162
return new Icon(
164163
Icons.edit,
165-
color: isDarkActive ? this._kCircleActiveDark : this._kCircleActiveLight,
164+
color: isDarkActive ? _kCircleActiveDark : _kCircleActiveLight,
166165
size: 18.0f
167166
);
168167
case StepState.complete:
169168
return new Icon(
170169
Icons.check,
171-
color: isDarkActive ? this._kCircleActiveDark : this._kCircleActiveLight,
170+
color: isDarkActive ? _kCircleActiveDark : _kCircleActiveLight,
172171
size: 18.0f
173172
);
174173
case StepState.error:
175174
return new Text(
176175
"!",
177-
style: this._kStepStyleLight
176+
style: _kStepStyleLight
178177
);
179178
}
180179

@@ -194,8 +193,8 @@ Color _circleColor(int index) {
194193
Widget _buildCircle(int index, bool oldState) {
195194
return new Container(
196195
margin: EdgeInsets.symmetric(vertical: 8.0f),
197-
width: this._kStepSize,
198-
height: this._kStepSize,
196+
width: _kStepSize,
197+
height: _kStepSize,
199198
child: new AnimatedContainer(
200199
curve: Curves.fastOutSlowIn,
201200
duration: ThemeUtils.kThemeAnimationDuration,
@@ -215,15 +214,15 @@ Widget _buildCircle(int index, bool oldState) {
215214
Widget _buildTriangle(int index, bool oldState) {
216215
return new Container(
217216
margin: EdgeInsets.symmetric(vertical: 8.0f),
218-
width: this._kStepSize,
219-
height: this._kStepSize,
217+
width: _kStepSize,
218+
height: _kStepSize,
220219
child: new Center(
221220
child: new SizedBox(
222-
width: this._kStepSize,
223-
height: this._kTriangleHeight,
221+
width: _kStepSize,
222+
height: _kTriangleHeight,
224223
child: new CustomPaint(
225224
painter: new _TrianglePainter(
226-
color: this._isDark() ? this._kErrorDark : this._kErrorLight),
225+
color: this._isDark() ? _kErrorDark : _kErrorLight),
227226
child: new Align(
228227
alignment: new Alignment(0.0f, 0.8f),
229228
child: this._buildCircleChild(index,
@@ -298,7 +297,7 @@ Widget _buildVerticalControls() {
298297
child: new Text(localizations.continueButtonLabel)
299298
),
300299
new Container(
301-
margin: EdgeInsets.only(8.0f), // EdgeInsetsDirection
300+
margin: EdgeInsets.only(8.0f),
302301
child: new FlatButton(
303302
onPressed: this.widget.onStepCancel,
304303
textColor: cancelColor,
@@ -323,11 +322,11 @@ TextStyle _titleStyle(int index) {
323322
return textTheme.body2;
324323
case StepState.disabled:
325324
return textTheme.body2.copyWith(
326-
color: this._isDark() ? this._kDisabledDark : this._kDisabledLight
325+
color: this._isDark() ? _kDisabledDark : _kDisabledLight
327326
);
328327
case StepState.error:
329328
return textTheme.body2.copyWith(
330-
color: this._isDark() ? this._kErrorDark : this._kErrorLight
329+
color: this._isDark() ? _kErrorDark : _kErrorLight
331330
);
332331
}
333332

@@ -345,11 +344,11 @@ TextStyle _subTitleStyle(int index) {
345344
return textTheme.caption;
346345
case StepState.disabled:
347346
return textTheme.caption.copyWith(
348-
color: this._isDark() ? this._kDisabledDark : this._kDisabledLight
347+
color: this._isDark() ? _kDisabledDark : _kDisabledLight
349348
);
350349
case StepState.error:
351350
return textTheme.caption.copyWith(
352-
color: this._isDark() ? this._kErrorDark : this._kErrorLight
351+
color: this._isDark() ? _kErrorDark : _kErrorLight
353352
);
354353
}
355354

@@ -400,7 +399,7 @@ Widget _buildVerticalHeader(int index) {
400399
}
401400
),
402401
new Container(
403-
margin: EdgeInsets.only(12.0f), // EdgeInsetsDirectional
402+
margin: EdgeInsets.only(12.0f),
404403
child: this._buildheaderText(index)
405404
)
406405
}
@@ -411,7 +410,7 @@ Widget _buildVerticalHeader(int index) {
411410
Widget _buildVerticalBody(int index) {
412411
return new Stack(
413412
children: new List<Widget> {
414-
new Positioned( // PositionedDirectional
413+
new Positioned(
415414
left: 24.0f,
416415
top: 0.0f,
417416
bottom: 0.0f,
@@ -510,7 +509,7 @@ Widget _buildHorizontal() {
510509
child: new Center(child: this._buildIcon(_i))
511510
),
512511
new Container(
513-
margin: EdgeInsets.only(left: 12.0f), // EdgeinsetsDirectional
512+
margin: EdgeInsets.only(left: 12.0f),
514513
child: this._buildheaderText(_i)
515514
)
516515
}
@@ -578,8 +577,7 @@ public override Widget build(BuildContext context) {
578577
return this._buildHorizontal();
579578
}
580579

581-
582-
return new Text("Build Failed");
580+
return null;
583581
}
584582
}
585583

0 commit comments

Comments
 (0)