Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
Carapacik committed Apr 2, 2022
1 parent 7eaeadd commit 853ec44
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 62 deletions.
6 changes: 1 addition & 5 deletions lib/data/collections/level_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ class LevelData {
factory LevelData.init(final int id) {
return LevelData()
..id = id
..lastLevel = 1
..secretWord = "";
..lastLevel = 1;
}

@Id()
late int id;
late int lastLevel;

// хз зачем это тут
late String secretWord;
}
5 changes: 4 additions & 1 deletion lib/data/models/letter_entering.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import 'package:equatable/equatable.dart';
import 'package:wordly/data/models/letter_status.dart';

class LetterEntering extends Equatable {
const LetterEntering({required this.letter, required this.letterStatus});
const LetterEntering({
required this.letter,
required this.letterStatus,
});

final String letter;
final LetterStatus letterStatus;
Expand Down
1 change: 1 addition & 0 deletions lib/data/repositories/dictionary_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ abstract class DictionaryRepository {

String get getEmojiString;

// ignore: avoid_setters_without_getters
set dictionaryLanguage(DictionaryLanguages language);

String createSecretWord([int level = 0]);
Expand Down
1 change: 1 addition & 0 deletions lib/data/repositories/dictionary_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class DictionaryRepositoryImpl implements DictionaryRepository {
int get currentAttempt => _currentWordIndex;

@override
// ignore: avoid_setters_without_getters
set dictionaryLanguage(DictionaryLanguages dictionaryLanguage) =>
_dictionaryLanguage = dictionaryLanguage;

Expand Down
1 change: 1 addition & 0 deletions lib/domain/level_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ abstract class LevelRepository {

bool get isLevelMode;

// ignore: avoid_setters_without_getters
set levelMode(final bool value);

Future<void> initLevelData(final DictionaryLanguages dictionaryLanguage);
Expand Down
4 changes: 2 additions & 2 deletions lib/domain/level_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class LevelRepositoryImpl implements LevelRepository {
bool get isLevelMode => _isLevelMode;

@override
// ignore: avoid_setters_without_getters
set levelMode(final bool value) => _isLevelMode = value;

@override
Expand All @@ -27,8 +28,7 @@ class LevelRepositoryImpl implements LevelRepository {
Future<void> saveLevelData() async {
final data = LevelData()
..id = _levelData.id
..lastLevel = _levelData.lastLevel + 1
..secretWord = "";
..lastLevel = _levelData.lastLevel + 1;

await GetIt.I<Isar>().writeTxn((isar) async {
_levelData = data;
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/pages/about/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class AboutPage extends StatelessWidget {
title: R.stringsOf(context).scenario,
peoples: rofl,
),
Spacer(),
const Spacer(),
Text(
R.stringsOf(context).contact,
style: AppTypography.m16,
Expand All @@ -79,7 +79,7 @@ class AboutPage extends StatelessWidget {
),
),
),
Spacer(),
const Spacer(),
],
),
),
Expand Down
7 changes: 6 additions & 1 deletion lib/presentation/pages/about/models/credit_people.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
class CreditPeople {
import 'package:equatable/equatable.dart';

class CreditPeople extends Equatable {
const CreditPeople(this.name, this.url);

final String name;
final String url;

@override
List<Object?> get props => [name, url];
}
47 changes: 0 additions & 47 deletions lib/utils/responsive.dart

This file was deleted.

10 changes: 6 additions & 4 deletions lib/utils/update.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import 'package:in_app_update/in_app_update.dart';
Future<void> checkForAndroidUpdate() async {
if (kIsWeb) return;
if (!Platform.isAndroid) return;
final updateInfo = await InAppUpdate.checkForUpdate();
if (updateInfo.updateAvailability == UpdateAvailability.updateAvailable) {
await InAppUpdate.performImmediateUpdate();
}
try {
final updateInfo = await InAppUpdate.checkForUpdate();
if (updateInfo.updateAvailability == UpdateAvailability.updateAvailable) {
await InAppUpdate.performImmediateUpdate();
}
} catch (_) {}
}

0 comments on commit 853ec44

Please sign in to comment.