elCaribe app - customization and branding

This commit is contained in:
2025-12-12 19:09:42 -04:00
parent 9e5d0d8ebf
commit ba7deac9f3
402 changed files with 31833 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
import 'package:news/data/models/appLanguageModel.dart';
import 'package:news/utils/constant.dart';
import 'package:news/utils/strings.dart';
class AppSystemSettingModel {
String? breakNewsMode, liveStreamMode, catMode, subCatMode, commentMode, inAppAdsMode, iosInAppAdsMode, adsType, iosAdsType;
String? goRewardedId, goInterId, goBannerId, goNativeId;
String? goIOSRewardedId, goIOSInterId, goIOSBannerId, goIOSNativeId;
String? gameId, iosGameId;
String? unityRewardedId, unityInterId, unityBannerId, unityIOSRewardedId, unityIOSInterId, unityIOSBannerId;
String? locationWiseNewsMode, weatherMode, maintenanceMode, forceUpdateMode;
LanguageModel? defaultLangDataModel;
String? rssFeedMode, mobileLoginMode, countryCode, shareAppText, appstoreId, androidAppLink, iosAppLink;
VideoViewType? videoTypePreference;
String? androidAppVersion, iosAppVersion, googleGeminiApiKey;
AppSystemSettingModel(
{this.breakNewsMode,
this.liveStreamMode,
this.catMode,
this.subCatMode,
this.commentMode,
this.inAppAdsMode,
this.iosInAppAdsMode,
this.adsType,
this.iosAdsType,
this.goRewardedId,
this.goBannerId,
this.goInterId,
this.goNativeId,
this.goIOSBannerId,
this.goIOSInterId,
this.goIOSNativeId,
this.goIOSRewardedId,
this.gameId,
this.iosGameId,
this.unityRewardedId,
this.unityInterId,
this.unityBannerId,
this.unityIOSRewardedId,
this.unityIOSInterId,
this.unityIOSBannerId,
this.defaultLangDataModel,
this.locationWiseNewsMode,
this.weatherMode,
this.maintenanceMode,
this.rssFeedMode,
this.mobileLoginMode,
this.countryCode,
this.shareAppText,
this.appstoreId,
this.androidAppLink,
this.iosAppLink,
this.videoTypePreference,
this.forceUpdateMode,
this.androidAppVersion,
this.iosAppVersion,
this.googleGeminiApiKey});
factory AppSystemSettingModel.fromJson(Map<String, dynamic> json) {
var defaultList = (json[DEFAULT_LANG]);
LanguageModel defaultLangData;
if (defaultList == null && defaultList.isEmpty) {
defaultLangData = LanguageModel();
} else {
defaultLangData = LanguageModel.fromJson(defaultList);
}
return AppSystemSettingModel(
breakNewsMode: json[BREAK_NEWS_MODE],
liveStreamMode: json[LIVE_STREAM_MODE],
catMode: json[CATEGORY_MODE],
subCatMode: json[SUBCAT_MODE],
commentMode: json[COMM_MODE],
inAppAdsMode: json[ADS_MODE],
iosInAppAdsMode: json[IOS_ADS_MODE],
adsType: json[ADS_TYPE],
iosAdsType: json[IOS_ADS_TYPE],
goRewardedId: json[GO_REWARDED_ID],
goInterId: json[GO_INTER_ID],
goBannerId: json[GO_BANNER_ID],
goNativeId: json[GO_NATIVE_ID],
goIOSRewardedId: json[IOS_GO_REWARDED_ID],
goIOSNativeId: json[IOS_GO_NATIVE_ID],
goIOSInterId: json[IOS_GO_INTER_ID],
goIOSBannerId: json[IOS_GO_BANNER_ID],
gameId: json[U_AND_GAME_ID],
iosGameId: json[IOS_U_GAME_ID],
unityRewardedId: json[U_REWARDED_ID],
unityInterId: json[U_INTER_ID],
unityBannerId: json[U_BANNER_ID],
unityIOSRewardedId: json[IOS_U_REWARDED_ID],
unityIOSInterId: json[IOS_U_INTER_ID],
unityIOSBannerId: json[IOS_U_BANNER_ID],
defaultLangDataModel: defaultLangData,
locationWiseNewsMode: json[LOCATION_WISE_NEWS_MODE],
weatherMode: json[WEATHER_MODE],
maintenanceMode: json[MAINTENANCE_MODE],
rssFeedMode: json[RSS_FEED_MODE],
mobileLoginMode: json[MOBILE_LOGIN_MODE],
countryCode: json[COUNTRY_CODE],
shareAppText: json[SHARE_APP_TEXT],
appstoreId: json[APPSTORE_ID],
androidAppLink: json[WEB_SETTING][ANDROID_APP_LINK],
iosAppLink: json[WEB_SETTING][IOS_APP_LINK],
videoTypePreference: fromVideoTypeJson(json[VIDEO_TYPE_PREFERENCE]),
forceUpdateMode: json[FORCE_UPDT_APP_MODE] ?? "0",
androidAppVersion: json[ANDROID_APP_VERSION] ?? '',
iosAppVersion: json[IOS_APP_VERSION] ?? '',
googleGeminiApiKey: json[GEMINI_API_KEY]);
}
static VideoViewType? fromVideoTypeJson(String? value) {
switch (value) {
case 'normal_style':
return VideoViewType.normal;
case 'page_style':
return VideoViewType.page;
default:
return null;
}
}
}

