diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f00d77..5d50187 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.3.1 + +- Updated readme. +- fixed bug in `localTimelinePostService` where it was not possible to make a post. + ## 2.3.0 - Added separate open page builders for timeline screens diff --git a/README.md b/README.md index fa22d8e..1279960 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Flutter Timeline -Flutter Timeline is a package which shows a list posts by a user. This package also has additional features like liking a post and leaving comments. Default this package adds support for a Firebase back-end. You can add your custom back-end (like a Websocket-API) by extending the `CommunityChatInterface` interface from the `flutter_community_chat_interface` package. +Flutter Timeline is a package which shows a list posts by a user. This package also has additional features like liking a post and leaving comments. Default this package adds support for a Firebase back-end. ![Flutter Timeline GIF](example.gif) @@ -8,10 +8,10 @@ Flutter Timeline is a package which shows a list posts by a user. This package a To use this package, add flutter_timeline as a dependency in your pubspec.yaml file: ``` - flutter_timeline + flutter_timeline: git: - url: https://github.com/Iconica-Development/flutter_timeline.git - path: packages/flutter_timeline + url: https://github.com/Iconica-Development/flutter_timeline.git + path: packages/flutter_timeline ``` If you are going to use Firebase as the back-end of the Timeline, you should also add the following package as a dependency to your pubspec.yaml file: @@ -19,11 +19,17 @@ If you are going to use Firebase as the back-end of the Timeline, you should als ``` flutter_timeline_firebase: git: - url: https://github.com/Iconica-Development/flutter_timeline.git - path: packages/flutter_timeline_firebase + url: https://github.com/Iconica-Development/flutter_timeline.git + path: packages/flutter_timeline_firebase ``` +In firebase add firestore and storage to your project. +In firestore add a collection named `timeline` and a collection named `users`. +In the `timeline` collection all posts will be stored. In the `users` collection all users will be stored. +In the `users` collection you should add your users data. + Add the following code in your `main` function, before the runApp(). +And import this package: import 'package:intl/date_symbol_data_local.dart'; ``` initializeDateFormatting(); ``` @@ -35,14 +41,17 @@ Add go_router as dependency to your project. Add the following configuration to your flutter_application: ``` -List getTimelineStoryRoutes() => getTimelineStoryRoutes( - TimelineUserStoryConfiguration( - service: FirebaseTimelineService(), - userService: FirebaseUserService(), - userId: currentUserId, - optionsBuilder: (context) => FirebaseOptions(), +List getTimelineStoryRoutes() => + getTimelineStoryRoutes( + TimelineUserStoryConfiguration( + service: TimelineService( + postService: LocalTimelinePostService(), ), - ); + optionsBuilder: (context) { + return const TimelineOptions(); + }, + ), + ); ``` Add the `getTimelineStoryRoutes()` to your go_router routes like so: @@ -58,7 +67,7 @@ final GoRouter _router = GoRouter( ); }, ), - ...getTimelineStoryRoutes(timelineUserStoryConfiguration) + ...getTimelineStoryRoutes(configuration: configuration); ], ); ``` @@ -171,7 +180,7 @@ The `TimelineOptions` has its own parameters, as specified below: | categoriesOptions | Options for using the category selector to provide posts of a certain category. | -The `ImagePickerTheme` ans `imagePickerConfig` also have their own parameters, how to use these parameters can be found in [the documentation of the flutter_image_picker package](https://github.com/Iconica-Development/flutter_image_picker). +The `ImagePickerTheme` and `imagePickerConfig` also have their own parameters, how to use these parameters can be found in [the documentation of the flutter_image_picker package](https://github.com/Iconica-Development/flutter_image_picker). ## Issues diff --git a/packages/flutter_timeline/pubspec.yaml b/packages/flutter_timeline/pubspec.yaml index e799b1d..199bac3 100644 --- a/packages/flutter_timeline/pubspec.yaml +++ b/packages/flutter_timeline/pubspec.yaml @@ -3,7 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later name: flutter_timeline description: Visual elements and interface combined into one package -version: 2.3.0 +version: 2.3.1 publish_to: none @@ -19,13 +19,13 @@ dependencies: git: url: https://github.com/Iconica-Development/flutter_timeline path: packages/flutter_timeline_view - ref: 2.3.0 + ref: 2.3.1 flutter_timeline_interface: git: url: https://github.com/Iconica-Development/flutter_timeline path: packages/flutter_timeline_interface - ref: 2.3.0 + ref: 2.3.1 dev_dependencies: flutter_lints: ^2.0.0 diff --git a/packages/flutter_timeline_firebase/pubspec.yaml b/packages/flutter_timeline_firebase/pubspec.yaml index 271f1f3..cf9e59a 100644 --- a/packages/flutter_timeline_firebase/pubspec.yaml +++ b/packages/flutter_timeline_firebase/pubspec.yaml @@ -4,7 +4,7 @@ name: flutter_timeline_firebase description: Implementation of the Flutter Timeline interface for Firebase. -version: 2.3.0 +version: 2.3.1 publish_to: none @@ -23,7 +23,7 @@ dependencies: git: url: https://github.com/Iconica-Development/flutter_timeline path: packages/flutter_timeline_interface - ref: 2.3.0 + ref: 2.3.1 dev_dependencies: flutter_lints: ^2.0.0 diff --git a/packages/flutter_timeline_interface/pubspec.yaml b/packages/flutter_timeline_interface/pubspec.yaml index d91da84..ad6e991 100644 --- a/packages/flutter_timeline_interface/pubspec.yaml +++ b/packages/flutter_timeline_interface/pubspec.yaml @@ -4,7 +4,7 @@ name: flutter_timeline_interface description: Interface for the service of the Flutter Timeline component -version: 2.3.0 +version: 2.3.1 publish_to: none diff --git a/packages/flutter_timeline_view/lib/src/services/local_post_service.dart b/packages/flutter_timeline_view/lib/src/services/local_post_service.dart index 9f5b735..2f54ac9 100644 --- a/packages/flutter_timeline_view/lib/src/services/local_post_service.dart +++ b/packages/flutter_timeline_view/lib/src/services/local_post_service.dart @@ -86,7 +86,9 @@ class LocalTimelinePostService @override Future> fetchPosts(String? category) async { - posts = getMockedPosts(); + if (posts.isEmpty) { + posts = getMockedPosts(); + } notifyListeners(); return posts; } diff --git a/packages/flutter_timeline_view/pubspec.yaml b/packages/flutter_timeline_view/pubspec.yaml index 8b6c133..1cd4bec 100644 --- a/packages/flutter_timeline_view/pubspec.yaml +++ b/packages/flutter_timeline_view/pubspec.yaml @@ -4,7 +4,7 @@ name: flutter_timeline_view description: Visual elements of the Flutter Timeline Component -version: 2.3.0 +version: 2.3.1 publish_to: none @@ -23,7 +23,7 @@ dependencies: git: url: https://github.com/Iconica-Development/flutter_timeline path: packages/flutter_timeline_interface - ref: 2.3.0 + ref: 2.3.1 flutter_image_picker: git: url: https://github.com/Iconica-Development/flutter_image_picker