From bca15b63073f917889bbdb163648f8b7b8fac112 Mon Sep 17 00:00:00 2001 From: Freek van de Ven Date: Tue, 21 May 2024 14:16:18 +0200 Subject: [PATCH] feat: use adaptive elements --- CHANGELOG.md | 1 + .../lib/src/flutter_timeline_gorouter_userstory.dart | 7 ++++++- .../lib/src/screens/timeline_post_screen.dart | 4 ++-- .../lib/src/screens/timeline_screen.dart | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b413cb1..c04412a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Add a postCreationFloatingActionButtonColor to the timeline theme to set the color of the floating action button - Add a post and a category to the postViewOpenPageBuilder function - Add a refresh functionality to the timeline with a pull to refresh callback to allow additional functionality when refreshing the timeline +- Use the adaptive variants of the material elements in the timeline ## 3.0.1 diff --git a/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart b/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart index 88a3927..44140bf 100644 --- a/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart +++ b/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart @@ -166,7 +166,12 @@ List getTimelineStoryRoutes({ context: context, state: state, child: config.postViewOpenPageBuilder?.call( - context, timelinePostWidget, backButton, post, category) ?? + context, + timelinePostWidget, + backButton, + post, + category, + ) ?? Scaffold( appBar: AppBar( leading: backButton, diff --git a/packages/flutter_timeline_view/lib/src/screens/timeline_post_screen.dart b/packages/flutter_timeline_view/lib/src/screens/timeline_post_screen.dart index 6b3c004..24cd9b0 100644 --- a/packages/flutter_timeline_view/lib/src/screens/timeline_post_screen.dart +++ b/packages/flutter_timeline_view/lib/src/screens/timeline_post_screen.dart @@ -146,7 +146,7 @@ class _TimelinePostScreenState extends State<_TimelinePostScreen> { if (isLoading) { const Center( - child: CircularProgressIndicator(), + child: CircularProgressIndicator.adaptive(), ); } if (this.post == null) { @@ -166,7 +166,7 @@ class _TimelinePostScreenState extends State<_TimelinePostScreen> { return Stack( children: [ - RefreshIndicator( + RefreshIndicator.adaptive( onRefresh: () async { updatePost( await widget.service.postService.fetchPostDetails( diff --git a/packages/flutter_timeline_view/lib/src/screens/timeline_screen.dart b/packages/flutter_timeline_view/lib/src/screens/timeline_screen.dart index cdebf17..b3bf895 100644 --- a/packages/flutter_timeline_view/lib/src/screens/timeline_screen.dart +++ b/packages/flutter_timeline_view/lib/src/screens/timeline_screen.dart @@ -108,7 +108,7 @@ class _TimelineScreenState extends State { @override Widget build(BuildContext context) { if (isLoading && widget.posts == null) { - return const Center(child: CircularProgressIndicator()); + return const Center(child: CircularProgressIndicator.adaptive()); } // Build the list of posts @@ -222,7 +222,7 @@ class _TimelineScreenState extends State { height: 12, ), Expanded( - child: RefreshIndicator( + child: RefreshIndicator.adaptive( onRefresh: () async { await widget.onRefresh?.call(context, category); await loadPosts();