Skip to content

Commit 1d4c4f2

Browse files
reformat the code
1 parent af34d49 commit 1d4c4f2

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

lib/core/widgets/adaptive/padding/end_padding.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ class EndPadding extends StatelessWidget {
66
final Widget child;
77
@override
88
Widget build(BuildContext context) {
9-
return _RPadding(
10-
padding: REdgeInsetsDirectional.only(end: padding), child: child);
9+
return _RPadding(padding: REdgeInsetsDirectional.only(end: padding), child: child);
1110
}
1211
}

lib/core/widgets/custom_widgets/error_screen.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ class ErrorScreen extends StatelessWidget {
1414
padding: 20,
1515
child: foundation.kReleaseMode
1616
? const Center(
17-
child: RegularText(StringsManager.sorryForInconvenience,
18-
fontSize: 18),
17+
child: RegularText(StringsManager.sorryForInconvenience, fontSize: 18),
1918
)
2019
: Center(
21-
child: RegularText('Exception Details: $detailsException',
22-
maxLines: 5),
20+
child: RegularText('Exception Details: $detailsException', maxLines: 5),
2321
),
2422
),
2523
);

lib/features/searching/view_model/grid_notifier.dart

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
138138

139139
await cancelSearching();
140140

141-
_cancelableSearch =
142-
CancelableOperation.fromFuture(_clearTheGridFun(clearAnyway: clearAnyway, keepWall: keepWall));
141+
_cancelableSearch = CancelableOperation.fromFuture(_clearTheGridFun(clearAnyway: clearAnyway, keepWall: keepWall));
143142

144143
try {
145144
await _cancelableSearch?.value;
@@ -174,9 +173,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
174173
/// when you try to draw on the right border if you make the arrow closly to the border it will draw the wall in the left side (the next index)
175174
/// those two lines to prevent that
176175
final calcIndex = (event.localPosition.dx / _gridSquareSize).floor();
177-
if (calcIndex != 0 &&
178-
calcIndex % state.columnCrossAxisCount == 0 &&
179-
index % state.columnCrossAxisCount == 0) {
176+
if (calcIndex != 0 && calcIndex % state.columnCrossAxisCount == 0 && index % state.columnCrossAxisCount == 0) {
180177
index--;
181178
}
182179

@@ -300,8 +297,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
300297
}
301298

302299
/// for marking the current grid as visited
303-
if (gridData[currentIndex] != GridStatus.startPoint &&
304-
gridData[currentIndex] != GridStatus.targetPoint) {
300+
if (gridData[currentIndex] != GridStatus.startPoint && gridData[currentIndex] != GridStatus.targetPoint) {
305301
gridData[currentIndex] = GridStatus.searcher;
306302
state = state.copyWith(gridData: List<GridStatus>.from(gridData));
307303
await Future.delayed(drawSearcherDuration);
@@ -384,8 +380,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
384380
previous[neighborIndex] = currentIndex;
385381
pq.add(neighborIndex);
386382

387-
if (gridData[neighborIndex] != GridStatus.startPoint &&
388-
gridData[neighborIndex] != GridStatus.targetPoint) {
383+
if (gridData[neighborIndex] != GridStatus.startPoint && gridData[neighborIndex] != GridStatus.targetPoint) {
389384
gridData[neighborIndex] = GridStatus.searcher;
390385
state = state.copyWith(gridData: List<GridStatus>.from(gridData));
391386
await Future.delayed(drawSearcherDuration);
@@ -397,17 +392,14 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
397392
_isSearched = true;
398393
}
399394

400-
bool _isValidNeighbor(
401-
int currentIndex, int neighborIndex, int direction, int cross, List<GridStatus> gridData) {
395+
bool _isValidNeighbor(int currentIndex, int neighborIndex, int direction, int cross, List<GridStatus> gridData) {
402396
final isFirstLeftInRowIndex = neighborIndex % cross == 0;
403397
final isEndRightInRowIndex = (neighborIndex + 1) % cross == 0;
404398

405399
if (direction == 1 && isFirstLeftInRowIndex) return false;
406400
if (direction == -1 && isEndRightInRowIndex) return false;
407401

408-
return neighborIndex >= 0 &&
409-
neighborIndex < gridData.length &&
410-
gridData[neighborIndex] != GridStatus.wall;
402+
return neighborIndex >= 0 && neighborIndex < gridData.length && gridData[neighborIndex] != GridStatus.wall;
411403
}
412404

413405
Future<void> _tracePath(List<int?> previous, int currentIndex) async {
@@ -505,8 +497,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
505497
pq.add(neighborIndex);
506498
}
507499

508-
if (gridData[neighborIndex] != GridStatus.startPoint &&
509-
gridData[neighborIndex] != GridStatus.targetPoint) {
500+
if (gridData[neighborIndex] != GridStatus.startPoint && gridData[neighborIndex] != GridStatus.targetPoint) {
510501
gridData[neighborIndex] = GridStatus.searcher;
511502
state = state.copyWith(gridData: List<GridStatus>.from(gridData));
512503
await Future.delayed(drawSearcherDuration);
@@ -614,8 +605,7 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
614605
final newRow = row + direction.rowDelta * 2;
615606
final newCol = col + direction.colDelta * 2;
616607

617-
if (_isValidCell(newRow, newCol) &&
618-
gridData[newRow * state.columnCrossAxisCount + newCol] == GridStatus.empty) {
608+
if (_isValidCell(newRow, newCol) && gridData[newRow * state.columnCrossAxisCount + newCol] == GridStatus.empty) {
619609
final betweenRow = row + direction.rowDelta;
620610
final betweenCol = col + direction.colDelta;
621611

0 commit comments

Comments
 (0)