elCaribe app - customization and branding
This commit is contained in:
49
news-app/lib/data/models/authorModel.dart
Normal file
49
news-app/lib/data/models/authorModel.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
import 'package:news/utils/constant.dart';
|
||||
import 'package:news/utils/strings.dart';
|
||||
|
||||
class Author {
|
||||
final int? id;
|
||||
final int? userId;
|
||||
final String? bio;
|
||||
final String? telegramLink;
|
||||
final String? linkedinLink;
|
||||
final String? facebookLink;
|
||||
final String? whatsappLink;
|
||||
final AuthorStatus? status;
|
||||
|
||||
Author({
|
||||
this.id,
|
||||
this.userId,
|
||||
this.bio,
|
||||
this.telegramLink,
|
||||
this.linkedinLink,
|
||||
this.facebookLink,
|
||||
this.whatsappLink,
|
||||
this.status,
|
||||
});
|
||||
|
||||
factory Author.fromJson(Map<String, dynamic> json) {
|
||||
return Author(
|
||||
id: json['id'] as int?,
|
||||
userId: json['user_id'] as int?,
|
||||
bio: json['bio'] ?? "",
|
||||
telegramLink: json['telegram_link'] ?? "",
|
||||
linkedinLink: json['linkedin_link'] ?? "",
|
||||
facebookLink: json['facebook_link'] ?? "",
|
||||
whatsappLink: json['whatsapp_link'] ?? "",
|
||||
status: fromAuthorStatus(json[STATUS]));
|
||||
}
|
||||
}
|
||||
|
||||
AuthorStatus? fromAuthorStatus(String? value) {
|
||||
switch (value) {
|
||||
case 'pending':
|
||||
return AuthorStatus.pending;
|
||||
case 'approved':
|
||||
return AuthorStatus.approved;
|
||||
case 'rejected':
|
||||
return AuthorStatus.rejected;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user