-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #753 from bounswe/app-589/modifications-on-comment…
…-widget modifications on comment widget
- Loading branch information
Showing
7 changed files
with
215 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
class CommentData { | ||
final String user; | ||
final String username; | ||
final String commentText; | ||
final String commentId; | ||
final String dateTime; | ||
final String userId; | ||
|
||
CommentData({required this.user, required this.commentText}); | ||
CommentData({ | ||
required this.username, | ||
required this.commentText, | ||
required this.commentId, | ||
required this.dateTime, | ||
required this.userId, | ||
}); | ||
|
||
factory CommentData.fromJson(Map<String, dynamic> json) { | ||
return CommentData( | ||
user: json['user']['username'], | ||
userId: json['user']['id'], | ||
username: json['user']['username'], | ||
commentText: json['description'], | ||
commentId: json['id'], | ||
dateTime: json['created_date'], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:dio/dio.dart'; | ||
import 'package:mobile_app/services/apiService.dart'; | ||
|
||
class ReportService { | ||
static Future<bool> report(String userId, String reason) async { | ||
String reportEndpoint = '/user/report/$userId'; | ||
|
||
final Map<String, dynamic> data = { | ||
'reason': reason, | ||
}; | ||
|
||
try { | ||
final Response response = await ApiService.dio.post( | ||
reportEndpoint, | ||
data: data, | ||
); | ||
return response.statusCode == 201; | ||
} catch (e) { | ||
print('$e'); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters