-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
Made the posts UI better #2218
Made the posts UI better #2218
Changes from 14 commits
c1cedd1
ecb823a
e303685
2cbc4a6
db5e267
69db8de
bc8037a
b49ad3c
1ad1621
ce81c1f
c15a04c
2b59db3
3869247
973d320
e5bfb94
7b5b05f
7033e9e
79f5b13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,25 @@ | |
import 'package:talawa/enums/enums.dart'; | ||
import 'package:talawa/locator.dart'; | ||
import 'package:talawa/models/options/options.dart'; | ||
import 'package:talawa/models/organization/org_info.dart'; | ||
import 'package:talawa/models/post/post_model.dart'; | ||
import 'package:talawa/models/user/user_info.dart'; | ||
import 'package:talawa/plugins/talawa_plugin_provider.dart'; | ||
import 'package:talawa/services/size_config.dart'; | ||
import 'package:talawa/utils/app_localization.dart'; | ||
import 'package:talawa/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart'; | ||
import 'package:talawa/view_model/main_screen_view_model.dart'; | ||
import 'package:talawa/views/after_auth_screens/feed/individual_post.dart'; | ||
import 'package:talawa/views/base_view.dart'; | ||
import 'package:talawa/widgets/custom_avatar.dart'; | ||
import 'package:talawa/widgets/custom_list_tile.dart'; | ||
import 'package:talawa/widgets/from_palisadoes.dart'; | ||
import 'package:talawa/widgets/raised_round_edge_button.dart'; | ||
|
||
/// ProfilePage returns a widget that renders a page of user's profile. | ||
// ignore: must_be_immutable | ||
class ProfilePage extends StatelessWidget { | ||
const ProfilePage({ | ||
ProfilePage({ | ||
required Key key, | ||
this.homeModel, | ||
}) : super(key: key); | ||
|
@@ -28,6 +33,40 @@ | |
/// | ||
final MainScreenViewModel? homeModel; | ||
|
||
/// a_line_ending_with_end_punctuation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Write a meaningful documentation here. Moreover, any mock data should be outside the component. If necessary, create a new file for this. |
||
/// | ||
/// more_info_if_required | ||
Post samplePost = Post( | ||
sId: '123', | ||
description: 'This is a sample post description.', | ||
createdAt: DateTime.now().subtract(const Duration(days: 2)), | ||
imageUrl: | ||
'https://images.unsplash.com/photo-1701725313832-d8f7fadb3006?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzfHx8ZW58MHx8fHx8', | ||
base64String: 'base64encodedstring', | ||
videoUrl: 'https://example.com/sample_video.mp4', | ||
creator: User( | ||
id: 'user123', | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
email: 'john.doe@example.com', | ||
image: 'https://example.com/user_avatar.jpg', | ||
), | ||
organization: OrgInfo( | ||
id: 'org456', | ||
name: 'Sample Organization', | ||
description: 'This is a sample organization.', | ||
image: 'https://example.com/org_logo.png', | ||
), | ||
likedBy: [ | ||
LikedBy(sId: 'like123'), | ||
LikedBy(sId: 'like456'), | ||
], | ||
comments: [ | ||
Comments(sId: 'comment123'), | ||
Comments(sId: 'comment456'), | ||
], | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return BaseView<ProfilePageViewModel>( | ||
|
@@ -204,20 +243,7 @@ | |
const Tab(text: 'Tasks'), | ||
], | ||
views: [ | ||
ColoredBox( | ||
color: Theme.of(context).colorScheme.background, | ||
child: GridView.count( | ||
mainAxisSpacing: 5, | ||
crossAxisCount: 3, | ||
children: [ | ||
Image.asset('assets/images/pfp2.jpeg'), | ||
Image.asset('assets/images/pfp2.jpeg'), | ||
Image.asset('assets/images/pfp2.jpeg'), | ||
Image.asset('assets/images/pfp2.jpeg'), | ||
Image.asset('assets/images/pfp2.jpeg'), | ||
], | ||
), | ||
), | ||
IndividualPostView(post: samplePost), | ||
noman2002 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still not covered. Connect with @Ayush0Chaudhary or @Dante291, anyone will help you out. |
||
Container( | ||
color: Theme.of(context).colorScheme.background, | ||
), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:talawa/services/size_config.dart'; | ||
import '../../../helpers/test_helpers.dart'; | ||
import '../../../helpers/test_locator.dart'; | ||
import '../feed/individual_post_test.dart'; | ||
|
||
// ... (other imports) | ||
|
||
/// a_line_ending_with_end_punctuation. | ||
/// | ||
/// more_info_if_required | ||
/// | ||
/// **params**: | ||
/// None | ||
/// | ||
/// **returns**: | ||
/// None | ||
void main() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation for |
||
SizeConfig().test(); | ||
testSetupLocator(); | ||
|
||
setUp(() { | ||
registerServices(); | ||
}); | ||
|
||
group('Test for likedUserCircleAvatar', () { | ||
testWidgets('Check if the likedUserCircleAvatar shows up', (tester) async { | ||
await tester.pumpWidget(createLikedUserCircleAvatarWidget()); | ||
await tester.pump(); | ||
|
||
final findStack = find.byType(Stack); | ||
|
||
expect(findStack, findsNWidgets(2)); | ||
}); | ||
}); | ||
|
||
group('Test for IndividualPageLikeSection', () { | ||
testWidgets('Check if the IndividualPageLikeSection shows up', | ||
(tester) async { | ||
await tester.pumpWidget(createIndividualPageLikeSectionWidget()); | ||
await tester.pump(); | ||
|
||
final findColumn = find.byType(Column); | ||
|
||
expect(findColumn, findsNWidgets(1)); | ||
}); | ||
|
||
testWidgets( | ||
'Check if the likedUserCircleAvatar in IndividualPageLikeSection shows up', | ||
(tester) async { | ||
await tester.pumpWidget(createIndividualPageLikeSectionWidget()); | ||
await tester.pump(); | ||
|
||
final findStack = find.byType(Stack); | ||
|
||
expect(findStack, findsNWidgets(5)); | ||
}); | ||
}); | ||
|
||
group('Test for CommentTemplate', () { | ||
testWidgets('Check if the CommentTemplate shows up', (tester) async { | ||
await tester.pumpWidget(createCommentTemplateWidget()); | ||
await tester.pump(); | ||
|
||
final findStack = find.byType(Row); | ||
|
||
expect(findStack, findsNWidgets(1)); | ||
}); | ||
|
||
testWidgets('Check if the name is displayed in CommentTemplate', | ||
(tester) async { | ||
await tester.pumpWidget(createCommentTemplateWidget()); | ||
await tester.pump(); | ||
|
||
final findStack = find.text('Ayush Chaudhary'); | ||
|
||
expect(findStack, findsNWidgets(1)); | ||
}); | ||
|
||
testWidgets('Check if the comment text is displayed in CommentTemplate', | ||
(tester) async { | ||
await tester.pumpWidget(createCommentTemplateWidget()); | ||
await tester.pump(); | ||
|
||
final findStack = find.text('test text'); | ||
|
||
expect(findStack, findsNWidgets(1)); | ||
}); | ||
}); | ||
|
||
// Add more test groups for other widgets | ||
|
||
// group('Individualpostview tests', () { | ||
// testWidgets("Check if the IndividualPostView shows up", (WidgetTester tester) async { | ||
// // ... (your existing test code) | ||
// }); | ||
// }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove dummy data as suggested and mark this class as const again. Having const classes improves performance; we should not remove them unnecessarily.