mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-18 18:13:46 +02:00
fix: feedback
This commit is contained in:
parent
02c136d7ea
commit
38bb41ce10
23 changed files with 87 additions and 36 deletions
|
@ -1,3 +1,8 @@
|
|||
## 5.1.0
|
||||
|
||||
* Added `routeToPostDetail` to the `TimelineUserStory` to allow for navigation to the post detail screen.
|
||||
* Fixed design issues.
|
||||
|
||||
## 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
|
||||
|
|
1
packages/cd
Symbolic link
1
packages/cd
Symbolic link
|
@ -0,0 +1 @@
|
|||
cd
|
|
@ -1 +1 @@
|
|||
../../LICENSE
|
||||
[../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)
|
|
@ -1 +1 @@
|
|||
../../README.md
|
||||
[../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)
|
|
@ -10,11 +10,13 @@ import 'package:flutter_timeline/flutter_timeline.dart';
|
|||
/// This function creates a navigator for displaying user stories on a timeline.
|
||||
/// It takes a [BuildContext] and an optional [TimelineUserStoryConfiguration]
|
||||
/// as parameters. If no configuration is provided, default values will be used.
|
||||
late TimelineUserStoryConfiguration timelineUserStoryConfiguration;
|
||||
|
||||
Widget timeLineNavigatorUserStory({
|
||||
required BuildContext context,
|
||||
TimelineUserStoryConfiguration? configuration,
|
||||
}) {
|
||||
var config = configuration ??
|
||||
timelineUserStoryConfiguration = configuration ??
|
||||
TimelineUserStoryConfiguration(
|
||||
userId: 'test_user',
|
||||
service: TimelineService(
|
||||
|
@ -23,7 +25,10 @@ Widget timeLineNavigatorUserStory({
|
|||
optionsBuilder: (context) => const TimelineOptions(),
|
||||
);
|
||||
|
||||
return _timelineScreenRoute(config: config, context: context);
|
||||
return _timelineScreenRoute(
|
||||
config: timelineUserStoryConfiguration,
|
||||
context: context,
|
||||
);
|
||||
}
|
||||
|
||||
/// A widget function that creates a timeline screen route.
|
||||
|
@ -262,7 +267,8 @@ Widget _postOverviewScreenRoute({
|
|||
service: config.service,
|
||||
timelinePost: post,
|
||||
onPostSubmit: (post) async {
|
||||
await config.service.postService.createPost(post);
|
||||
var createdPost = await config.service.postService.createPost(post);
|
||||
config.onPostCreate?.call(createdPost);
|
||||
if (context.mounted) {
|
||||
await Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
|
@ -354,3 +360,15 @@ Widget _postCategorySelectionScreen({
|
|||
body: timelineSelectionScreen,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> routeToPostDetail(BuildContext context, TimelinePost post) async {
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => _postDetailScreenRoute(
|
||||
config: timelineUserStoryConfiguration,
|
||||
context: context,
|
||||
post: post,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ class TimelineUserStoryConfiguration {
|
|||
this.afterPostCreationGoHome = false,
|
||||
this.enablePostOverviewScreen = true,
|
||||
this.categorySelectionOpenPageBuilder,
|
||||
this.onPostCreate,
|
||||
});
|
||||
|
||||
/// The ID of the user associated with this user story configuration.
|
||||
|
@ -159,4 +160,6 @@ class TimelineUserStoryConfiguration {
|
|||
BuildContext context,
|
||||
Widget child,
|
||||
)? categorySelectionOpenPageBuilder;
|
||||
|
||||
final Function(TimelinePost post)? onPostCreate;
|
||||
}
|
||||
|
|
|
@ -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: 5.0.0
|
||||
version: 5.1.0
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
|
||||
environment:
|
||||
|
@ -14,11 +14,11 @@ dependencies:
|
|||
sdk: flutter
|
||||
flutter_timeline_view:
|
||||
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: ^5.0.0
|
||||
version: ^5.1.0
|
||||
|
||||
flutter_timeline_interface:
|
||||
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: ^5.0.0
|
||||
version: ^5.1.0
|
||||
collection: any
|
||||
|
||||
dev_dependencies:
|
||||
|
|
|
@ -1 +1 @@
|
|||
../../LICENSE
|
||||
[../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)
|
|
@ -1 +1 @@
|
|||
../../README.md
|
||||
[../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)
|
|
@ -245,10 +245,20 @@ class FirebaseTimelinePostService
|
|||
}
|
||||
|
||||
@override
|
||||
TimelinePost? getPost(String postId) =>
|
||||
(posts.any((element) => element.id == postId))
|
||||
? posts.firstWhere((element) => element.id == postId)
|
||||
: null;
|
||||
Future<TimelinePost?> getPost(String postId) async {
|
||||
var post = await _db
|
||||
.collection(_options.timelineCollectionName)
|
||||
.doc(postId)
|
||||
.withConverter<TimelinePost>(
|
||||
fromFirestore: (snapshot, _) => TimelinePost.fromJson(
|
||||
snapshot.id,
|
||||
snapshot.data()!,
|
||||
),
|
||||
toFirestore: (user, _) => user.toJson(),
|
||||
)
|
||||
.get();
|
||||
return post.data();
|
||||
}
|
||||
|
||||
@override
|
||||
List<TimelinePost> getPosts(String? category) => posts
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_timeline_firebase
|
||||
description: Implementation of the Flutter Timeline interface for Firebase.
|
||||
version: 5.0.0
|
||||
version: 5.1.0
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
|
||||
environment:
|
||||
|
@ -20,7 +20,7 @@ dependencies:
|
|||
collection: ^1.18.0
|
||||
flutter_timeline_interface:
|
||||
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: ^5.0.0
|
||||
version: ^5.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^2.0.0
|
||||
|
|
|
@ -1 +1 @@
|
|||
../../LICENSE
|
||||
[../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)
|
|
@ -1 +1 @@
|
|||
../../README.md
|
||||
[../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)
|
|
@ -18,7 +18,7 @@ abstract class TimelinePostService with ChangeNotifier {
|
|||
Future<List<TimelinePost>> fetchPosts(String? category);
|
||||
Future<TimelinePost> fetchPost(TimelinePost post);
|
||||
Future<List<TimelinePost>> fetchPostsPaginated(String? category, int limit);
|
||||
TimelinePost? getPost(String postId);
|
||||
Future<TimelinePost?> getPost(String postId);
|
||||
List<TimelinePost> getPosts(String? category);
|
||||
Future<List<TimelinePost>> refreshPosts(String? category);
|
||||
Future<TimelinePost> fetchPostDetails(TimelinePost post);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_timeline_interface
|
||||
description: Interface for the service of the Flutter Timeline component
|
||||
version: 5.0.0
|
||||
version: 5.1.0
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
|
||||
environment:
|
||||
|
|
|
@ -1 +1 @@
|
|||
../../CHANGELOG.md
|
||||
../../README.md
|
|
@ -1 +1 @@
|
|||
../../LICENSE
|
||||
[../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)
|
|
@ -1 +1 @@
|
|||
../../README.md
|
||||
[../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)
|
|
@ -146,7 +146,7 @@ class _TimelinePostCreationScreenState
|
|||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
widget.options.translations.content,
|
||||
style: theme.textTheme.titleMedium,
|
||||
|
@ -179,7 +179,7 @@ class _TimelinePostCreationScreenState
|
|||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
height: 24,
|
||||
),
|
||||
Text(
|
||||
widget.options.translations.uploadImage,
|
||||
|
@ -314,6 +314,9 @@ class _TimelinePostCreationScreenState
|
|||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Text(
|
||||
widget.options.translations.yes,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
|
@ -333,6 +336,9 @@ class _TimelinePostCreationScreenState
|
|||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Text(
|
||||
widget.options.translations.no,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
|
|
|
@ -409,12 +409,13 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
|
|||
post.content,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${dateFormat.format(post.createdAt)} ',
|
||||
style: theme.textTheme.labelSmall,
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 8),
|
||||
// ignore: avoid_bool_literals_in_conditional_expressions
|
||||
if (post.reactionEnabled && widget.isOverviewScreen != null
|
||||
? !widget.isOverviewScreen!
|
||||
|
@ -541,6 +542,7 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
|
|||
color: theme
|
||||
.textTheme.labelSmall!.color!
|
||||
.withOpacity(0.5),
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
|
||||
|
@ -657,7 +659,12 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
|
|||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8, right: 16),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8,
|
||||
right: 16,
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
),
|
||||
child: ReactionBottom(
|
||||
messageInputBuilder: textInputBuilder,
|
||||
onReactionSubmit: (reaction) async => updatePost(
|
||||
|
|
|
@ -101,7 +101,7 @@ class _TimelineSelectionScreenState extends State<TimelineSelectionScreen> {
|
|||
border: Border.all(
|
||||
color: widget
|
||||
.options.theme.categorySelectionButtonBorderColor ??
|
||||
Theme.of(context).primaryColor,
|
||||
const Color(0xFF9E9E9E),
|
||||
width: 2,
|
||||
),
|
||||
color: widget
|
||||
|
|
|
@ -124,10 +124,11 @@ class LocalTimelinePostService
|
|||
}
|
||||
|
||||
@override
|
||||
TimelinePost? getPost(String postId) =>
|
||||
(posts.any((element) => element.id == postId))
|
||||
? posts.firstWhere((element) => element.id == postId)
|
||||
: null;
|
||||
Future<TimelinePost?> getPost(String postId) => Future.value(
|
||||
(posts.any((element) => element.id == postId))
|
||||
? posts.firstWhere((element) => element.id == postId)
|
||||
: null,
|
||||
);
|
||||
|
||||
@override
|
||||
List<TimelinePost> getPosts(String? category) => posts
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_timeline_view
|
||||
description: Visual elements of the Flutter Timeline Component
|
||||
version: 5.0.0
|
||||
version: 5.1.0
|
||||
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
|
||||
environment:
|
||||
|
@ -20,7 +20,7 @@ dependencies:
|
|||
flutter_svg: ^2.0.10+1
|
||||
flutter_timeline_interface:
|
||||
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: ^5.0.0
|
||||
version: ^5.1.0
|
||||
flutter_image_picker:
|
||||
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
|
||||
version: ^4.0.0
|
||||
|
|
Loading…
Reference in a new issue