View File

@@ -0,0 +1,34 @@
import 'package:news/data/models/authorModel.dart';
import 'package:news/utils/strings.dart';
class AuthModel {
String? id;
String? name;
String? email;
String? mobile;
String? profile;
String? type;
String? status;
String? isFirstLogin; // 0 - new user, 1 - existing user
String? role;
String? jwtToken;
int? isAuthor;
Author? authorDetails;
AuthModel({this.id, this.name, this.email, this.mobile, this.profile, this.type, this.status, this.isFirstLogin, this.role, this.jwtToken, this.authorDetails, this.isAuthor = 0});
AuthModel.fromJson(Map<String, dynamic> json) {
id = json[ID].toString();
name = json[NAME] ?? "";
email = json[EMAIL] ?? "";
mobile = json[MOBILE] ?? "";
profile = json[PROFILE] ?? "";
type = json[TYPE] ?? "";
status = json[STATUS].toString();
isFirstLogin = (json[IS_LOGIN] != null) ? json[IS_LOGIN].toString() : "";
role = json[ROLE].toString();
jwtToken = json[TOKEN] ?? "";
isAuthor = json[IS_AUTHOR];
authorDetails = (isAuthor == 1 && json[AUTHOR] != null) ? Author.fromJson(json[AUTHOR]) : null;
}
}

View File

@@ -0,0 +1,19 @@
import 'package:news/utils/strings.dart';
class BreakingNewsModel {
String? id, image, title, desc, contentType, contentValue, totalViews, slug;
BreakingNewsModel({this.id, this.image, this.title, this.desc, this.contentValue, this.contentType, this.totalViews, this.slug});
factory BreakingNewsModel.fromJson(Map<String, dynamic> json) {
return BreakingNewsModel(
id: json[ID].toString(),
image: json[IMAGE],
title: json[TITLE],
desc: json[DESCRIPTION] ?? '',
contentValue: json[CONTENT_VALUE],
contentType: json[CONTENT_TYPE],
totalViews: json[TOTAL_VIEWS].toString(),
slug: json[SLUG]);
}
}

View File

@@ -0,0 +1,26 @@
import 'package:news/utils/strings.dart';
class CategoryModel {
String? id, image, categoryName;
List<SubCategoryModel>? subData;
CategoryModel({this.id, this.image, this.categoryName, this.subData});
factory CategoryModel.fromJson(Map<String, dynamic> json) {
var subList = (json.containsKey(SUBCATEGORIES)) ? (json[SUBCATEGORIES] as List) : [];
List<SubCategoryModel> subCatData = [];
subCatData = (subList.isEmpty) ? [] : subList.map((data) => SubCategoryModel.fromJson(data)).toList();
return CategoryModel(id: json[ID].toString(), image: json[IMAGE] ?? "", categoryName: json[CATEGORY_NAME], subData: subCatData);
}
}
class SubCategoryModel {
String? id, categoryId, subCatName;
SubCategoryModel({this.id, this.categoryId, this.subCatName});
factory SubCategoryModel.fromJson(Map<String, dynamic> json) {
return SubCategoryModel(id: json[ID].toString(), categoryId: json[CATEGORY_ID].toString(), subCatName: json[SUBCAT_NAME] ?? json[SUBCATEGORY]);
}
}

View File

@@ -0,0 +1,60 @@
import 'package:news/data/models/AuthModel.dart';
import 'package:news/utils/strings.dart';
class CommentModel {
String? id, message, profile, date, name, status, like, dislike, totalLikes, totalDislikes, userId;
List<ReplyModel>? replyComList;
CommentModel({this.id, this.message, this.profile, this.date, this.name, this.replyComList, this.status, this.like, this.dislike, this.totalLikes, this.totalDislikes, this.userId});
factory CommentModel.fromJson(Map<String, dynamic> json) {
var replyList = (json[REPLY] as List);
List<ReplyModel> replyData = [];
if (replyList.isEmpty) {
replyList = [];
} else {
replyData = replyList.map((data) => ReplyModel.fromJson(data)).toList();
}
var userDetails = AuthModel.fromJson(json[USER]);
return CommentModel(
id: json[ID].toString(),
message: json[MESSAGE],
profile: userDetails.profile,
name: userDetails.name,
date: json[DATE],
status: json[STATUS].toString(),
replyComList: replyData,
like: json[LIKE].toString(),
dislike: json[DISLIKE].toString(),
totalDislikes: json[TOTAL_DISLIKE].toString(),
totalLikes: json[TOTAL_LIKE].toString(),
userId: json[USER_ID].toString());
}
}
class ReplyModel {
String? id, message, profile, date, name, userId, parentId, newsId, status, like, dislike, totalLikes, totalDislikes;
ReplyModel({this.id, this.message, this.profile, this.date, this.name, this.userId, this.parentId, this.status, this.newsId, this.like, this.dislike, this.totalLikes, this.totalDislikes});
factory ReplyModel.fromJson(Map<String, dynamic> json) {
var userDetails = AuthModel.fromJson(json[USER]);
return ReplyModel(
id: json[ID].toString(),
message: json[MESSAGE],
profile: userDetails.profile,
name: userDetails.name,
date: json[DATE],
userId: json[USER_ID].toString(),
parentId: json[PARENT_ID].toString(),
newsId: json[NEWS_ID].toString(),
status: json[STATUS].toString(),
like: json[LIKE].toString(),
dislike: json[DISLIKE].toString(),
totalDislikes: json[TOTAL_DISLIKE].toString(),
totalLikes: json[TOTAL_LIKE].toString());
}
}

View File

@@ -0,0 +1,97 @@
import 'package:news/data/models/BreakingNewsModel.dart';
import 'package:news/data/models/NewsModel.dart';
import 'package:news/data/models/adSpaceModel.dart';
import 'package:news/utils/strings.dart';
class FeatureSectionModel {
String? id, languageId, title, shortDescription, newsType, videosType, categoryIds, subcategoryIds, newsIds, styleApp, createdAt, status, summarizedDesc;
int? newsTotal, breakNewsTotal, videosTotal;
List<NewsModel>? news;
List<BreakingNewsModel>? breakNews, breakVideos;
List<NewsModel>? videos;
AdSpaceModel? adSpaceDetails;
FeatureSectionModel(
{this.id,
this.languageId,
this.title,
this.shortDescription,
this.newsType,
this.videosType,
this.categoryIds,
this.subcategoryIds,
this.newsIds,
this.styleApp,
this.createdAt,
this.newsTotal,
this.breakNewsTotal,
this.videosTotal,
this.news,
this.breakNews,
this.videos,
this.breakVideos,
this.adSpaceDetails,
this.summarizedDesc});
factory FeatureSectionModel.fromJson(Map<String, dynamic> json) {
List<NewsModel> newsData = [];
if (json.containsKey(NEWS)) {
var newsList = (json[NEWS] as List);
if (newsList.isEmpty) {
newsList = [];
} else {
newsData = newsList.map((data) => NewsModel.fromJson(data)).toList();
}
}
List<BreakingNewsModel> breakNewsData = [];
if (json.containsKey(BREAKING_NEWS)) {
var breakNewsList = (json[BREAKING_NEWS] as List);
if (breakNewsList.isEmpty) {
breakNewsList = [];
} else {
breakNewsData = breakNewsList.map((data) => BreakingNewsModel.fromJson(data)).toList();
}
}
List<NewsModel> videosData = [];
List<BreakingNewsModel> breakVideosData = [];
if (json.containsKey(VIDEOS)) {
var videosList = (json[VIDEOS] as List);
if (videosList.isEmpty) {
videosList = [];
} else {
if (json[VIDEOS_TYPE] == 'news') {
videosData = videosList.map((data) => NewsModel.fromVideos(data)).toList();
} else {
breakVideosData = videosList.map((data) => BreakingNewsModel.fromJson(data)).toList();
}
}
}
AdSpaceModel? adSpaceData;
if (json.containsKey(AD_SPACES)) {
adSpaceData = AdSpaceModel.fromJson(json[AD_SPACES]);
}
return FeatureSectionModel(
id: json[ID].toString(),
languageId: json[LANGUAGE_ID].toString(),
title: json[TITLE],
shortDescription: json[SHORT_DESC],
newsType: json[NEWS_TYPE],
videosType: json[VIDEOS_TYPE],
categoryIds: json[CAT_IDS],
subcategoryIds: json[SUBCAT_IDS],
newsIds: json[NEWS_IDS],
styleApp: json[STYLE_APP],
newsTotal: json[NEWS_TOTAL],
breakNewsTotal: json[BREAK_NEWS_TOTAL],
videosTotal: json[VIDEOS_TOTAL],
summarizedDesc: json[SUMM_DESCRIPTION],
news: newsData,
breakNews: breakNewsData,
videos: videosData,
breakVideos: breakVideosData,
adSpaceDetails: adSpaceData);
}
}

View File

@@ -0,0 +1,11 @@
import 'package:news/utils/strings.dart';
class LiveStreamingModel {
String? id, image, title, type, url, updatedDate;
LiveStreamingModel({this.id, this.image, this.title, this.type, this.url, this.updatedDate});
factory LiveStreamingModel.fromJson(Map<String, dynamic> json) {
return LiveStreamingModel(id: json[ID].toString(), image: json[IMAGE], title: json[TITLE], type: json[TYPE], url: json[URL], updatedDate: json[UPDATED_DATE]);
}
}

View File

