fix: feedback

This commit is contained in:
mike doornenbal 2024-08-14 15:10:55 +02:00
parent 02c136d7ea
commit 38bb41ce10
23 changed files with 87 additions and 36 deletions

View file

@ -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 ## 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

1
packages/cd Symbolic link
View file

@ -0,0 +1 @@
cd

View file

@ -1 +1 @@
../../LICENSE [../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)

View file

@ -1 +1 @@
../../README.md [../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)

View file

@ -10,11 +10,13 @@ import 'package:flutter_timeline/flutter_timeline.dart';
/// This function creates a navigator for displaying user stories on a timeline. /// This function creates a navigator for displaying user stories on a timeline.
/// It takes a [BuildContext] and an optional [TimelineUserStoryConfiguration] /// It takes a [BuildContext] and an optional [TimelineUserStoryConfiguration]
/// as parameters. If no configuration is provided, default values will be used. /// as parameters. If no configuration is provided, default values will be used.
late TimelineUserStoryConfiguration timelineUserStoryConfiguration;
Widget timeLineNavigatorUserStory({ Widget timeLineNavigatorUserStory({
required BuildContext context, required BuildContext context,
TimelineUserStoryConfiguration? configuration, TimelineUserStoryConfiguration? configuration,
}) { }) {
var config = configuration ?? timelineUserStoryConfiguration = configuration ??
TimelineUserStoryConfiguration( TimelineUserStoryConfiguration(
userId: 'test_user', userId: 'test_user',
service: TimelineService( service: TimelineService(
@ -23,7 +25,10 @@ Widget timeLineNavigatorUserStory({
optionsBuilder: (context) => const TimelineOptions(), 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. /// A widget function that creates a timeline screen route.
@ -262,7 +267,8 @@ Widget _postOverviewScreenRoute({
service: config.service, service: config.service,
timelinePost: post, timelinePost: post,
onPostSubmit: (post) async { onPostSubmit: (post) async {
await config.service.postService.createPost(post); var createdPost = await config.service.postService.createPost(post);
config.onPostCreate?.call(createdPost);
if (context.mounted) { if (context.mounted) {
await Navigator.of(context).pushAndRemoveUntil( await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute( MaterialPageRoute(
@ -354,3 +360,15 @@ Widget _postCategorySelectionScreen({
body: timelineSelectionScreen, 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,
),
),
);
}

View file

@ -65,6 +65,7 @@ class TimelineUserStoryConfiguration {
this.afterPostCreationGoHome = false, this.afterPostCreationGoHome = false,
this.enablePostOverviewScreen = true, this.enablePostOverviewScreen = true,
this.categorySelectionOpenPageBuilder, this.categorySelectionOpenPageBuilder,
this.onPostCreate,
}); });
/// The ID of the user associated with this user story configuration. /// The ID of the user associated with this user story configuration.
@ -159,4 +160,6 @@ class TimelineUserStoryConfiguration {
BuildContext context, BuildContext context,
Widget child, Widget child,
)? categorySelectionOpenPageBuilder; )? categorySelectionOpenPageBuilder;
final Function(TimelinePost post)? onPostCreate;
} }

View file

@ -3,7 +3,7 @@
# 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: 5.0.0 version: 5.1.0
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
@ -14,11 +14,11 @@ dependencies:
sdk: flutter sdk: flutter
flutter_timeline_view: flutter_timeline_view:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^5.0.0 version: ^5.1.0
flutter_timeline_interface: flutter_timeline_interface:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^5.0.0 version: ^5.1.0
collection: any collection: any
dev_dependencies: dev_dependencies:

View file

@ -1 +1 @@
../../LICENSE [../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)

View file

@ -1 +1 @@
../../README.md [../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)

View file

@ -245,10 +245,20 @@ class FirebaseTimelinePostService
} }
@override @override
TimelinePost? getPost(String postId) => Future<TimelinePost?> getPost(String postId) async {
(posts.any((element) => element.id == postId)) var post = await _db
? posts.firstWhere((element) => element.id == postId) .collection(_options.timelineCollectionName)
: null; .doc(postId)
.withConverter<TimelinePost>(
fromFirestore: (snapshot, _) => TimelinePost.fromJson(
snapshot.id,
snapshot.data()!,
),
toFirestore: (user, _) => user.toJson(),
)
.get();
return post.data();
}
@override @override
List<TimelinePost> getPosts(String? category) => posts List<TimelinePost> getPosts(String? category) => posts

View file

@ -4,7 +4,7 @@
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: 5.0.0 version: 5.1.0
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
@ -20,7 +20,7 @@ dependencies:
collection: ^1.18.0 collection: ^1.18.0
flutter_timeline_interface: flutter_timeline_interface:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^5.0.0 version: ^5.1.0
dev_dependencies: dev_dependencies:
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0

View file

@ -1 +1 @@
../../LICENSE [../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)

View file

@ -1 +1 @@
../../README.md [../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)

View file

@ -18,7 +18,7 @@ abstract class TimelinePostService with ChangeNotifier {
Future<List<TimelinePost>> fetchPosts(String? category); Future<List<TimelinePost>> fetchPosts(String? category);
Future<TimelinePost> fetchPost(TimelinePost post); Future<TimelinePost> fetchPost(TimelinePost post);
Future<List<TimelinePost>> fetchPostsPaginated(String? category, int limit); Future<List<TimelinePost>> fetchPostsPaginated(String? category, int limit);
TimelinePost? getPost(String postId); Future<TimelinePost?> getPost(String postId);
List<TimelinePost> getPosts(String? category); List<TimelinePost> getPosts(String? category);
Future<List<TimelinePost>> refreshPosts(String? category); Future<List<TimelinePost>> refreshPosts(String? category);
Future<TimelinePost> fetchPostDetails(TimelinePost post); Future<TimelinePost> fetchPostDetails(TimelinePost post);

View file

@ -4,7 +4,7 @@
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: 5.0.0 version: 5.1.0
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:

View file

@ -1 +1 @@
../../CHANGELOG.md ../../README.md

View file

@ -1 +1 @@
../../LICENSE [../../LICENSE](https://github.com/Iconica-Development/flutter_timeline/blob/master/LICENSE)

View file

@ -1 +1 @@
../../README.md [../../README.md](https://github.com/Iconica-Development/flutter_timeline/blob/master/README.md)

View file

@ -146,7 +146,7 @@ class _TimelinePostCreationScreenState
return null; return null;
}, },
), ),
const SizedBox(height: 16), const SizedBox(height: 24),
Text( Text(
widget.options.translations.content, widget.options.translations.content,
style: theme.textTheme.titleMedium, style: theme.textTheme.titleMedium,
@ -179,7 +179,7 @@ class _TimelinePostCreationScreenState
}, },
), ),
const SizedBox( const SizedBox(
height: 16, height: 24,
), ),
Text( Text(
widget.options.translations.uploadImage, widget.options.translations.uploadImage,
@ -314,6 +314,9 @@ class _TimelinePostCreationScreenState
}); });
}, },
), ),
const SizedBox(
width: 4,
),
Text( Text(
widget.options.translations.yes, widget.options.translations.yes,
style: theme.textTheme.bodyMedium, style: theme.textTheme.bodyMedium,
@ -333,6 +336,9 @@ class _TimelinePostCreationScreenState
}); });
}, },
), ),
const SizedBox(
width: 4,
),
Text( Text(
widget.options.translations.no, widget.options.translations.no,
style: theme.textTheme.bodyMedium, style: theme.textTheme.bodyMedium,

View file

@ -409,12 +409,13 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
post.content, post.content,
style: theme.textTheme.bodySmall, style: theme.textTheme.bodySmall,
), ),
const SizedBox(height: 4),
Text( Text(
'${dateFormat.format(post.createdAt)} ', '${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 // ignore: avoid_bool_literals_in_conditional_expressions
if (post.reactionEnabled && widget.isOverviewScreen != null if (post.reactionEnabled && widget.isOverviewScreen != null
? !widget.isOverviewScreen! ? !widget.isOverviewScreen!
@ -541,6 +542,7 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
color: theme color: theme
.textTheme.labelSmall!.color! .textTheme.labelSmall!.color!
.withOpacity(0.5), .withOpacity(0.5),
letterSpacing: 0.5,
), ),
), ),
@ -657,7 +659,12 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
), ),
Flexible( Flexible(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 8, right: 16), padding: const EdgeInsets.only(
left: 8,
right: 16,
top: 8,
bottom: 8,
),
child: ReactionBottom( child: ReactionBottom(
messageInputBuilder: textInputBuilder, messageInputBuilder: textInputBuilder,
onReactionSubmit: (reaction) async => updatePost( onReactionSubmit: (reaction) async => updatePost(

View file

@ -101,7 +101,7 @@ class _TimelineSelectionScreenState extends State<TimelineSelectionScreen> {
border: Border.all( border: Border.all(
color: widget color: widget
.options.theme.categorySelectionButtonBorderColor ?? .options.theme.categorySelectionButtonBorderColor ??
Theme.of(context).primaryColor, const Color(0xFF9E9E9E),
width: 2, width: 2,
), ),
color: widget color: widget

View file

@ -124,10 +124,11 @@ class LocalTimelinePostService
} }
@override @override
TimelinePost? getPost(String postId) => Future<TimelinePost?> getPost(String postId) => Future.value(
(posts.any((element) => element.id == postId)) (posts.any((element) => element.id == postId))
? posts.firstWhere((element) => element.id == postId) ? posts.firstWhere((element) => element.id == postId)
: null; : null,
);
@override @override
List<TimelinePost> getPosts(String? category) => posts List<TimelinePost> getPosts(String? category) => posts

View file

@ -4,7 +4,7 @@
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: 5.0.0 version: 5.1.0
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
@ -20,7 +20,7 @@ dependencies:
flutter_svg: ^2.0.10+1 flutter_svg: ^2.0.10+1
flutter_timeline_interface: flutter_timeline_interface:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^5.0.0 version: ^5.1.0
flutter_image_picker: flutter_image_picker:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^4.0.0 version: ^4.0.0