diff --git a/lib/Common/api_urls.dart b/lib/Common/api_urls.dart index 11613b9..637a92b 100644 --- a/lib/Common/api_urls.dart +++ b/lib/Common/api_urls.dart @@ -91,14 +91,14 @@ class ApiUrls { static const getblockuser = "${baseUrl}fetch-blocked-profile"; static const postblockuser = "${baseUrl}block-profile"; + static const latestpost = "${baseUrl}fetch-latest-post"; + static const tagcommunityuser = "${baseUrl}fetch-communities-tags-to-pin"; // Individual static const posteditprofile = "${baseUrl}update-profile"; static const geteditprofile = "${baseUrl}fetch-profile"; static const getinterestlist = "${baseUrl}fetch-interests"; - - // Business static const posteditprofilebusiness = "${baseUrl}update-business-profile"; static const geteditprofilebusiness = "${baseUrl}fetch-business-profile"; diff --git a/lib/Feed Module/Main_Screens/Community/Community.dart b/lib/Feed Module/Main_Screens/Community/Community.dart index 784968b..053c930 100644 --- a/lib/Feed Module/Main_Screens/Community/Community.dart +++ b/lib/Feed Module/Main_Screens/Community/Community.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unused_local_variable, non_constant_identifier_names, avoid_print, file_names + import 'package:flutter/material.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -7,6 +9,7 @@ import 'package:regroup/Common/CommonGlassmorphism.dart'; import 'package:regroup/Common/CommonTabBar.dart'; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/controller/MainScreen.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/Community/ViewModal/LatesPost.dart'; import 'package:regroup/Feed%20Module/sidemenu/sidemenu.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; @@ -118,9 +121,9 @@ class _CommunityScreenState extends State { Expanded( child: TabBarView( children: [ - feedTab(), + feedTabData(), popularTab(), - latestTab(), + const LatestTab(), ], ), ), @@ -164,13 +167,19 @@ class _CommunityScreenState extends State { } } -Widget feedTab() { +Widget feedTabData() { List feedTabData = [ { "profileImg": "assets/images/png/Ellipse 43.png", "title": "Edward Hackket", "mainImg": "assets/images/png/Rectangle 24.png", "containerTitle": ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events'], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, { "profileImg": "assets/images/png/Ellipse 52.png", @@ -183,6 +192,12 @@ Widget feedTab() { 'Marathon', 'Events' ], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, { "profileImg": "assets/images/png/Ellipse 52.png", @@ -195,6 +210,12 @@ Widget feedTab() { 'Marathon', 'Events' ], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, { "profileImg": "assets/images/png/Ellipse 52.png", @@ -207,75 +228,58 @@ Widget feedTab() { 'Marathon', 'Events' ], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, ]; - return Column(children: [ - sizedBoxHeight(16.h), - Expanded( - child: ListView.builder( - shrinkWrap: true, - itemCount: feedTabData.length, - itemBuilder: (context, index) { - if (index == 1) { - return announcecardtile( - profileImg: 'assets/images/png/Ellipse 48.png', - title: 'Jocelyn Dokidis', - mainImg: 'assets/images/png/Rectangle 46.png', - containerTitle: [ - 'Race', - 'Swimming', - 'Events', - 'Marathon', - 'Events' - ]); - } else { + return Column( + children: [ + sizedBoxHeight(20.h), + Expanded( + child: ListView.builder( + shrinkWrap: true, + itemCount: feedTabData.length, + itemBuilder: (context, index) { return Column( children: [ normalcardtile2( - profileImg: feedTabData[index]["profileImg"], - title: feedTabData[index]["title"], - mainImg: feedTabData[index]["mainImg"], - containerTitle: feedTabData[index]["containerTitle"]), + profileImg: feedTabData[index]["profileImg"], + title: feedTabData[index]["title"], + mainImg: feedTabData[index]["mainImg"], + containerTitle: feedTabData[index]["containerTitle"], + description: 'test', + create_at: '1 hour', + total_comments: '20', + total_likes: '20', + total_save: '10', + community_name: 'text', + ), sizedBoxHeight(20.h) ], ); - } - }, + }, + ), ), - ), - // normalcardtile2( - // profileImg: 'assets/images/png/Ellipse 43.png', - // title: 'Edward Hackket', - // mainImg: 'assets/images/png/Rectangle 24.png', - // containerTitle: ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events']), - // sizedBoxHeight(20.h), - // announcecardtile( - // profileImg: 'assets/images/png/Ellipse 48.png', - // title: 'Jocelyn Dokidis', - // mainImg: 'assets/images/png/Rectangle 46.png', - // containerTitle: ['Race', 'Swimming', 'Events', 'Marathon', 'Events']), - // sizedBoxHeight(20.h), - // normalcardtile2( - // profileImg: 'assets/images/png/Ellipse 52.png', - // title: 'Ryan Dorwat', - // mainImg: 'assets/images/png/Rectangle 25.png', - // containerTitle: [ - // 'Football', - // 'Teams player', - // 'Events', - // 'Marathon', - // 'Events' - // ]), - // sizedBoxHeight(20.h), - ]); + ], + ); } Widget normalcardtile2({ required String profileImg, required String title, required String mainImg, + required String description, required List containerTitle, + required String community_name, + required String total_comments, + required String total_likes, + required String total_save, + required String? create_at, }) { var mainImage = 'assets/images/png/uiw_like-o.png'.obs; void updateImage(String reaction) { @@ -290,7 +294,7 @@ Widget normalcardtile2({ return commonGlassUI( width: double.infinity, - height: 570.h, + height: 760.h, mainOpacity: 1, borderRadius: BorderRadius.circular(1), customWidget: Column( @@ -302,7 +306,7 @@ Widget normalcardtile2({ crossAxisAlignment: CrossAxisAlignment.start, children: [ CircleAvatar( - foregroundImage: AssetImage(profileImg), + foregroundImage: NetworkImage(profileImg), radius: 25.r, ), sizedBoxWidth(12.w), @@ -319,7 +323,7 @@ Widget normalcardtile2({ width: 14.w, ), sizedBoxWidth(7.w), - text12w400_FCFCFC('Active alliance network'), + text12w400_FCFCFC(community_name), sizedBoxWidth(7.w), Icon( Icons.circle, @@ -327,7 +331,7 @@ Widget normalcardtile2({ size: 4.sp, ), sizedBoxWidth(6.w), - text12w400_FCFCFC('1 Hour ago'), + text12w400_FCFCFC(create_at!), ], ) ], @@ -430,17 +434,21 @@ Widget normalcardtile2({ ), sizedBoxHeight(20.h), GestureDetector( - onTap: () { - Get.toNamed(RouteName.postdetailsScreen); - }, - child: SizedBox( - height: 163.h, - width: double.infinity, - child: Image.asset( + onTap: () { + Get.toNamed(RouteName.postdetailsScreen); + }, + child: Container( + height: 360, + width: double.infinity, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.cover, + image: NetworkImage( mainImg, - fit: BoxFit.cover, ), )), + ), + ), sizedBoxHeight(20.h), Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), @@ -465,14 +473,21 @@ Widget normalcardtile2({ ), ), sizedBoxHeight(20.h), - text16w400_FCFCFC( - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s . . ."), + SizedBox( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text16w400_FCFCFC(description), + ], + ), + ), Row(children: [ InkWell( onTap: () { Get.toNamed(RouteName.reactionview); }, - child: stackReaction(number: '20', containerImages: [ + child: stackReaction(number: total_likes, containerImages: [ 'assets/images/png/f7_hand-thumbsup.png', 'assets/images/png/heart 2.png', 'assets/images/png/party-popper 2.png' @@ -496,7 +511,7 @@ Widget normalcardtile2({ ), ), sizedBoxWidth(12.w), - text14w400_FCFCFC('20'), + text14w400_FCFCFC(total_comments), sizedBoxWidth(20.w), commonContainer( width: 30.w, @@ -515,7 +530,7 @@ Widget normalcardtile2({ ), ), sizedBoxWidth(12.w), - text14w400_FCFCFC('10'), + text14w400_FCFCFC(total_save), ]), sizedBoxHeight(12.h), commonDivider(), @@ -1382,6 +1397,12 @@ Widget popularTab() { "title": "Edward Hackket", "mainImg": "assets/images/png/Rectangle 24.png", "containerTitle": ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events'], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, { "profileImg": "assets/images/png/Ellipse 52.png", @@ -1394,6 +1415,12 @@ Widget popularTab() { 'Marathon', 'Events' ], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, { "profileImg": "assets/images/png/Ellipse 52.png", @@ -1406,6 +1433,12 @@ Widget popularTab() { 'Marathon', 'Events' ], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, { "profileImg": "assets/images/png/Ellipse 52.png", @@ -1418,6 +1451,12 @@ Widget popularTab() { 'Marathon', 'Events' ], + "desciption": "", + "create_at": '1 hour', + "total_comments": 20, + "total_likes": 20, + "total_save": 10, + "community_name": 'text', }, ]; @@ -1432,10 +1471,17 @@ Widget popularTab() { return Column( children: [ normalcardtile2( - profileImg: popularTabData[index]["profileImg"], - title: popularTabData[index]["title"], - mainImg: popularTabData[index]["mainImg"], - containerTitle: popularTabData[index]["containerTitle"]), + profileImg: popularTabData[index]["profileImg"], + title: popularTabData[index]["title"], + mainImg: popularTabData[index]["mainImg"], + containerTitle: popularTabData[index]["containerTitle"], + description: 'test', + create_at: '1 hour', + total_comments: '20', + total_likes: '20', + total_save: '10', + community_name: 'text', + ), sizedBoxHeight(20.h) ], ); @@ -1446,98 +1492,168 @@ Widget popularTab() { ); } -Widget latestTab() { - List latestTabData = [ - { - "profileImg": "assets/images/png/Ellipse 43.png", - "title": "Edward Hackket", - "mainImg": "assets/images/png/Rectangle 24.png", - "containerTitle": ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events'], - }, - { - "profileImg": "assets/images/png/Ellipse 52.png", - "title": "Ryan Dorwat", - "mainImg": "assets/images/png/Rectangle 25.png", - "containerTitle": [ - 'Football', - 'Teams player', - 'Events', - 'Marathon', - 'Events' - ], - }, - { - "profileImg": "assets/images/png/Ellipse 52.png", - "title": "Ryan Dorwat", - "mainImg": "assets/images/png/Rectangle 25.png", - "containerTitle": [ - 'Football', - 'Teams player', - 'Events', - 'Marathon', - 'Events' - ], - }, - { - "profileImg": "assets/images/png/Ellipse 52.png", - "title": "Ryan Dorwat", - "mainImg": "assets/images/png/Rectangle 25.png", - "containerTitle": [ - 'Football', - 'Teams player', - 'Events', - 'Marathon', - 'Events' - ], - }, - ]; +class LatestTab extends StatefulWidget { + const LatestTab({super.key}); - return Column(children: [ - sizedBoxHeight(16.h), - Expanded( - child: ListView.builder( - shrinkWrap: true, - itemCount: latestTabData.length, - itemBuilder: (context, index) { - if (index == 1) { - return announcecardtile( - profileImg: 'assets/images/png/Ellipse 48.png', - title: 'Jocelyn Dokidis', - mainImg: 'assets/images/png/Rectangle 46.png', - containerTitle: [ - 'Race', - 'Swimming', - 'Events', - 'Marathon', - 'Events' - ]); - } else { - return Column( - children: [ - normalcardtile2( - profileImg: latestTabData[index]["profileImg"], - title: latestTabData[index]["title"], - mainImg: latestTabData[index]["mainImg"], - containerTitle: latestTabData[index]["containerTitle"]), - sizedBoxHeight(20.h) - ], - ); - } - }, - ), - ), - - // normalcardtile2( - // profileImg: 'assets/images/png/Ellipse 43.png', - // title: 'Edward Hackket', - // mainImg: 'assets/images/png/Rectangle 24.png', - // containerTitle: ['Cycle', 'Marathon', 'Events', 'Marathon', 'Events']), - // sizedBoxHeight(20.h), - // announcecardtile( - // profileImg: 'assets/images/png/Ellipse 48.png', - // title: 'Jocelyn Dokidis', - // mainImg: 'assets/images/png/Rectangle 46.png', - // containerTitle: ['Race', 'Swimming', 'Events', 'Marathon', 'Events']), - // sizedBoxHeight(20.h), - ]); + @override + State createState() => _LatestTabState(); +} + +class _LatestTabState extends State { + late Future latestfuture; + + @override + void initState() { + latestfuture = LatespostApi().getLatestPostApi(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: latestfuture, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return + // ShimmerCommon(); + const Center( + child: CircularProgressIndicator( + color: Colors.blue, + ), + ); + } + + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occurred', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } + + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + print("Data fetched-->"); + + return Stack( + clipBehavior: Clip.none, + children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill), + ), + ), + Column( + children: [ + sizedBoxHeight(16.h), + Expanded( + child: ListView.builder( + shrinkWrap: true, + itemCount: latestpostobj!.data!.length, + itemBuilder: (context, index) { + if (index == 1) { + return announcecardtile( + profileImg: latestpostobj!.data![index] + .iamPrincipal!.profilePhoto ?? + '', + title: latestpostobj!.data![index].caption ?? '', + mainImg: 'assets/images/png/Rectangle 46.png', + containerTitle: [ + 'Race', + 'Swimming', + 'Events', + 'Marathon', + 'Events' + ]); + } else { + String? createAtstring = + latestpostobj!.data![index].createdAt; + if (createAtstring == null || + createAtstring.isEmpty) { + createAtstring = DateTime.now().toIso8601String(); + } + String? timeAgo; + + try { + DateTime postDateTime = + DateTime.parse(createAtstring); + DateTime now = DateTime.now(); + Duration difference = now.difference(postDateTime); + if (difference.inDays > 365) { + timeAgo = + '${(difference.inDays / 365).floor()} years ago'; + } else if (difference.inDays > 30) { + timeAgo = + '${(difference.inDays / 30).floor()} months ago'; + } else if (difference.inDays > 7) { + timeAgo = + '${(difference.inDays / 7).floor()} weeks ago'; + } else if (difference.inDays > 0) { + timeAgo = '${difference.inDays} days ago'; + } else if (difference.inHours > 0) { + timeAgo = '${difference.inHours} hours ago'; + } else if (difference.inMinutes > 0) { + timeAgo = '${difference.inMinutes} minutes ago'; + } else { + timeAgo = '${difference.inSeconds} seconds ago'; + } + print("Time ago: $timeAgo"); + } catch (e) { + print("Error parsing date: $e"); + String timeAgo = 'Unknown'; + } + + return Column( + children: [ + normalcardtile2( + profileImg: latestpostobj!.data![index] + .iamPrincipal!.profilePhoto ?? + '', + title: latestpostobj! + .data![index].iamPrincipal!.fullName ?? + '', + mainImg: + latestpostobj!.data![index].image ?? '', + containerTitle: + latestpostobj!.data![index].tagNames ?? + [''], + description: + latestpostobj!.data![index].caption ?? '', + create_at: timeAgo, + total_comments: latestpostobj! + .data![index].totalComment + .toString() ?? + '', + total_likes: latestpostobj! + .data![index].likecount + .toString() ?? + '', + total_save: latestpostobj! + .data![index].totalSave + .toString() ?? + '', + community_name: latestpostobj! + .data![index].community!.communityName + .toString() ?? + '', + ), + sizedBoxHeight(20.h) + ], + ); + } + }, + ), + ), + ], + ), + ], + ); + } + return Container(); + }, + ); + } } diff --git a/lib/Feed Module/Main_Screens/Community/CycleScreen.dart b/lib/Feed Module/Main_Screens/Community/CycleScreen.dart index 799e14e..b27104c 100644 --- a/lib/Feed Module/Main_Screens/Community/CycleScreen.dart +++ b/lib/Feed Module/Main_Screens/Community/CycleScreen.dart @@ -7,7 +7,6 @@ import 'package:regroup/Common/CommonTabBar.dart'; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Feed%20Module/Main_Screens/Community/Community.dart'; import 'package:regroup/Utils/Common/CommonAppbar.dart'; -import 'package:regroup/Utils/Common/blureffect.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/resources/routes/route_name.dart'; @@ -34,12 +33,13 @@ class _CycleScreenState extends State { width: 26.w, )), body: Stack(children: [ - Container( + Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage("assets/images/png/Ellipse 1496.png"), fit: BoxFit.fill)), - ), Column(children: [ + ), + Column(children: [ sizedBoxHeight(10.h), DefaultTabController( length: 2, @@ -283,7 +283,7 @@ Widget normalcardtile({ Get.toNamed(RouteName.postdetailsScreen); }, child: SizedBox( - height: 163.h, + height: 360.h, width: double.infinity, child: Image.asset( mainImg, @@ -413,8 +413,10 @@ Widget normalcardtile({ itemScale: 0.4, itemSize: const Size(45, 45), boxPadding: const EdgeInsets.all(8), - boxAnimationDuration: const Duration(milliseconds: 200), - itemAnimationDuration: const Duration(milliseconds: 500), + boxAnimationDuration: + const Duration(milliseconds: 200), + itemAnimationDuration: + const Duration(milliseconds: 500), hoverDuration: const Duration(milliseconds: 700), // toggle: false, diff --git a/lib/Feed Module/Main_Screens/Community/Modal/LatestPost.dart b/lib/Feed Module/Main_Screens/Community/Modal/LatestPost.dart new file mode 100644 index 0000000..f9e6f25 --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/Modal/LatestPost.dart @@ -0,0 +1,183 @@ +class Latestpost { + String? status; + int? statusCode; + String? message; + List? data; + + Latestpost({this.status, this.statusCode, this.message, this.data}); + + Latestpost.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(Data.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['status'] = status; + data['status_code'] = statusCode; + data['message'] = message; + if (this.data != null) { + data['data'] = this.data!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + int? likecount; + List? tagsXid; + bool? isILiked; + int? totalComment; + int? totalSave; + int? iamPrincipalXid; + int? postIn; + String? caption; + String? image; + String? manageTagsXids; + String? postAs; + String? ctaTitle; + String? ctaLink; + String? createdAt; + List? tagNames; + String? likeIcon; + IamPrincipal? iamPrincipal; + Community? community; + + Data( + {this.id, + this.likecount, + this.tagsXid, + this.isILiked, + this.totalComment, + this.totalSave, + this.iamPrincipalXid, + this.postIn, + this.caption, + this.image, + this.manageTagsXids, + this.postAs, + this.ctaTitle, + this.ctaLink, + this.createdAt, + this.tagNames, + this.likeIcon, + this.iamPrincipal, + this.community}); + + Data.fromJson(Map json) { + id = json['id']; + likecount = json['likecount']; + tagsXid = json['tags_xid'].cast(); + isILiked = json['is_i_liked']; + totalComment = json['total_comment']; + totalSave = json['total_save']; + iamPrincipalXid = json['iam_principal_xid']; + postIn = json['post_in']; + caption = json['caption']; + image = json['image']; + manageTagsXids = json['manage_tags_xids']; + postAs = json['post_as']; + ctaTitle = json['cta_title']; + ctaLink = json['cta_link']; + createdAt = json['created_at']; + tagNames = json['tag_names'].cast(); + likeIcon = json['likeIcon']; + iamPrincipal = json['iam_principal'] != null + ? IamPrincipal.fromJson(json['iam_principal']) + : null; + community = json['community'] != null + ? Community.fromJson(json['community']) + : null; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['likecount'] = likecount; + data['tags_xid'] = tagsXid; + data['is_i_liked'] = isILiked; + data['total_comment'] = totalComment; + data['total_save'] = totalSave; + data['iam_principal_xid'] = iamPrincipalXid; + data['post_in'] = postIn; + data['caption'] = caption; + data['image'] = image; + data['manage_tags_xids'] = manageTagsXids; + data['post_as'] = postAs; + data['cta_title'] = ctaTitle; + data['cta_link'] = ctaLink; + data['created_at'] = createdAt; + data['tag_names'] = tagNames; + data['likeIcon'] = likeIcon; + if (iamPrincipal != null) { + data['iam_principal'] = iamPrincipal!.toJson(); + } + if (community != null) { + data['community'] = community!.toJson(); + } + return data; + } +} + +class IamPrincipal { + int? id; + int? principalTypeXid; + String? userName; + String? fullName; + String? profilePhoto; + + IamPrincipal( + {this.id, + this.principalTypeXid, + this.userName, + this.fullName, + this.profilePhoto}); + + IamPrincipal.fromJson(Map json) { + id = json['id']; + principalTypeXid = json['principal_type_xid']; + userName = json['user_name']; + fullName = json['full_name']; + profilePhoto = json['profile_photo']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['principal_type_xid'] = principalTypeXid; + data['user_name'] = userName; + data['full_name'] = fullName; + data['profile_photo'] = profilePhoto; + return data; + } +} + +class Community { + int? id; + String? communityProfilePhoto; + String? communityName; + + Community({this.id, this.communityProfilePhoto, this.communityName}); + + Community.fromJson(Map json) { + id = json['id']; + communityProfilePhoto = json['community_profile_photo']; + communityName = json['community_name']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['community_profile_photo'] = communityProfilePhoto; + data['community_name'] = communityName; + return data; + } +} diff --git a/lib/Feed Module/Main_Screens/Community/ViewModal/FeedPost.dart b/lib/Feed Module/Main_Screens/Community/ViewModal/FeedPost.dart new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/ViewModal/FeedPost.dart @@ -0,0 +1 @@ + diff --git a/lib/Feed Module/Main_Screens/Community/ViewModal/LatesPost.dart b/lib/Feed Module/Main_Screens/Community/ViewModal/LatesPost.dart new file mode 100644 index 0000000..6687d2f --- /dev/null +++ b/lib/Feed Module/Main_Screens/Community/ViewModal/LatesPost.dart @@ -0,0 +1,26 @@ +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; +import 'package:regroup/Feed%20Module/Main_Screens/Community/Modal/LatestPost.dart'; + +Latestpost? latestpostobj; + +class LatespostApi { + LatespostApi(); + + Future> getLatestPostApi() async { + final response = await NetworkApiServices().getApi(ApiUrls.latestpost); + + if (response.status == ResponseStatus.SUCCESS) { + if (response.data["status"] == "success") { + latestpostobj = Latestpost.fromJson(response.data); + } + return ResponseData( + response.data['message'], ResponseStatus.SUCCESS, + data: response.data); + } else { + return ResponseData( + response.data['message'], ResponseStatus.FAILED); + } + } +} diff --git a/lib/Feed Module/sidemenu/Model/TagCommunityUserModel.dart b/lib/Feed Module/sidemenu/Model/TagCommunityUserModel.dart new file mode 100644 index 0000000..84cb06f --- /dev/null +++ b/lib/Feed Module/sidemenu/Model/TagCommunityUserModel.dart @@ -0,0 +1,98 @@ +class TagCommunityUserModel { + String? status; + int? statusCode; + String? message; + Data? data; + + TagCommunityUserModel( + {this.status, this.statusCode, this.message, this.data}); + + TagCommunityUserModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + data = json['data'] != null ? Data.fromJson(json['data']) : null; + } + + Map toJson() { + final Map data = {}; + data['status'] = status; + data['status_code'] = statusCode; + data['message'] = message; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class Data { + List? community; + List? tags; + + Data({this.community, this.tags}); + + Data.fromJson(Map json) { + if (json['community'] != null) { + community = []; + json['community'].forEach((v) { + community!.add(Community.fromJson(v)); + }); + } + if (json['tags'] != null) { + tags = []; + json['tags'].forEach((v) { + tags!.add(Tags.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + if (community != null) { + data['community'] = community!.map((v) => v.toJson()).toList(); + } + if (tags != null) { + data['tags'] = tags!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Community { + int? id; + String? communityName; + + Community({this.id, this.communityName}); + + Community.fromJson(Map json) { + id = json['id']; + communityName = json['community_name']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['community_name'] = communityName; + return data; + } +} + +class Tags { + int? id; + String? name; + + Tags({this.id, this.name}); + + Tags.fromJson(Map json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['name'] = name; + return data; + } +} diff --git a/lib/Feed Module/sidemenu/sidemenu.dart b/lib/Feed Module/sidemenu/sidemenu.dart index 46b1503..25bb7aa 100644 --- a/lib/Feed Module/sidemenu/sidemenu.dart +++ b/lib/Feed Module/sidemenu/sidemenu.dart @@ -1,9 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; - import 'package:get/get.dart'; import 'package:regroup/Common/CommonGlassmorphism.dart'; -import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/resources/routes/route_name.dart'; @@ -69,84 +67,17 @@ class _SideMenuState extends State { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Color(0xFF222935), + backgroundColor: const Color(0xFF222935), body: Column( children: [ sizedBoxHeight(50.h), Expanded( child: ListView(children: [ Padding( - padding: EdgeInsets.symmetric(horizontal: 10.w), - child: commonGlassUI( - width: double.infinity, - height: 330.h, - borderRadius: BorderRadius.circular(10.r), - customWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 16.w, vertical: 12.h), - child: Row( - children: [ - text16w400_FCFCFC("Pinned"), - Spacer(), - Icon( - Icons.arrow_drop_up, - color: Colors.white, - size: 25, - ) - ], - ), - ), - commonDivider(), - sizedBoxHeight(10.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 1), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 2), - firstRowTile( - text: "Crush", - leadingimage: - "assets/images/png/sidemenu/Vector (4).png", - index: 3), - ListTile( - leading: CircleAvatar( - radius: 15.r, - foregroundImage: AssetImage( - "assets/images/png/sidemenu/Ellipse 52.png"), - ), - title: text14w400_FCFCFC("Ryan Dorwart"), - trailing: Image.asset( - "assets/images/png/sidemenu/f7_pin-fill (1).png", - width: 19.w, - height: 19.h, - ), - onTap: () {}, - ), - ListTile( - leading: CircleAvatar( - radius: 15.r, - foregroundImage: AssetImage( - "assets/images/png/sidemenu/Ellipse 53.png"), - ), - title: text14w400_FCFCFC("Ahmad Rhiel Madsen"), - trailing: Image.asset( - "assets/images/png/sidemenu/f7_pin-fill (1).png", - width: 19.w, - height: 19.h, - ), - onTap: () {}, - ), - ]), - ), + padding: EdgeInsets.symmetric(horizontal: 16.w), + child: text16w400_FCFCFC("My pinned content"), ), + const Spacer(), sizedBoxHeight(18.h), Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), @@ -156,7 +87,7 @@ class _SideMenuState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: Color.fromRGBO(255, 255, 255, 0.3), + color: const Color.fromRGBO(255, 255, 255, 0.3), width: 1.w, ), ), @@ -168,8 +99,8 @@ class _SideMenuState extends State { padding: EdgeInsets.symmetric(horizontal: 16.w), child: Row( children: [ - text16w400_FCFCFC("Communities"), - Spacer(), + text16w400_FCFCFC("Tags"), + const Spacer(), GestureDetector( onTap: () { Get.toNamed(RouteName.mycommunity); @@ -207,7 +138,7 @@ class _SideMenuState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: Color.fromRGBO(255, 255, 255, 0.3), + color: const Color.fromRGBO(255, 255, 255, 0.3), width: 1.w, ), ), @@ -219,59 +150,8 @@ class _SideMenuState extends State { padding: EdgeInsets.symmetric(horizontal: 16.w), child: Row( children: [ - text16w400_FCFCFC("Watchlist"), - Spacer(), - GestureDetector( - onTap: () { - Get.toNamed(RouteName.watchlist); - }, - child: text14w400_FCFCFC("View all")), - ], - ), - ), - sizedBoxHeight(20.h), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 8), - firstRowTile( - text: "Advice", - leadingimage: - "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 9), - firstRowTile( - text: "Crush", - leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 10), - firstRowTile( - text: "Row bridge", - leadingimage: - "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 11), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Container( - height: 1, - margin: EdgeInsets.symmetric(vertical: 10.h), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color.fromRGBO(255, 255, 255, 0.3), - width: 1.w, - ), - ), - ), - ), - ), - sizedBoxHeight(18.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - text16w400_FCFCFC("Recent"), - Spacer(), + text16w400_FCFCFC("Communities"), + const Spacer(), GestureDetector( onTap: () { Get.toNamed(RouteName.mycommunity); @@ -285,21 +165,21 @@ class _SideMenuState extends State { text: "Row bridge", leadingimage: "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 8), + index: 4), firstRowTile( text: "Advice", leadingimage: "assets/images/png/sidemenu/solar_cloud-outline.png", - index: 9), + index: 5), firstRowTile( text: "Crush", leadingimage: "assets/images/png/sidemenu/Vector (4).png", - index: 10), + index: 6), firstRowTile( text: "Row bridge", leadingimage: "assets/images/png/sidemenu/rowing 1 (traced).png", - index: 11), + index: 7), sizedBoxHeight(18.h), Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), @@ -309,7 +189,7 @@ class _SideMenuState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: Color.fromRGBO(255, 255, 255, 0.3), + color: const Color.fromRGBO(255, 255, 255, 0.3), width: 1.w, ), ), @@ -322,7 +202,7 @@ class _SideMenuState extends State { child: Row( children: [ text16w400_FCFCFC("Users"), - Spacer(), + const Spacer(), GestureDetector( onTap: () { Get.toNamed(RouteName.mycommunity); diff --git a/lib/Feed Module/sidemenu/view_model/tagcommunityuser.dart b/lib/Feed Module/sidemenu/view_model/tagcommunityuser.dart new file mode 100644 index 0000000..59ce7f7 --- /dev/null +++ b/lib/Feed Module/sidemenu/view_model/tagcommunityuser.dart @@ -0,0 +1,22 @@ +import 'dart:developer'; + +import 'package:regroup/Common/api_urls.dart'; +import 'package:regroup/Common/base_manager.dart'; +import 'package:regroup/Common/controller/data/network/network_api.dart'; +import 'package:regroup/Feed%20Module/sidemenu/Model/TagCommunityUserModel.dart'; + +TagCommunityUserModel? tagcommunityuserobj; + +class Sidegetmethod { + Future> getJoinedusergroups(updata) async { + final response = await NetworkApiServices().getApi( + "${ApiUrls.tagcommunityuser}?=$updata", + // optionalpar: false + ); + if (response.status == ResponseStatus.SUCCESS) { + tagcommunityuserobj = TagCommunityUserModel.fromJson(response.data); + log(tagcommunityuserobj!.data.toString()); + } + return response; + } +}