@@ -0,0 +1,196 @@
import 'package:news/data/models/CategoryModel.dart';
import 'package:news/data/models/authorModel.dart';
import 'package:news/data/models/locationCityModel.dart';
import 'package:news/utils/strings.dart';
import 'package:news/data/models/OptionModel.dart';
class NewsModel {
String? id, userId, newsId, categoryId, title, date, contentType, contentValue, image, desc, categoryName, dateSent, totalLikes, like, shortDesc;
String? bookmark, keyName, tagId, tagName, subCatId, img, subCatName, showTill, langId, totalViews, locationId, locationName, metaKeyword, metaTitle, metaDescription, slug, publishDate;
List<ImageDataModel>? imageDataList;
bool? history = false;
String? question, status, type, sourceType;
List<OptionModel>? optionDataList;
int? from, isExpired, isCommentEnabled;
Author? authorDetails;
UserAuthorModel? userAthorDetails;
NewsModel(
{this.id,
this.userId,
this.newsId,
this.categoryId,
this.title,
this.date,
this.contentType,
this.contentValue,
this.image,
this.desc,
this.categoryName,
this.dateSent,
this.imageDataList,
this.totalLikes,
this.like,
this.keyName,
this.tagName,
this.subCatId,
this.tagId,
this.history,
this.optionDataList,
this.question,
this.status,
this.type,
this.from,
this.img,
this.subCatName,
this.showTill,
this.bookmark,
this.langId,
this.totalViews,
this.locationId,
this.locationName,
this.metaTitle,
this.metaDescription,
this.metaKeyword,
this.slug,
this.publishDate,
this.isExpired,
this.isCommentEnabled,
this.sourceType,
this.shortDesc,
this.authorDetails,
this.userAthorDetails});
factory NewsModel.history(String history) {
return NewsModel(title: history, history: true);
}
factory NewsModel.fromSurvey(Map<String, dynamic> json) {
List<OptionModel> optionList = (json[OPTION] as List).map((data) => OptionModel.fromJson(data)).toList();
return NewsModel(id: json[ID].toString(), question: json[QUESTION], status: json[STATUS].toString(), optionDataList: optionList, type: "survey", from: 1);
}
factory NewsModel.fromVideos(Map<String, dynamic> json) {
String? tagName;
tagName = (json[TAG] == null) ? "" : json[TAG];
return NewsModel(
id: json[ID].toString(),
newsId: json[ID].toString(),
//for bookmark get/set
desc: json[DESCRIPTION] ?? '',
date: json[DATE],
image: json[IMAGE],
title: json[TITLE],
contentType: json[CONTENT_TYPE],
contentValue: json[CONTENT_VALUE],
tagId: json[TAG_ID],
tagName: tagName,
categoryName: json[CATEGORY_NAME] ?? '',
sourceType: json[SOURCE_TYPE],
shortDesc: json[SUMM_DESCRIPTION] ?? '');
}
factory NewsModel.fromJson(Map<String, dynamic> json) {
bool isAuthor = (json[USER] == null) ? false : (json[USER][IS_AUTHOR] == 1);
String? tagName;
tagName = (json[TAG] == null) ? "" : json[TAG];
List<ImageDataModel> imageData = [];
var imageList = (json.containsKey(IMAGES))
? json[IMAGES] as List<dynamic>
: (json.containsKey(IMAGE_DATA))
? json[IMAGE_DATA] as List
: [];
imageList = (imageList.isEmpty) ? [] : imageList.map((data) => ImageDataModel.fromJson(data)).toList();
if (imageList.isNotEmpty) imageData = imageList as List<ImageDataModel>;
var categoryName = '';
try {
categoryName = (json.containsKey(CATEGORY_NAME))
? json[CATEGORY_NAME]
: (json.containsKey(CATEGORY))
? CategoryModel.fromJson(json[CATEGORY]).categoryName
: '';
} catch (e) {}
var subcategoryName =
(json.containsKey(SUBCAT_NAME)) ? json[SUBCAT_NAME] : ((json.containsKey(SUBCATEGORY) && json[SUBCATEGORY] != null) ? SubCategoryModel.fromJson(json[SUBCATEGORY]).subCatName : '');
return NewsModel(
id: json[ID].toString(),
userId: json[USER_ID].toString(),
newsId: (json[NEWS_ID] != null && json[NEWS_ID].toString().trim().isNotEmpty) ? json[NEWS_ID].toString() : json[ID].toString(),
//incase of null newsId in Response
categoryId: json[CATEGORY_ID].toString(),
title: json[TITLE],
date: json[DATE],
contentType: json[CONTENT_TYPE],
contentValue: json[CONTENT_VALUE],
image: json[IMAGE],
desc: json[DESCRIPTION] ?? '',
categoryName: categoryName,
dateSent: json[DATE_SENT],
imageDataList: imageData,
totalLikes: json[TOTAL_LIKE].toString(),
like: json[LIKE].toString(),
bookmark: json[BOOKMARK].toString(),
tagId: json[TAG_ID],
tagName: tagName,
subCatId: json[SUBCAT_ID].toString(),
history: false,
type: "news",
img: "",
subCatName: subcategoryName,
showTill: json[SHOW_TILL],
langId: json[LANGUAGE_ID].toString(),
totalViews: json[TOTAL_VIEWS].toString(),
locationId: (json.containsKey(LOCATION) && json[LOCATION] != null) ? LocationCityModel.fromJson(json[LOCATION]).id.toString() : json[LOCATION_ID].toString(),
locationName: (json.containsKey(LOCATION) && json[LOCATION] != null) ? LocationCityModel.fromJson(json[LOCATION]).locationName : json[LOCATION_NAME],
metaKeyword: json[META_KEYWORD],
metaTitle: json[META_TITLE],
metaDescription: json[META_DESC],
slug: json[SLUG],
publishDate: json[PUBLISHED_DATE],
isExpired: json[IS_EXPIRED] ?? 0,
status: json[STATUS].toString(),
isCommentEnabled: json[IS_COMMENT_ENABLED] ?? 1,
shortDesc: json[SUMM_DESCRIPTION] ?? '',
userAthorDetails: (json[USER] == null) ? null : UserAuthorModel.fromJson(json[USER]),
authorDetails: (isAuthor && json[AUTHOR] != null) ? Author.fromJson(json[AUTHOR]) : null);
}
}
class ImageDataModel {
String? id;
String? otherImage;
ImageDataModel({this.otherImage, this.id});
factory ImageDataModel.fromJson(Map<String, dynamic> json) {
return ImageDataModel(otherImage: json[OTHER_IMAGE], id: json[ID].toString());
}
}
class UserAuthorModel {
String? id;
String? name;
String? profile;
int? isAuthor;
Author? authorData;
UserAuthorModel({this.id, this.name, this.profile, this.isAuthor, this.authorData});
factory UserAuthorModel.fromJson(Map<String, dynamic> json) {
return UserAuthorModel(
id: json[ID].toString(),
name: json[NAME],
profile: json[PROFILE].toString(),
isAuthor: json[IS_AUTHOR] ?? 0,
authorData: (json.containsKey(AUTHOR) && json[AUTHOR] != null) ? Author.fromJson(json[AUTHOR]) : null);
}
}

