Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed loading indicator in the pinned_post and organization feed (pinned_post_screen) and made it circular and normal indicator. #2426

Closed
wants to merge 12 commits into from
Closed
16 changes: 15 additions & 1 deletion lib/views/after_auth_screens/feed/pinned_post_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,21 @@ class _PinnedPostScreenState extends State<PinnedPostScreen> {
cacheManager: widget.cacheManager,
imageUrl: widget.post['imageUrl']!,
errorWidget: (context, url, error) {
return const CircularProgressIndicator();
return Center(
child: Container(
width: SizeConfig.safeBlockHorizontal! * 16,
// Adjust the width to change the size of the circular indicator
height: SizeConfig.safeBlockVertical! * 8,
// Adjust the height to change the size of the circular indicator
child: AspectRatio(
aspectRatio: 1.0,
// Maintain a 1:1 aspect ratio for a circular shape
child: CircularProgressIndicator(
strokeWidth: 4.0,
),
),
),
);
M-SAI-SOORYA marked this conversation as resolved.
Show resolved Hide resolved
},
height: SizeConfig.screenHeight! * .75,
fit: BoxFit.cover,
Expand Down
16 changes: 15 additions & 1 deletion lib/widgets/pinned_post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,21 @@ class PinnedPost extends StatelessWidget {
? 'placeHolderUrl'
: pinnedPost[index].imageUrl!,
errorWidget: (context, url, error) {
return const CircularProgressIndicator();
return Center(
child: Container(
width: SizeConfig.safeBlockHorizontal! * 8,
// Adjust the width to change the size of the circular indicator
height: SizeConfig.safeBlockVertical! * 4,
// Adjust the height to change the size of the circular indicator
child: AspectRatio(
aspectRatio: 1.0,
// Maintain a 1:1 aspect ratio for a circular shape
child: CircularProgressIndicator(
strokeWidth: 2.0,
),
),
),
);
M-SAI-SOORYA marked this conversation as resolved.
Show resolved Hide resolved
},
height: SizeConfig.screenHeight! * 0.15,
fit: BoxFit.cover,
Expand Down
41 changes: 30 additions & 11 deletions test/widget_tests/widgets/pinned_post_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,36 @@ void main() {
await widgetTester.pump(const Duration(seconds: 5));

expect(
find.byWidgetPredicate(
(widget) =>
widget is CachedNetworkImage &&
widget.errorWidget != null &&
widget.errorWidget is Function &&
widget.errorWidget!(
widgetTester.binding.rootElement!,
'',
Exception(),
) is CircularProgressIndicator,
),
find.byWidgetPredicate((widget) =>
widget is CachedNetworkImage &&
widget.errorWidget != null &&
widget.errorWidget is Function &&
widget.errorWidget!(
widgetTester.binding.rootElement!,
'',
Exception(),
) is Center &&
(widget.errorWidget!(
widgetTester.binding.rootElement!,
'',
Exception(),
) as Center)
.child is Container &&
((widget.errorWidget!(
widgetTester.binding.rootElement!,
'',
Exception(),
) as Center)
.child as Container)
.child is AspectRatio &&
(((widget.errorWidget!(
widgetTester.binding.rootElement!,
'',
Exception(),
) as Center)
.child as Container)
.child as AspectRatio)
.child is CircularProgressIndicator),
findsOneWidget,
);
});
Expand Down
Loading