mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-19 18:43:45 +02:00
feat: add methods in timeline service interface
This commit is contained in:
parent
fb8ca56a87
commit
d24731412f
5 changed files with 36 additions and 4 deletions
|
@ -14,6 +14,11 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
cloud_firestore: ^4.13.1
|
||||||
|
firebase_core: ^2.22.0
|
||||||
|
firebase_storage: ^11.5.1
|
||||||
|
uuid: ^4.2.1
|
||||||
|
|
||||||
flutter_timeline_interface:
|
flutter_timeline_interface:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_timeline.git
|
url: https://github.com/Iconica-Development/flutter_timeline.git
|
||||||
|
|
|
@ -11,8 +11,9 @@ class TimelinePostReaction {
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.postId,
|
required this.postId,
|
||||||
required this.creatorId,
|
required this.creatorId,
|
||||||
required this.reaction,
|
|
||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
|
this.reaction,
|
||||||
|
this.imageUrl,
|
||||||
this.creator,
|
this.creator,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -28,8 +29,11 @@ class TimelinePostReaction {
|
||||||
/// The creator of the post. If null it isn't loaded yet.
|
/// The creator of the post. If null it isn't loaded yet.
|
||||||
final TimelinePosterUserModel? creator;
|
final TimelinePosterUserModel? creator;
|
||||||
|
|
||||||
/// The reactiontext
|
/// The reaction text if the creator sent one
|
||||||
final String reaction;
|
final String? reaction;
|
||||||
|
|
||||||
|
/// The url of the image if the creator sent one
|
||||||
|
final String? imageUrl;
|
||||||
|
|
||||||
/// Reaction creation date.
|
/// Reaction creation date.
|
||||||
final DateTime createdAt;
|
final DateTime createdAt;
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:flutter_timeline_interface/src/model/timeline_post.dart';
|
||||||
|
import 'package:flutter_timeline_interface/src/model/timeline_reaction.dart';
|
||||||
|
|
||||||
|
abstract class TimelineService {
|
||||||
|
Future<void> deletePost(TimelinePost post);
|
||||||
|
Future<void> createPost(TimelinePost post);
|
||||||
|
Future<List<TimelinePost>> fetchPosts(String? category);
|
||||||
|
Future<TimelinePost> fetchPostDetails(TimelinePost post);
|
||||||
|
Future<void> reactToPost(
|
||||||
|
TimelinePost post,
|
||||||
|
TimelinePostReaction reaction, {
|
||||||
|
Uint8List image,
|
||||||
|
});
|
||||||
|
Future<void> likePost(TimelinePost post);
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import 'package:flutter_timeline_interface/src/model/timeline_poster.dart';
|
||||||
|
|
||||||
|
mixin TimelineUserService {
|
||||||
|
Future<TimelinePosterUserModel?> getUser(String userId);
|
||||||
|
}
|
|
@ -155,9 +155,10 @@ class TimelinePostScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
// TODO(anyone): show image if the user send one
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
reaction.reaction,
|
reaction.reaction ?? '',
|
||||||
style: theme.textTheme.bodyMedium,
|
style: theme.textTheme.bodyMedium,
|
||||||
// text should go to new line
|
// text should go to new line
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
|
|
Loading…
Reference in a new issue