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/windows
**/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
- 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

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
name: flutter_timeline
description: Visual elements and interface combined into one package
version: 4.1.0
publish_to: none
version: 4.1.2
repository: https://github.com/Iconica-Development/flutter_timeline
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment:
sdk: ">=3.1.3 <4.0.0"
@ -13,21 +13,17 @@ environment:
dependencies:
flutter:
sdk: flutter
go_router: any
go_router: ^12.1.3
collection: any
collection: ^1.18.0
flutter_timeline_view:
git:
url: https://github.com/Iconica-Development/flutter_timeline
path: packages/flutter_timeline_view
ref: 4.1.0
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^4.1.1
flutter_timeline_interface:
git:
url: https://github.com/Iconica-Development/flutter_timeline
path: packages/flutter_timeline_interface
ref: 4.1.0
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^4.1.1
dev_dependencies:
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
description: Implementation of the Flutter Timeline interface for Firebase.
version: 4.1.0
publish_to: none
version: 4.1.2
repository: https://github.com/Iconica-Development/flutter_timeline
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment:
sdk: '>=3.1.3 <4.0.0'
@ -14,16 +14,14 @@ environment:
dependencies:
flutter:
sdk: flutter
cloud_firestore: ^4.13.1
firebase_core: ^2.22.0
firebase_storage: ^11.5.1
cloud_firestore: ^5.6.6
firebase_core: ^3.13.0
firebase_storage: ^12.4.5
uuid: ^4.2.1
flutter_timeline_interface:
git:
url: https://github.com/Iconica-Development/flutter_timeline
path: packages/flutter_timeline_interface
ref: 4.1.0
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^4.1.1
dev_dependencies:
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
description: Interface for the service of the Flutter Timeline component
version: 4.1.0
publish_to: none
version: 4.1.2
repository: https://github.com/Iconica-Development/flutter_timeline
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment:
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';
class TimelineScreen extends StatefulWidget {
const TimelineScreen({
TimelineScreen({
this.userId = 'test_user',
this.service,
TimelineService? service,
this.options = const TimelineOptions(),
this.onPostTap,
this.scrollController,
@ -23,7 +23,10 @@ class TimelineScreen extends StatefulWidget {
this.filterEnabled = false,
this.allowAllDeletion = false,
super.key,
});
}) : service = service ??
TimelineService(
postService: LocalTimelinePostService(),
);
/// The user id of the current user
final String userId;
@ -33,7 +36,7 @@ class TimelineScreen extends StatefulWidget {
final bool allowAllDeletion;
/// The service to use for fetching and manipulating posts
final TimelineService? service;
final TimelineService service;
/// All the configuration options for the timelinescreens and widgets
final TimelineOptions options;
@ -72,10 +75,6 @@ class _TimelineScreenState extends State<TimelineScreen> {
late var textFieldController = TextEditingController(
text: widget.options.filterOptions.initialFilterWord,
);
late var service = widget.service ??
TimelineService(
postService: LocalTimelinePostService(),
);
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
Widget build(BuildContext context) {
if (isLoading && widget.posts == null) {
@ -118,14 +126,15 @@ class _TimelineScreenState extends State<TimelineScreen> {
// Build the list of posts
return ListenableBuilder(
listenable: service.postService,
listenable: widget.service.postService,
builder: (context, _) {
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 (service.postService is TimelineFilterService) {
posts = (service.postService as TimelineFilterService)
if (widget.service.postService is TimelineFilterService) {
posts = (widget.service.postService as TimelineFilterService)
.filterPosts(filterWord!, {});
} else {
debugPrint('Timeline service needs to mixin'
@ -247,7 +256,7 @@ class _TimelineScreenState extends State<TimelineScreen> {
padding: widget.options.paddings.postPadding,
child: widget.postWidgetBuilder?.call(post) ??
TimelinePostWidget(
service: service,
service: widget.service,
userId: widget.userId,
options: widget.options,
allowAllDeletion: widget.allowAllDeletion,
@ -265,11 +274,11 @@ class _TimelineScreenState extends State<TimelineScreen> {
builder: (context) => Scaffold(
body: TimelinePostScreen(
userId: 'test_user',
service: service,
service: widget.service,
options: widget.options,
post: post,
onPostDelete: () {
service.postService
widget.service.postService
.deletePost(post);
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),
onTapUnlike: () async => service.postService
onTapUnlike: () async => widget
.service.postService
.unlikePost(widget.userId, post),
onPostDelete: () async =>
service.postService.deletePost(post),
widget.service.postService.deletePost(post),
onUserTap: widget.onUserTap,
),
),
@ -319,7 +330,7 @@ class _TimelineScreenState extends State<TimelineScreen> {
Future<void> loadPosts() async {
if (widget.posts != null || !context.mounted) return;
try {
await service.postService.fetchPosts(category);
await widget.service.postService.fetchPosts(category);
setState(() {
isLoading = false;
});

View file

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

View file

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