@@ -40,8 +40,8 @@ class FlutterFlipApp extends StatelessWidget {
40
40
onGenerateRoute: (settings) {
41
41
return PageRouteBuilder <dynamic >(
42
42
settings: settings,
43
- pageBuilder: (context, animation, secondaryAnimation) =>
44
- const GameScreen (),
43
+ pageBuilder:
44
+ (context, animation, secondaryAnimation) => const GameScreen (),
45
45
);
46
46
},
47
47
);
@@ -145,14 +145,16 @@ class GameScreenState extends State<GameScreen> {
145
145
146
146
Widget _buildScoreBox (PieceType player, GameModel model) {
147
147
var label = player == PieceType .black ? 'black' : 'white' ;
148
- var scoreText = player == PieceType .black
149
- ? '${model .blackScore }'
150
- : '${model .whiteScore }' ;
148
+ var scoreText =
149
+ player == PieceType .black
150
+ ? '${model .blackScore }'
151
+ : '${model .whiteScore }' ;
151
152
152
153
return DecoratedBox (
153
- decoration: (model.player == player)
154
- ? Styling .activePlayerIndicator
155
- : Styling .inactivePlayerIndicator,
154
+ decoration:
155
+ (model.player == player)
156
+ ? Styling .activePlayerIndicator
157
+ : Styling .inactivePlayerIndicator,
156
158
child: Column (
157
159
children: < Widget > [
158
160
Text (
@@ -164,7 +166,7 @@ class GameScreenState extends State<GameScreen> {
164
166
scoreText,
165
167
textAlign: TextAlign .center,
166
168
style: Styling .scoreText,
167
- )
169
+ ),
168
170
],
169
171
),
170
172
);
@@ -177,32 +179,34 @@ class GameScreenState extends State<GameScreen> {
177
179
final spots = < Widget > [];
178
180
179
181
for (var x = 0 ; x < GameBoard .width; x++ ) {
180
- spots.add (AnimatedContainer (
181
- duration : const Duration (
182
- milliseconds: 500 ,
183
- ),
184
- margin : const EdgeInsets . all ( 1.0 ),
185
- decoration : BoxDecoration (
186
- gradient :
187
- Styling .pieceGradients[model.board. getPieceAtLocation (x, y)] ,
188
- ),
189
- child : SizedBox (
190
- width : 40.0 ,
191
- height : 40.0 ,
192
- child : GestureDetector (
193
- onTap : () {
194
- _attemptUserMove (model, x, y);
195
- } ,
182
+ spots.add (
183
+ AnimatedContainer (
184
+ duration : const Duration ( milliseconds: 500 ) ,
185
+ margin : const EdgeInsets . all ( 1.0 ),
186
+ decoration : BoxDecoration (
187
+ gradient :
188
+ Styling .pieceGradients[model.board. getPieceAtLocation (x, y)],
189
+ ) ,
190
+ child : SizedBox (
191
+ width : 40.0 ,
192
+ height : 40.0 ,
193
+ child : GestureDetector (
194
+ onTap : () {
195
+ _attemptUserMove (model, x, y);
196
+ },
197
+ ) ,
196
198
),
197
199
),
198
- )) ;
200
+ );
199
201
}
200
202
201
- rows.add (Row (
202
- mainAxisSize: MainAxisSize .min,
203
- mainAxisAlignment: MainAxisAlignment .center,
204
- children: spots,
205
- ));
203
+ rows.add (
204
+ Row (
205
+ mainAxisSize: MainAxisSize .min,
206
+ mainAxisAlignment: MainAxisAlignment .center,
207
+ children: spots,
208
+ ),
209
+ );
206
210
}
207
211
208
212
return rows;
@@ -214,16 +218,11 @@ class GameScreenState extends State<GameScreen> {
214
218
child: Column (
215
219
mainAxisSize: MainAxisSize .min,
216
220
children: [
217
- Text (
218
- model.gameResultString,
219
- style: Styling .resultText,
220
- ),
221
+ Text (model.gameResultString, style: Styling .resultText),
221
222
const SizedBox (height: 30 ),
222
223
GestureDetector (
223
224
onTap: () {
224
- _restartController.add (
225
- GameModel (board: GameBoard ()),
226
- );
225
+ _restartController.add (GameModel (board: GameBoard ()));
227
226
},
228
227
child: Container (
229
228
decoration: BoxDecoration (
@@ -232,10 +231,7 @@ class GameScreenState extends State<GameScreen> {
232
231
),
233
232
child: const Padding (
234
233
padding: EdgeInsets .fromLTRB (15 , 5 , 15 , 9 ),
235
- child: Text (
236
- 'new game' ,
237
- style: Styling .buttonText,
238
- ),
234
+ child: Text ('new game' , style: Styling .buttonText),
239
235
),
240
236
),
241
237
),
@@ -252,10 +248,7 @@ class GameScreenState extends State<GameScreen> {
252
248
gradient: LinearGradient (
253
249
begin: Alignment .topLeft,
254
250
end: Alignment .bottomRight,
255
- colors: [
256
- Styling .backgroundStartColor,
257
- Styling .backgroundFinishColor,
258
- ],
251
+ colors: [Styling .backgroundStartColor, Styling .backgroundFinishColor],
259
252
),
260
253
),
261
254
child: SafeArea (
0 commit comments