diff --git a/packages/flutter_timeline/lib/flutter_timeline.dart b/packages/flutter_timeline/lib/flutter_timeline.dart index 12061b8..cdc1254 100644 --- a/packages/flutter_timeline/lib/flutter_timeline.dart +++ b/packages/flutter_timeline/lib/flutter_timeline.dart @@ -1,5 +1,8 @@ // SPDX-FileCopyrightText: 2023 Iconica // // SPDX-License-Identifier: BSD-3-Clause - +/// Flutter Timeline library library flutter_timeline; + +export 'package:flutter_timeline_interface/flutter_timeline_interface.dart'; +export 'package:flutter_timeline_view/flutter_timeline_view.dart'; diff --git a/packages/flutter_timeline_interface/lib/src/model/timeline_post.dart b/packages/flutter_timeline_interface/lib/src/model/timeline_post.dart new file mode 100644 index 0000000..cbad1fc --- /dev/null +++ b/packages/flutter_timeline_interface/lib/src/model/timeline_post.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_timeline_interface/src/model/timeline_reaction.dart'; + +/// A post of the timeline. +@immutable +class TimelinePost { + const TimelinePost({ + required this.id, + required this.creatorId, + required this.title, + required this.category, + required this.content, + required this.likes, + required this.reaction, + required this.createdAt, + required this.reactionEnabled, + this.likedBy, + this.reactions, + this.imageUrl, + }); + + /// The unique identifier of the post. + final String id; + + /// The unique identifier of the creator of the post. + final String creatorId; + + /// The title of the post. + final String title; + + /// The category of the post on which can be filtered. + final String category; + + /// The url of the image of the post. + final String? imageUrl; + + /// The content of the post. + final String content; + + /// The number of likes of the post. + final int likes; + + /// The list of users who liked the post. If null it isn't loaded yet. + final List? likedBy; + + /// The number of reaction of the post. + final int reaction; + + /// The list of reactions of the post. If null it isn't loaded yet. + final List? reactions; + + /// Post creation date. + final DateTime createdAt; + + /// If reacting is enabled on the post. + final bool reactionEnabled; +} diff --git a/packages/flutter_timeline_interface/lib/src/model/timeline_reaction.dart b/packages/flutter_timeline_interface/lib/src/model/timeline_reaction.dart new file mode 100644 index 0000000..7294449 --- /dev/null +++ b/packages/flutter_timeline_interface/lib/src/model/timeline_reaction.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; + +@immutable +class TimelinePostReaction { + const TimelinePostReaction({ + required this.id, + required this.postId, + required this.creatorId, + required this.reaction, + required this.createdAt, + }); + + /// The unique identifier of the reaction. + final String id; + + /// The unique identifier of the post on which the reaction is. + final String postId; + + /// The unique identifier of the creator of the reaction. + final String creatorId; + + /// The reactiontext + final String reaction; + + /// Reaction creation date. + final DateTime createdAt; +}