@@ -20,60 +20,57 @@ class ProfileScreen extends StatelessWidget {
2020
2121 @override
2222 Widget build (BuildContext context) {
23- return BlocProvider (
24- create: (context) => ProfileBloc ()..add (const FetchDetails ()),
25- child: BlocConsumer <ProfileBloc , ProfileState >(
26- listenWhen: (previous, current) =>
27- previous.status.hashCode != current.status.hashCode,
28- listener: (context, state) {
29- if (state.status is Error ) {
30- showSnackBar (message: AppStrings .genericError);
31- }
32- },
33- // When Loading state changes
34- buildWhen: (previous, current) =>
35- previous.status.hashCode != current.status.hashCode ||
36- previous.showFollowing ^ current.showFollowing,
37- builder: (context, state) {
38- if (state.status is Loading || state.status is Error ) {
39- return const ProfileLoadingState ();
40- }
23+ return BlocConsumer <ProfileBloc , ProfileState >(
24+ listenWhen: (previous, current) =>
25+ previous.status.hashCode != current.status.hashCode,
26+ listener: (context, state) {
27+ if (state.status is Error ) {
28+ showSnackBar (message: AppStrings .genericError);
29+ }
30+ },
31+ // When Loading state changes
32+ buildWhen: (previous, current) =>
33+ previous.status.hashCode != current.status.hashCode ||
34+ previous.showFollowing ^ current.showFollowing,
35+ builder: (context, state) {
36+ if (state.status is Loading || state.status is Error ) {
37+ return const ProfileLoadingState ();
38+ }
4139
42- if (state.showFollowing) return const FollowingView ();
40+ if (state.showFollowing) return const FollowingView ();
4341
44- return ListView (
45- children: [
46- const ProfileHeader (),
47- Padding (
48- padding: EdgeInsets .fromLTRB (16. w, 24. h, 0 , 8. h),
49- child: Text (
50- 'Accuracy' ,
51- style: AppStyles .h1.copyWith (fontSize: 15. sp),
52- ),
42+ return ListView (
43+ children: [
44+ const ProfileHeader (),
45+ Padding (
46+ padding: EdgeInsets .fromLTRB (16. w, 24. h, 0 , 8. h),
47+ child: Text (
48+ 'Accuracy' ,
49+ style: AppStyles .h1.copyWith (fontSize: 15. sp),
5350 ),
54- const AccuracyDisplay ( ),
55- SizedBox (height : 30. h ),
56- Padding (
57- padding : EdgeInsets . only (left : 16. w, top : 24. h),
58- child : Text (
59- 'Number of question solved' ,
60- style : AppStyles .h1. copyWith (fontSize : 15. sp) ,
61- ),
51+ ),
52+ const AccuracyDisplay ( ),
53+ SizedBox (height : 30. h),
54+ Padding (
55+ padding : EdgeInsets . only (left : 16. w, top : 24. h),
56+ child : Text (
57+ 'Number of question solved' ,
58+ style : AppStyles .h1. copyWith (fontSize : 15. sp ),
6259 ),
63- const QuestionSolved ( ),
64- Padding (
65- padding : EdgeInsets . only (left : 16. w, top : 24. h),
66- child : Text (
67- 'Status of total Submissions' ,
68- style : AppStyles .h1. copyWith (fontSize : 15. sp) ,
69- ),
60+ ),
61+ const QuestionSolved (),
62+ Padding (
63+ padding : EdgeInsets . only (left : 16. w, top : 24. h),
64+ child : Text (
65+ 'Status of total Submissions' ,
66+ style : AppStyles .h1. copyWith (fontSize : 15. sp ),
7067 ),
71- const SubmissionDisplay ( ),
72- const AcceptanceGraph (),
73- ] ,
74- );
75- },
76- ) ,
68+ ),
69+ const SubmissionDisplay (),
70+ const AcceptanceGraph () ,
71+ ],
72+ );
73+ } ,
7774 );
7875 }
7976}
0 commit comments