-
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.
- Loading branch information
1 parent
8da8cc5
commit 8c5de49
Showing
23 changed files
with
205 additions
and
61 deletions.
There are no files selected for viewing
File renamed without changes.
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,8 @@ | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
|
||
extension FirestoreQueryExt on Query<Map<String, dynamic>> { | ||
Future<QueryDocumentSnapshot<Map<String, dynamic>>?> get firstOrNull async { | ||
final res = await get(); | ||
return res.docs.firstOrNull; | ||
} | ||
} |
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 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,20 @@ | ||
import 'package:fpdart/fpdart.dart'; | ||
import 'package:poster/core/domain/post/repository/post_repository.dart'; | ||
import 'package:poster/core/utils/functions/try_future.dart'; | ||
|
||
final class LikeUseCase { | ||
final PostRepository _repository; | ||
|
||
LikeUseCase({required PostRepository repository}) : _repository = repository; | ||
|
||
Future<Either<Exception, void>> switchLikeForPost({ | ||
required String email, | ||
required String postId, | ||
required void Function(bool) onSuccess, | ||
required void Function(Exception) onError, | ||
}) => tryFuture(() async { | ||
_repository | ||
.switchLikeForPost(email: email, postId: postId) | ||
.then((res) => res.fold(onError, onSuccess)); | ||
}); | ||
} |
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,32 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:poster/core/presentation/theme/mod.dart'; | ||
|
||
final class PostShape extends StatelessWidget { | ||
final Widget child; | ||
const PostShape({super.key, required this.child}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = context.read<AppTheme>(); | ||
|
||
return Container( | ||
width: double.infinity, | ||
constraints: BoxConstraints( | ||
maxWidth: theme.dimensions.size.extraEnormous, | ||
), | ||
padding: EdgeInsets.only( | ||
top: theme.dimensions.padding.medium, | ||
left: theme.dimensions.padding.medium, | ||
right: theme.dimensions.padding.medium, | ||
), | ||
decoration: BoxDecoration( | ||
color: theme.colors.background.post, | ||
borderRadius: BorderRadius.all( | ||
Radius.circular(theme.dimensions.radius.small), | ||
), | ||
), | ||
child: child, | ||
); | ||
} | ||
} |
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,28 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:poster/core/presentation/post/post_shape.dart'; | ||
import 'package:poster/core/presentation/theme/app.dart'; | ||
import 'package:shimmer/shimmer.dart'; | ||
|
||
final class PostShimmer extends StatelessWidget { | ||
static const _height = 177.0; | ||
|
||
const PostShimmer({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final theme = context.read<AppTheme>(); | ||
|
||
return Shimmer.fromColors( | ||
baseColor: theme.colors.background.post, | ||
highlightColor: theme.colors.background.primary, | ||
child: const PostShape( | ||
child: SizedBox( | ||
width: double.infinity, | ||
height: _height, | ||
), | ||
), | ||
); | ||
} | ||
} |
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
Oops, something went wrong.