-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from IliaKhuzhakhmetov/refator
Refator
- Loading branch information
Showing
86 changed files
with
2,019 additions
and
1,205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
abstract class Mapper<E, M> { | ||
E fromModel(M model); | ||
M toModel(E entity); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,38 @@ | ||
part of '../di.dart'; | ||
|
||
void _registerCubits() { | ||
locator.registerFactory(() => AddItemDialogCubit()); | ||
locator.registerFactory(() => ItemsCubit()); | ||
|
||
locator.registerLazySingleton( | ||
locator.registerFactory(() => PickDateCubit()); | ||
|
||
locator.registerFactory(() => ValidationCubit()); | ||
|
||
locator.registerFactory( | ||
() => DeletePurchaseCubit(deletePurchaseUsecase: locator()), | ||
); | ||
|
||
locator.registerFactory( | ||
() => ApplicationCubit( | ||
changeAppThemeBrighnessUseCase: locator.get(), | ||
getSavedBrightnessUseCase: locator.get(), | ||
changeAppThemeBrightnessUseCase: locator(), | ||
getSavedBrightnessUseCase: locator(), | ||
), | ||
); | ||
|
||
// PurchaseCubit | ||
locator.registerFactory(() => PurchaseCubit(itemsRepository: locator.get())); | ||
locator.registerFactory( | ||
() => GetItemsByPurchaseCubit(itemsRepository: locator())); | ||
|
||
// PurchasesCubit | ||
locator.registerFactory( | ||
() => PurchasesCubit( | ||
deletePurchaseUsecase: locator.get(), | ||
getPurchasesUsecase: locator.get(), | ||
() => GetAllPurchasesCubit( | ||
getPurchasesUsecase: locator(), | ||
), | ||
); | ||
|
||
// AddPurchaseCubit | ||
locator.registerFactory( | ||
() => AddPurchaseCubit( | ||
addNewPurchaseUseCase: locator.get(), | ||
addNewPurchaseUseCase: locator(), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
part of '../di.dart'; | ||
|
||
void _registerMappers() { | ||
locator.registerLazySingleton(() => PurchaseMapper()); | ||
locator.registerLazySingleton(() => ItemMapper()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import 'package:intl/intl.dart'; | ||
|
||
extension DateExtension on DateTime { | ||
String formattedDate({String format = 'dd MMMM yyyy'}) => | ||
DateFormat(format).format(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
abstract class TextValidations { | ||
static String? isNotEmpty(String? value) { | ||
return value?.isNotEmpty == true ? null : 'Can not be empty'; | ||
} | ||
|
||
static String? isCorrectPrice(String? value) { | ||
final parsed = double.tryParse(value?.replaceAll(',', '.') ?? ''); | ||
|
||
return value?.isNotEmpty == true && parsed != null && parsed > 0 | ||
? null | ||
: 'Incorrect price'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.