Skip to content

Commit

Permalink
Merge branch 'develop' into Ayush0Chaudhary/hashtag
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush0Chaudhary committed Oct 18, 2023
2 parents b5a774a + dfbf1d2 commit 1629136
Show file tree
Hide file tree
Showing 15 changed files with 354 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: './coverage/lcov.info'
min_coverage: 78.0
min_coverage: 76.0

Android-Build:
name: Testing build for android
Expand Down
2 changes: 1 addition & 1 deletion lib/apptheme.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';

/// Apptheme class.
///
Expand All @@ -13,6 +12,7 @@ class AppTheme {
fontWeight: FontWeight.w600,
color: blackPrimary,
fontFamily: 'OpenSans',
decorationThickness: 0,
);

/// Custom theme for the app.
Expand Down
3 changes: 3 additions & 0 deletions lib/constants/routing_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,7 @@ class Routes {

/// static variables.
static const String selectContact = '/selectContact';

/// static variable to access pinnedpostscreen.
static const String pinnedPostScreen = '/pinnedpostscreen';
}
8 changes: 8 additions & 0 deletions lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import 'package:talawa/views/after_auth_screens/events/explore_events.dart';
import 'package:talawa/views/after_auth_screens/feed/individual_post.dart';
import 'package:talawa/views/after_auth_screens/feed/organization_feed.dart';
import 'package:talawa/views/after_auth_screens/feed/pinned_post_page.dart';
import 'package:talawa/views/after_auth_screens/feed/pinned_post_screen.dart';
import 'package:talawa/views/after_auth_screens/join_org_after_auth/access_request_screen.dart';
import 'package:talawa/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart';
import 'package:talawa/views/after_auth_screens/profile/edit_profile_page.dart';
Expand Down Expand Up @@ -223,7 +224,14 @@ Route<dynamic> generateRoute(RouteSettings settings) {
event: event,
),
);
case Routes.pinnedPostScreen:
// final Map<String, dynamic> post = settings.arguments! as Map<String, dynamic> ;
final Map<String, String> post =
settings.arguments! as Map<String, String>;

return MaterialPageRoute(
builder: (context) => PinnedPostScreen(post: post),
);
// Returns the AppSettingsPage Widget
case Routes.appSettings:
return MaterialPageRoute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class AddPostViewModel extends BaseModel {
/// **returns**:
/// * `Future<void>`: Uploading post by contacting queries
Future<void> uploadPost() async {
// {TODO: }
// {TODO: Image not getting uploaded}
if (_imageFile == null) {
try {
await _dbFunctions.gqlAuthMutation(
Expand Down
11 changes: 2 additions & 9 deletions lib/views/after_auth_screens/feed/organization_feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart';
import 'package:talawa/view_model/main_screen_view_model.dart';
import 'package:talawa/views/base_view.dart';
import 'package:talawa/widgets/pinned_carousel_widget.dart';
import 'package:talawa/widgets/pinned_post.dart';
import 'package:talawa/widgets/post_list_widget.dart';

/// OrganizationFeed returns a widget that shows the feed of the organization.
Expand Down Expand Up @@ -61,14 +61,7 @@ class OrganizationFeed extends StatelessWidget {
children: [
// If the organization has pinned posts then renders PinnedPostCarousel widget else Container.
model.pinnedPosts.isNotEmpty
? PinnedPostCarousel(
key: homeModel?.keySHPinnedPost,
pinnedPosts: model.pinnedPosts,
navigateToPinnedPostPage:
model.navigateToPinnedPostPage,
navigateToIndividualPostPage:
model.navigateToIndividualPage,
)
? PinnedPost(pinnedPost: model.pinnedPosts)
: Container(),
// If the organization has posts then renders PostListWidget widget else Container.
model.posts.isNotEmpty
Expand Down
68 changes: 68 additions & 0 deletions lib/views/after_auth_screens/feed/pinned_post_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:talawa/apptheme.dart';

import 'package:talawa/services/size_config.dart';

class PinnedPostScreen extends StatefulWidget {
const PinnedPostScreen({super.key, required this.post});
final Map<String, String> post;

@override
State<PinnedPostScreen> createState() => _PinnedPostScreenState();
}

class _PinnedPostScreenState extends State<PinnedPostScreen> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Container(
decoration: const BoxDecoration(color: Colors.black38),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(18.0),
child: Text(
widget.post['title']!,
maxLines: 2,
style: AppTheme.title.copyWith(
color: Colors.white,
decorationThickness: 0,
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'${widget.post['time']!}hr',
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w200,
fontSize: 14,
decorationThickness: 0,
),
),
),
],
),
CachedNetworkImage(
cacheKey: widget.post['postId'],
imageUrl: (widget.post['imageUrl'] ?? '').isEmpty
? 'placeHolderUrl'
: widget.post['imageUrl']!,
errorWidget: (context, url, error) {
return const CircularProgressIndicator();
},
height: SizeConfig.screenHeight! * .75,
fit: BoxFit.cover,
),
],
),
),
);
}
}
148 changes: 148 additions & 0 deletions lib/widgets/pinned_post.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:talawa/locator.dart';
import 'package:talawa/models/post/post_model.dart';
import 'package:talawa/services/size_config.dart';

/// a_line_ending_with_end_punctuation.
///
/// more_info_if_required
class PinnedPost extends StatelessWidget {
const PinnedPost({super.key, required this.pinnedPost});
final List<Post> pinnedPost;
static const List<Map<String, String>> pinnedPosts = [
{
'title': 'Church Meeting',
'postId': 'hdkahfu567',
'imageUrl':
'https://i2-prod.manchestereveningnews.co.uk/incoming/article25630061.ece/ALTERNATES/s615/2_Church-PA.jpg',
'time': '1',
},
{
'title': 'Russia-Ukraine war leads to Hike in Gas prices in Europe.',
'postId': 'hfkajhk669',
'imageUrl':
'https://gdb.voanews.com/3B960F7F-786C-452C-8ABD-9D5AEEAED9D9.jpg',
'time': '3',
},
{
'title': 'Flood in near village.',
'postId': 'adadada555',
'imageUrl':
'https://www.deccanherald.com/sites/dh/files/styles/article_detail/public/articleimages/2022/08/03/file7m4trf3i92e1krs53cn6-1132513-1659475940.jpg?itok=oVs3TTP8',
'time': '3',
},
{
'title': 'The craze behind auto-tech stocks.',
'postId': 'nvikaebkf',
'imageUrl':
'https://akm-img-a-in.tosshub.com/businesstoday/images/assets/202303/stock-market-02136-4-sixteen_nine.jpg',
'time': '7',
},
{
'title': 'High seas treaty',
'postId': 'nfqbkbd',
'imageUrl':
'https://ichef.bbci.co.uk/news/976/cpsprodpb/A194/production/_128846314_humpbackwhale.jpg',
'time': '5',
},
{
'title': 'WWE Wrestking and Gambling',
'postId': 'dadadada',
'imageUrl':
'https://staticc.sportskeeda.com/editor/2023/03/a9b3a-16783664764772-1920.jpg',
'time': '6',
},
{
'title': 'Dead of Silicon Valley Bank.',
'postId': 'hfkaaddadajhk669',
'imageUrl':
'https://thechainsaw.com/wp-content/uploads/2023/03/2023-50.jpg?w=1200',
'time': '7',
},
{
'title': 'What if women were paid for chores',
'postId': 'kofapjfn',
'imageUrl':
'https://www.shethepeople.tv/wp-content/uploads/2019/06/household.png',
'time': '8',
},
{
'title': 'Debate over stocks bybacks.',
'postId': 'agdjvfhsjaf',
'imageUrl':
'https://m.wsj.net/video/20200105/wsjglossarystockbuybackssplash/wsjglossarystockbuybackssplash_640x360.jpg',
'time': '9',
},
];

@override
Widget build(BuildContext context) {
return Container(
child: pinnedPosts.isNotEmpty
? SizedBox(
height: SizeConfig.screenHeight! * 0.25,
child: ListView.builder(
itemCount: pinnedPosts.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.only(
left: 10,
),
child: GestureDetector(
onTap: () {
// final Map<String, dynamic> arg = {"index": "$index","post": pinnedPosts};
navigationService.pushScreen(
'/pinnedpostscreen',
arguments: pinnedPosts[index],
);
},
child: SizedBox(
width: SizeConfig.screenWidth! / 4.1,
child: Column(
children: [
CachedNetworkImage(
cacheKey: pinnedPosts[index]['postId'],
imageUrl:
(pinnedPosts[index]['imageUrl'] ?? '').isEmpty
? 'placeHolderUrl'
: pinnedPosts[index]['imageUrl']!,
errorWidget: (context, url, error) {
return const CircularProgressIndicator();
},
height: SizeConfig.screenHeight! * 0.15,
fit: BoxFit.cover,
),
const SizedBox(height: 5),
Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'${pinnedPosts[index]['time']!}hr',
style: const TextStyle(
color: Colors.grey,
fontWeight: FontWeight.w200,
),
),
),
],
),
const SizedBox(height: 5),
Text(
pinnedPosts[index]['title']!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
),
),
)
: Container(),
);
}
}
Loading

0 comments on commit 1629136

Please sign in to comment.