mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-19 10:33:44 +02:00
feat: timeline post models
This commit is contained in:
parent
d3731ca03e
commit
bb6106f1eb
3 changed files with 88 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Iconica
|
// SPDX-FileCopyrightText: 2023 Iconica
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
/// Flutter Timeline library
|
||||||
library flutter_timeline;
|
library flutter_timeline;
|
||||||
|
|
||||||
|
export 'package:flutter_timeline_interface/flutter_timeline_interface.dart';
|
||||||
|
export 'package:flutter_timeline_view/flutter_timeline_view.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<String>? 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<TimelinePostReaction>? reactions;
|
||||||
|
|
||||||
|
/// Post creation date.
|
||||||
|
final DateTime createdAt;
|
||||||
|
|
||||||
|
/// If reacting is enabled on the post.
|
||||||
|
final bool reactionEnabled;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in a new issue