like post done for latest tab in this like post is done but on click of again removing like it is not shown unless page is refreshed again
This commit is contained in:
@@ -125,6 +125,9 @@ class ApiUrls {
|
||||
|
||||
static const postusertag = "${baseUrl}pin-unpin";
|
||||
|
||||
static const getLikeicons= "${baseUrl}fetch-like-icons";
|
||||
|
||||
static const postLike = "${baseUrl}like-post";
|
||||
|
||||
|
||||
|
||||
|
||||
64
lib/Main_Screens/Community/Model/fetchicons.dart
Normal file
64
lib/Main_Screens/Community/Model/fetchicons.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
class FetchlikeIconsModel {
|
||||
String? status;
|
||||
int? statusCode;
|
||||
String? message;
|
||||
List<Data>? data;
|
||||
|
||||
FetchlikeIconsModel({this.status, this.statusCode, this.message, this.data});
|
||||
|
||||
FetchlikeIconsModel.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
statusCode = json['status_code'];
|
||||
message = json['message'];
|
||||
if (json['data'] != null) {
|
||||
data = <Data>[];
|
||||
json['data'].forEach((v) {
|
||||
data!.add(new Data.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['status_code'] = this.statusCode;
|
||||
data['message'] = this.message;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
int? id;
|
||||
String? image;
|
||||
|
||||
Data({this.id, this.image});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
image = json['image'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['image'] = this.image;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ReactionData {
|
||||
final int id;
|
||||
final String image;
|
||||
|
||||
ReactionData({required this.id, required this.image});
|
||||
|
||||
factory ReactionData.fromJson(Map<String, dynamic> json) {
|
||||
return ReactionData(
|
||||
id: json['id'],
|
||||
image: json['image'],
|
||||
);
|
||||
}
|
||||
}
|
||||
24
lib/Main_Screens/Community/ViewModel/getmethod.dart
Normal file
24
lib/Main_Screens/Community/ViewModel/getmethod.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
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/Main_Screens/Community/Model/fetchicons.dart';
|
||||
|
||||
// FetchlikeIconsModel? likeiconsobj;
|
||||
|
||||
class Communityallgetmethod {
|
||||
|
||||
Future<ResponseData<dynamic>> getLikeicons() async {
|
||||
final response = await NetworkApiServices().getApi(
|
||||
ApiUrls.getLikeicons,
|
||||
// optionalpar: false
|
||||
);
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
// likeiconsobj = FetchlikeIconsModel.fromJson(response.data);
|
||||
// log(likeiconsobj!.data.toString());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
15
lib/Main_Screens/Community/ViewModel/postmethod.dart
Normal file
15
lib/Main_Screens/Community/ViewModel/postmethod.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:regroup/Common/api_urls.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Common/controller/data/network/network_api.dart';
|
||||
|
||||
class CommunitypostMethod {
|
||||
CommunitypostMethod();
|
||||
|
||||
Future<ResponseData<dynamic>> postLikepost(updata) async {
|
||||
final response = await NetworkApiServices().postApi(
|
||||
updata,
|
||||
ApiUrls.postLike,
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user