View File

@@ -0,0 +1,20 @@
import 'package:news/utils/strings.dart';
class OptionModel {
String? id;
String? options;
String? counter;
double? percentage;
String? questionId;
OptionModel({this.id, this.options, this.counter, this.percentage, this.questionId});
factory OptionModel.fromJson(Map<String, dynamic> json) {
return OptionModel(
id: json[ID].toString(),
options: json[OPTIONS],
counter: json[COUNTER].toString(),
percentage: (json[PERCENTAGE].runtimeType == int) ? double.parse(json[PERCENTAGE].toString()) : json[PERCENTAGE],
questionId: json[QUESTION_ID].toString());
}
}

View File

@@ -0,0 +1,15 @@
import 'package:news/utils/strings.dart';
class OtherPageModel {
String? id, pageContent, title, image;
//slug,meta_description,meta_keywords not in use.
OtherPageModel({this.id, this.pageContent, this.title, this.image});
factory OtherPageModel.fromJson(Map<String, dynamic> json) {
return OtherPageModel(id: json[ID].toString(), pageContent: json[PAGE_CONTENT], title: json[TITLE], image: json[PAGE_ICON]);
}
factory OtherPageModel.fromPrivacyTermsJson(Map<String, dynamic> json) {
return OtherPageModel(id: json[ID].toString().toString(), pageContent: json[PAGE_CONTENT], title: json[TITLE]);
}
}

View File

@@ -0,0 +1,23 @@
import 'package:news/data/models/CategoryModel.dart';
import 'package:news/utils/strings.dart';
class RSSFeedModel {
String? id, feedName, feedUrl, categoryId, categoryName, subCatName, tagName;
RSSFeedModel({this.id, this.feedName, this.feedUrl, this.categoryId, this.tagName, this.categoryName, this.subCatName});
factory RSSFeedModel.fromJson(Map<String, dynamic> json) {
String? tagName;
tagName = (json[TAG] == null) ? "" : json[TAG];
var categoryName = (json.containsKey(CATEGORY_NAME))
? json[CATEGORY_NAME]
: (json.containsKey(CATEGORY) && (json[CATEGORY] != null))
? CategoryModel.fromJson(json[CATEGORY]).categoryName
: '';
var subcategoryName =
(json.containsKey(SUBCAT_NAME)) ? json[SUBCAT_NAME] : ((json.containsKey(SUBCATEGORY) && json[SUBCATEGORY] != null) ? SubCategoryModel.fromJson(json[SUBCATEGORY]).subCatName : '');
return RSSFeedModel(id: json[ID].toString(), feedName: json[FEED_NAME].toString(), feedUrl: json[FEED_URL], tagName: tagName, categoryName: categoryName, subCatName: subcategoryName);
}
}

View File

