ApiForum class
Forum model
Forum
is a data model for a forum category.
Note that forum data model must not connect to backend directly by using API controller. Instead, the API controller will use the instance of this forum model.
Forum
only manages the data of a category.
사용자가 글 목록 스크린을 스크롤 할 때, 맨 아래 부분에 스크롤이 도달했을 때, 남은 아이템의 수가 loadMoreOn 보다 작다면, 다음 글 목록을 하는 콜백 함수 loadMore 를 호출 한다.
Constructors
- ApiForum({ApiCategory? setting, String? subcategory, String? userIdx, String? relationIdx, String? searchKey, int? limit, Function? render, int? loadMoreOn, Function? loadMore, String? categoryId, ApiPost? post, Function? onChatIconPressed, Function? commentButtonBuilder, Function? postTitleBuilder, Function? postContentBuilder, Function? postButtonBuilder, Function? postBottomBuilder, Function? postAvatarBuilder, Function? commentAvatarBuilder, Function? commentNameBuilder, Function? commentVisibility, Function? commentCanEdit})
Properties
- canCreate → bool
-
no setter
- canList → bool
-
no setter
- canLoad → bool
-
no setter
- categoryId ↔ String?
-
If
_categoryId
is not set, then use it fromsetting.id
getter/setter pair - commentAvatarBuilder ↔ Function?
-
avatar builder for the comment author
getter/setter pair
- commentButtonBuilder ↔ Function?
-
Build comment buttons
getter/setter pair
- commentCanEdit ↔ Function?
-
Test if the user can edit.
getter/setter pair
- commentNameBuilder ↔ Function?
-
name builder for the comment author
getter/setter pair
- commentVisibility ↔ Function?
-
to show or hide the comment.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasPosts → bool
-
no setter
- itemPositionsListener → ItemPositionsListener
-
final
- limit → int?
-
no setter
- listController → ItemScrollController
-
구글에서 제작한 Scrollable Positioned List https://pub.dev/packages/scrollable_positioned_list
장점은 글 생성/수정 후, 해당(또는 특정) 글 위치로 이동을 할 수 있다.
하지만, 다음 페이지 로딩을 할 때, 마지막에 몇개 아이템 남았을 때 이동할지 결정은 직접 코드를 작성해야 한다.
final
- listView → String?
-
no setter
- loading ↔ bool
-
getter/setter pair
- loadMore ↔ Function?
-
getter/setter pair
- loadMoreOn ↔ int?
-
getter/setter pair
- noMorePosts ↔ bool
-
getter/setter pair
- noPosts → bool
-
no setter
- onChatIconPressed ↔ Function?
-
Do not use this method. Use commentButtonBuilder
This will be deprecated soon.
getter/setter pair
- pageNo ↔ int
-
getter/setter pair
- post ↔ ApiPost?
-
The post to be shown on top of the list.
This may also serve as a post view page. Since it has a complete post information,
it will be immediately available before getting data from backend.
When
fetchPost
is being called, render will be immidately called with this post.getter/setter pair - postAvatarBuilder ↔ Function?
-
post author builder
getter/setter pair
- postBottomBuilder ↔ Function?
-
post bottom builder
getter/setter pair
- postButtonBuilder ↔ Function?
-
post buttons builder
getter/setter pair
- postContentBuilder ↔ Function?
-
post content builder
getter/setter pair
- postInEdit ↔ ApiPost?
-
getter/setter pair
- postOnTop ↔ String?
-
The post of postOnTop will be shown on top of the post list with other posts.
Use this when user want to see(view) a post. It may serve as a view page.
The following posts is coming same category if
category
is not set. It is ignored when searchKey is set.getter/setter pair -
posts
↔ List<
ApiPost?> -
getter/setter pair
- postTitleBuilder ↔ Function?
-
post title builder
getter/setter pair
- postView → String?
-
no setter
- relationIdx ↔ String?
-
The relationIdx is used to fetch posts related with an entity of relationIdx.
getter/setter pair
- render ↔ Function?
-
render 는 게시판 목록을 다시 그려야 할 때, 사용되는데, 문제가 많다. GetX Controller 나 RxDart 로 변경을 해야 한다.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchCategories → String
-
no setter
- searchKey ↔ String?
-
The searchKey is used on fetching to search posts
getter/setter pair
- setting ↔ ApiCategory?
-
Forum category settings
getter/setter pair
- showDislike → bool
-
no setter
- showLike → bool
-
no setter
- subcategory ↔ String?
-
getter/setter pair
- userIdx ↔ String?
-
The userIdx is used on fetching to get the user's posts only.
getter/setter pair
Methods
-
addListener(
dynamic listener) → void -
editPost(
ApiPost post) → dynamic - Mark the forum in edit state.
-
insertOrUpdatePost(
ApiPost post) → dynamic - Inserts a new post on top or updates an existing post.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
ForumEventType forumEventType, dynamic data) → void -
showVoteButton(
String str) → bool -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited