Compare commits

...

6 commits

Author SHA1 Message Date
b8710d051a chore: update CHANGELOG and set publish_to URL 2025-04-22 15:03:36 +02:00
fe7c19408b fix: reload posts when the parent widget has rebuilt on the timeline screen
This way if the service passed to us is changed we'll update our posts from it instead
of keeping the ones from the previous service.
2025-04-22 15:01:12 +02:00
48f77e30e0 fix: don't use TimelineService as state
Otherwise the widget won't use a new service if it has been provided by
the parent. It really isn't state anyway.
2025-04-22 15:01:12 +02:00
Bart Ribbers
93e1b35a7a chore: ready for publishing
Get dependencies from the pub server and specify versions rather than
depend on "any"
2025-04-13 13:15:52 +02:00
Bart Ribbers
b4d678a3da chore(deps): upgrade Firebase dependencies to their latest versions 2025-04-13 12:55:20 +02:00
Bart Ribbers
de73fcb136 chore: add FVM configuration 2025-04-13 12:54:04 +02:00
21 changed files with 88 additions and 60 deletions

3
.fvmrc Normal file
View file

@ -0,0 +1,3 @@
{
"flutter": "3.22.1"
}

5
.gitignore vendored
View file

@ -50,4 +50,7 @@ pubspec_overrides.yaml
**/example/macos **/example/macos
**/example/windows **/example/windows
**/example/web **/example/web
**/example/README.md **/example/README.md
# FVM Version Cache
.fvm/

View file

@ -1,3 +1,10 @@
## 4.1.2
- Get posts from the updated service when a new TimelineService has been passed
## 4.1.1
- Update Firebase dependencies to their latest versions
## 4.1.0 ## 4.1.0
- Migrate to flutter 3.22 which deprecates the background and onBackground properties in the ThemeData and also removes MaterialStatePropertyAll - Migrate to flutter 3.22 which deprecates the background and onBackground properties in the ThemeData and also removes MaterialStatePropertyAll
- Add categorySelectionButtonSelectedTextColor and categorySelectionButtonUnselectedTextColor to the timeline theme to allow for the customization of the text color of the category selection buttons - Add categorySelectionButtonSelectedTextColor and categorySelectionButtonUnselectedTextColor to the timeline theme to allow for the customization of the text color of the category selection buttons

View file

@ -0,0 +1 @@
../../CHANGELOG.md

View file

@ -0,0 +1 @@
../../LICENSE

View file

@ -0,0 +1 @@
../../README.md

View file

@ -3,9 +3,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
name: flutter_timeline name: flutter_timeline
description: Visual elements and interface combined into one package description: Visual elements and interface combined into one package
version: 4.1.0 version: 4.1.2
repository: https://github.com/Iconica-Development/flutter_timeline
publish_to: none publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
sdk: ">=3.1.3 <4.0.0" sdk: ">=3.1.3 <4.0.0"
@ -13,21 +13,17 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
go_router: any go_router: ^12.1.3
collection: any collection: ^1.18.0
flutter_timeline_view: flutter_timeline_view:
git: hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
url: https://github.com/Iconica-Development/flutter_timeline version: ^4.1.1
path: packages/flutter_timeline_view
ref: 4.1.0
flutter_timeline_interface: flutter_timeline_interface:
git: hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
url: https://github.com/Iconica-Development/flutter_timeline version: ^4.1.1
path: packages/flutter_timeline_interface
ref: 4.1.0
dev_dependencies: dev_dependencies:
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0

View file

@ -0,0 +1 @@
../../CHANGELOG.md

View file

@ -0,0 +1 @@
../../LICENSE

View file

@ -0,0 +1 @@
../../README.md

View file

@ -4,9 +4,9 @@
name: flutter_timeline_firebase name: flutter_timeline_firebase
description: Implementation of the Flutter Timeline interface for Firebase. description: Implementation of the Flutter Timeline interface for Firebase.
version: 4.1.0 version: 4.1.2
repository: https://github.com/Iconica-Development/flutter_timeline
publish_to: none publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
sdk: '>=3.1.3 <4.0.0' sdk: '>=3.1.3 <4.0.0'
@ -14,16 +14,14 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
cloud_firestore: ^4.13.1 cloud_firestore: ^5.6.6
firebase_core: ^2.22.0 firebase_core: ^3.13.0
firebase_storage: ^11.5.1 firebase_storage: ^12.4.5
uuid: ^4.2.1 uuid: ^4.2.1
flutter_timeline_interface: flutter_timeline_interface:
git: hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
url: https://github.com/Iconica-Development/flutter_timeline version: ^4.1.1
path: packages/flutter_timeline_interface
ref: 4.1.0
dev_dependencies: dev_dependencies:
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0

View file

@ -0,0 +1 @@
../../CHANGELOG.md

View file

@ -0,0 +1 @@
../../LICENSE

View file

@ -0,0 +1 @@
../../README.md

View file

@ -4,9 +4,9 @@
name: flutter_timeline_interface name: flutter_timeline_interface
description: Interface for the service of the Flutter Timeline component description: Interface for the service of the Flutter Timeline component
version: 4.1.0 version: 4.1.2
repository: https://github.com/Iconica-Development/flutter_timeline
publish_to: none publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
sdk: '>=3.1.3 <4.0.0' sdk: '>=3.1.3 <4.0.0'

View file

@ -0,0 +1 @@
../../CHANGELOG.md

View file

@ -0,0 +1 @@
../../LICENSE

View file

@ -0,0 +1 @@
../../README.md

View file

@ -9,9 +9,9 @@ import 'package:flutter_timeline_interface/flutter_timeline_interface.dart';
import 'package:flutter_timeline_view/flutter_timeline_view.dart'; import 'package:flutter_timeline_view/flutter_timeline_view.dart';
class TimelineScreen extends StatefulWidget { class TimelineScreen extends StatefulWidget {
const TimelineScreen({ TimelineScreen({
this.userId = 'test_user', this.userId = 'test_user',
this.service, TimelineService? service,
this.options = const TimelineOptions(), this.options = const TimelineOptions(),
this.onPostTap, this.onPostTap,
this.scrollController, this.scrollController,
@ -23,7 +23,10 @@ class TimelineScreen extends StatefulWidget {
this.filterEnabled = false, this.filterEnabled = false,
this.allowAllDeletion = false, this.allowAllDeletion = false,
super.key, super.key,
}); }) : service = service ??
TimelineService(
postService: LocalTimelinePostService(),
);
/// The user id of the current user /// The user id of the current user
final String userId; final String userId;
@ -33,7 +36,7 @@ class TimelineScreen extends StatefulWidget {
final bool allowAllDeletion; final bool allowAllDeletion;
/// The service to use for fetching and manipulating posts /// The service to use for fetching and manipulating posts
final TimelineService? service; final TimelineService service;
/// All the configuration options for the timelinescreens and widgets /// All the configuration options for the timelinescreens and widgets
final TimelineOptions options; final TimelineOptions options;
@ -72,10 +75,6 @@ class _TimelineScreenState extends State<TimelineScreen> {
late var textFieldController = TextEditingController( late var textFieldController = TextEditingController(
text: widget.options.filterOptions.initialFilterWord, text: widget.options.filterOptions.initialFilterWord,
); );
late var service = widget.service ??
TimelineService(
postService: LocalTimelinePostService(),
);
bool isLoading = true; bool isLoading = true;
@ -110,6 +109,15 @@ class _TimelineScreenState extends State<TimelineScreen> {
}); });
} }
@override
void didUpdateWidget(covariant TimelineScreen oldWidget) {
super.didUpdateWidget(oldWidget);
WidgetsBinding.instance.addPostFrameCallback((_) {
unawaited(loadPosts());
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (isLoading && widget.posts == null) { if (isLoading && widget.posts == null) {
@ -118,14 +126,15 @@ class _TimelineScreenState extends State<TimelineScreen> {
// Build the list of posts // Build the list of posts
return ListenableBuilder( return ListenableBuilder(
listenable: service.postService, listenable: widget.service.postService,
builder: (context, _) { builder: (context, _) {
if (!context.mounted) return const SizedBox(); if (!context.mounted) return const SizedBox();
var posts = widget.posts ?? service.postService.getPosts(category); var posts =
widget.posts ?? widget.service.postService.getPosts(category);
if (widget.filterEnabled && filterWord != null) { if (widget.filterEnabled && filterWord != null) {
if (service.postService is TimelineFilterService) { if (widget.service.postService is TimelineFilterService) {
posts = (service.postService as TimelineFilterService) posts = (widget.service.postService as TimelineFilterService)
.filterPosts(filterWord!, {}); .filterPosts(filterWord!, {});
} else { } else {
debugPrint('Timeline service needs to mixin' debugPrint('Timeline service needs to mixin'
@ -247,7 +256,7 @@ class _TimelineScreenState extends State<TimelineScreen> {
padding: widget.options.paddings.postPadding, padding: widget.options.paddings.postPadding,
child: widget.postWidgetBuilder?.call(post) ?? child: widget.postWidgetBuilder?.call(post) ??
TimelinePostWidget( TimelinePostWidget(
service: service, service: widget.service,
userId: widget.userId, userId: widget.userId,
options: widget.options, options: widget.options,
allowAllDeletion: widget.allowAllDeletion, allowAllDeletion: widget.allowAllDeletion,
@ -265,11 +274,11 @@ class _TimelineScreenState extends State<TimelineScreen> {
builder: (context) => Scaffold( builder: (context) => Scaffold(
body: TimelinePostScreen( body: TimelinePostScreen(
userId: 'test_user', userId: 'test_user',
service: service, service: widget.service,
options: widget.options, options: widget.options,
post: post, post: post,
onPostDelete: () { onPostDelete: () {
service.postService widget.service.postService
.deletePost(post); .deletePost(post);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -278,12 +287,14 @@ class _TimelineScreenState extends State<TimelineScreen> {
), ),
); );
}, },
onTapLike: () async => service.postService onTapLike: () async => widget
.service.postService
.likePost(widget.userId, post), .likePost(widget.userId, post),
onTapUnlike: () async => service.postService onTapUnlike: () async => widget
.service.postService
.unlikePost(widget.userId, post), .unlikePost(widget.userId, post),
onPostDelete: () async => onPostDelete: () async =>
service.postService.deletePost(post), widget.service.postService.deletePost(post),
onUserTap: widget.onUserTap, onUserTap: widget.onUserTap,
), ),
), ),
@ -319,7 +330,7 @@ class _TimelineScreenState extends State<TimelineScreen> {
Future<void> loadPosts() async { Future<void> loadPosts() async {
if (widget.posts != null || !context.mounted) return; if (widget.posts != null || !context.mounted) return;
try { try {
await service.postService.fetchPosts(category); await widget.service.postService.fetchPosts(category);
setState(() { setState(() {
isLoading = false; isLoading = false;
}); });

View file

@ -4,31 +4,28 @@
name: flutter_timeline_view name: flutter_timeline_view
description: Visual elements of the Flutter Timeline Component description: Visual elements of the Flutter Timeline Component
version: 4.1.0 version: 4.1.2
repository: https://github.com/Iconica-Development/flutter_timeline
publish_to: none publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
sdk: '>=3.1.3 <4.0.0' sdk: '>=3.4.1 <4.0.0'
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
intl: any intl: ^0.19.0
cached_network_image: ^3.2.2 cached_network_image: ^3.2.2
dotted_border: ^2.1.0 dotted_border: ^2.1.0
flutter_html: ^3.0.0-beta.2 flutter_html: ^3.0.0-beta.2
flutter_timeline_interface: flutter_timeline_interface:
git: hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
url: https://github.com/Iconica-Development/flutter_timeline version: ^4.1.1
path: packages/flutter_timeline_interface
ref: 4.1.0
flutter_image_picker: flutter_image_picker:
git: hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
url: https://github.com/Iconica-Development/flutter_image_picker version: ^1.0.5
ref: 1.0.5 collection: ^1.18.0
collection: any
dev_dependencies: dev_dependencies:
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0

View file

@ -5,6 +5,7 @@
name: flutter_timeline_workspace name: flutter_timeline_workspace
environment: environment:
sdk: '>=2.18.0 <3.0.0' sdk: '>=3.1.3 <4.0.0'
dev_dependencies: dev_dependencies:
melos: ^3.0.1 melos: ^3.0.1