@@ -0,0 +1,42 @@
class SettingsModel {
bool showIntroSlider;
bool notification;
String languageCode;
String theme;
String token;
SettingsModel({
required this.languageCode,
required this.showIntroSlider,
required this.theme,
required this.notification,
required this.token,
});
static SettingsModel fromJson(var settingsJson) {
//to see the json response go to getCurrentSettings() function in settingsRepository
return SettingsModel(
theme: settingsJson['theme'],
showIntroSlider: settingsJson['showIntroSlider'],
notification: settingsJson['notification'],
languageCode: settingsJson['languageCode'],
token: settingsJson['token'],
);
}
SettingsModel copyWith({
String? theme,
bool? showIntroSlider,
bool? notification,
String? languageCode,
String? token,
}) {
return SettingsModel(
theme: theme ?? this.theme,
notification: notification ?? this.notification,
showIntroSlider: showIntroSlider ?? this.showIntroSlider,
languageCode: languageCode ?? this.languageCode,
token: token ?? this.token,
);
}
}

View File

@@ -0,0 +1,11 @@
import 'package:news/utils/strings.dart';
class TagModel {
String? id, tagName;
TagModel({this.id, this.tagName});
factory TagModel.fromJson(Map<String, dynamic> json) {
return TagModel(id: json[ID].toString(), tagName: json[TAGNAME]);
}
}

View File

@@ -0,0 +1,24 @@
class WeatherDetails {
String? name;
String? region;
double? tempC;
String? text;
String? icon;
double? minTempC;
double? maxTempC;
String? country;
WeatherDetails({this.name, this.region, this.tempC, this.text, this.icon, this.maxTempC, this.minTempC, this.country});
factory WeatherDetails.fromJson(Map<String, dynamic> json) {
return WeatherDetails(
name: json["location"]["name"],
region: json["location"]["region"],
country: json["location"]["country"],
tempC: json["current"]["temp_c"],
text: json["current"]["condition"]["text"],
icon: json["current"]["condition"]["icon"],
maxTempC: json["forecast"]["forecastday"][0]["day"]["maxtemp_c"],
minTempC: json["forecast"]["forecastday"][0]["day"]["mintemp_c"]);
}
}

View File

@@ -0,0 +1,13 @@
import 'package:news/utils/strings.dart';
class AdSpaceModel {
String? id, adSpace, adFeaturedSectionId, adImage, adUrl;
AdSpaceModel({this.id, this.adSpace, this.adFeaturedSectionId, this.adImage, this.adUrl});
//place Ad just above mentioned adFeaturedSectionId
factory AdSpaceModel.fromJson(Map<String, dynamic> json) {
return AdSpaceModel(id: json[ID].toString(), adSpace: json[AD_SPACE], adFeaturedSectionId: json[AD_FEATURED_SECTION_ID].toString(), adImage: json[AD_IMAGE], adUrl: json[AD_URL]);
}
}

View File

@@ -0,0 +1,16 @@
import 'package:news/utils/strings.dart';
class LanguageModel {
String? id, language, languageDisplayName, image, code;
int? isRTL;
LanguageModel({this.id, this.image, this.language, this.languageDisplayName, this.code, this.isRTL});
factory LanguageModel.fromJson(Map<String, dynamic> json) {
return LanguageModel(
id: json[ID].toString(),
image: json[IMAGE],
language: json[LANGUAGE],
languageDisplayName: (json[DISPLAY_NAME_LANG] != "") ? json[DISPLAY_NAME_LANG] : json[LANGUAGE],
code: json[CODE],
isRTL: (json[ISRTL].runtimeType == int) ? json[ISRTL] : int.tryParse(json[ISRTL]));
}
}

View 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;
}
}

View File

@@ -0,0 +1,14 @@
import 'package:news/utils/strings.dart';
class LocationCityModel {
final String id;
final String locationName;
final String latitude;
final String longitude;
LocationCityModel({required this.latitude, required this.longitude, required this.id, required this.locationName});
factory LocationCityModel.fromJson(Map<String, dynamic> json) {
return LocationCityModel(id: json[ID].toString(), locationName: json[LOCATION_NAME], latitude: json[LATITUDE].toString(), longitude: json[LONGITUDE].toString());
}
}