diff --git a/lib/common/service/dns_service.dart b/lib/common/service/dns_service.dart index 9ea6fca04..abe05f659 100644 --- a/lib/common/service/dns_service.dart +++ b/lib/common/service/dns_service.dart @@ -1,4 +1,3 @@ -import 'package:fehviewer/common/global.dart'; import 'package:fehviewer/const/const.dart'; import 'package:fehviewer/models/index.dart'; import 'package:fehviewer/utils/dns_util.dart'; diff --git a/lib/const/theme_colors.dart b/lib/const/theme_colors.dart index 2c2bb42fb..858182519 100644 --- a/lib/const/theme_colors.dart +++ b/lib/const/theme_colors.dart @@ -165,7 +165,7 @@ class ThemeColors { /// 深色灰黑 static CupertinoThemeData darkGrayTheme = CupertinoThemeData( brightness: Brightness.dark, - scaffoldBackgroundColor: Color.fromARGB(255, 30, 30, 30), + scaffoldBackgroundColor: const Color.fromARGB(255, 30, 30, 30), barBackgroundColor: navigationBarBackgroundGray, textTheme: ehTextTheme, ); @@ -240,9 +240,12 @@ class ThemeColors { static const CupertinoDynamicColor navigationBarBackgroundGray = CupertinoDynamicColor.withBrightness( - debugLabel: 'navigationBarBackground', + debugLabel: 'navigationBarBackgroundGray', + // color: Color.fromARGB(230, 35, 35, 35), color: Color.fromARGB(222, 249, 249, 249), darkColor: Color.fromARGB(230, 35, 35, 35), + // color: Color.fromARGB(222, 186, 27, 27), + // darkColor: Color.fromARGB(230, 21, 212, 75), ); static const Map colorRatingMap = { diff --git a/lib/models/dns_config.dart b/lib/models/dns_config.dart index fe7e27c79..6069cadd2 100644 --- a/lib/models/dns_config.dart +++ b/lib/models/dns_config.dart @@ -1,10 +1,9 @@ import 'package:flutter/foundation.dart'; -import 'dns_cache.dart'; + import 'dns_cache.dart'; @immutable class DnsConfig { - const DnsConfig({ this.enableDoH, this.enableCustomHosts, @@ -19,49 +18,69 @@ class DnsConfig { final List? hosts; final List? dohCache; - factory DnsConfig.fromJson(Map json) => DnsConfig( - enableDoH: json['enableDoH'] != null ? json['enableDoH'] as bool : null, - enableCustomHosts: json['enableCustomHosts'] != null ? json['enableCustomHosts'] as bool : null, - enableDomainFronting: json['enableDomainFronting'] != null ? json['enableDomainFronting'] as bool : null, - hosts: json['hosts'] != null ? (json['hosts'] as List? ?? []).map((e) => DnsCache.fromJson(e as Map)).toList() : null, - dohCache: json['dohCache'] != null ? (json['dohCache'] as List? ?? []).map((e) => DnsCache.fromJson(e as Map)).toList() : null - ); - + factory DnsConfig.fromJson(Map json) => DnsConfig( + enableDoH: json['enableDoH'] != null ? json['enableDoH'] as bool : null, + enableCustomHosts: json['enableCustomHosts'] != null + ? json['enableCustomHosts'] as bool + : null, + enableDomainFronting: json['enableDomainFronting'] != null + ? json['enableDomainFronting'] as bool + : null, + hosts: json['hosts'] != null + ? (json['hosts'] as List? ?? []) + .map((e) => DnsCache.fromJson(e as Map)) + .toList() + : null, + dohCache: json['dohCache'] != null + ? (json['dohCache'] as List? ?? []) + .map((e) => DnsCache.fromJson(e as Map)) + .toList() + : null); + Map toJson() => { - 'enableDoH': enableDoH, - 'enableCustomHosts': enableCustomHosts, - 'enableDomainFronting': enableDomainFronting, - 'hosts': hosts?.map((e) => e.toJson()).toList(), - 'dohCache': dohCache?.map((e) => e.toJson()).toList() - }; + 'enableDoH': enableDoH, + 'enableCustomHosts': enableCustomHosts, + 'enableDomainFronting': enableDomainFronting, + 'hosts': hosts?.map((e) => e.toJson()).toList(), + 'dohCache': dohCache?.map((e) => e.toJson()).toList() + }; DnsConfig clone() => DnsConfig( - enableDoH: enableDoH, - enableCustomHosts: enableCustomHosts, - enableDomainFronting: enableDomainFronting, - hosts: hosts?.map((e) => e.clone()).toList(), - dohCache: dohCache?.map((e) => e.clone()).toList() - ); + enableDoH: enableDoH, + enableCustomHosts: enableCustomHosts, + enableDomainFronting: enableDomainFronting, + hosts: hosts?.map((e) => e.clone()).toList(), + dohCache: dohCache?.map((e) => e.clone()).toList()); - - DnsConfig copyWith({ - bool? enableDoH, - bool? enableCustomHosts, - bool? enableDomainFronting, - List? hosts, - List? dohCache - }) => DnsConfig( - enableDoH: enableDoH ?? this.enableDoH, - enableCustomHosts: enableCustomHosts ?? this.enableCustomHosts, - enableDomainFronting: enableDomainFronting ?? this.enableDomainFronting, - hosts: hosts ?? this.hosts, - dohCache: dohCache ?? this.dohCache, - ); + DnsConfig copyWith( + {bool? enableDoH, + bool? enableCustomHosts, + bool? enableDomainFronting, + List? hosts, + List? dohCache}) => + DnsConfig( + enableDoH: enableDoH ?? this.enableDoH, + enableCustomHosts: enableCustomHosts ?? this.enableCustomHosts, + enableDomainFronting: enableDomainFronting ?? this.enableDomainFronting, + hosts: hosts ?? this.hosts, + dohCache: dohCache ?? this.dohCache, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is DnsConfig && enableDoH == other.enableDoH && enableCustomHosts == other.enableCustomHosts && enableDomainFronting == other.enableDomainFronting && hosts == other.hosts && dohCache == other.dohCache; + bool operator ==(Object other) => + identical(this, other) || + other is DnsConfig && + enableDoH == other.enableDoH && + enableCustomHosts == other.enableCustomHosts && + enableDomainFronting == other.enableDomainFronting && + hosts == other.hosts && + dohCache == other.dohCache; @override - int get hashCode => enableDoH.hashCode ^ enableCustomHosts.hashCode ^ enableDomainFronting.hashCode ^ hosts.hashCode ^ dohCache.hashCode; + int get hashCode => + enableDoH.hashCode ^ + enableCustomHosts.hashCode ^ + enableDomainFronting.hashCode ^ + hosts.hashCode ^ + dohCache.hashCode; } diff --git a/lib/models/gallery_comment.dart b/lib/models/gallery_comment.dart index efce0fb80..8606d42cb 100644 --- a/lib/models/gallery_comment.dart +++ b/lib/models/gallery_comment.dart @@ -1,9 +1,9 @@ import 'package:flutter/foundation.dart'; + import 'gallery_comment_span.dart'; @immutable class GalleryComment { - const GalleryComment({ required this.name, required this.time, @@ -26,69 +26,88 @@ class GalleryComment { final bool? canVote; final bool? showTranslate; - factory GalleryComment.fromJson(Map json) => GalleryComment( - name: json['name'] as String, - time: json['time'] as String, - span: (json['span'] as List? ?? []).map((e) => GalleryCommentSpan.fromJson(e as Map)).toList(), - score: json['score'] as String, - vote: json['vote'] != null ? json['vote'] as int : null, - id: json['id'] != null ? json['id'] as String : null, - canEdit: json['canEdit'] != null ? json['canEdit'] as bool : null, - canVote: json['canVote'] != null ? json['canVote'] as bool : null, - showTranslate: json['showTranslate'] != null ? json['showTranslate'] as bool : null - ); - + factory GalleryComment.fromJson(Map json) => GalleryComment( + name: json['name'] as String, + time: json['time'] as String, + span: (json['span'] as List? ?? []) + .map((e) => GalleryCommentSpan.fromJson(e as Map)) + .toList(), + score: json['score'] as String, + vote: json['vote'] != null ? json['vote'] as int : null, + id: json['id'] != null ? json['id'] as String : null, + canEdit: json['canEdit'] != null ? json['canEdit'] as bool : null, + canVote: json['canVote'] != null ? json['canVote'] as bool : null, + showTranslate: + json['showTranslate'] != null ? json['showTranslate'] as bool : null); + Map toJson() => { - 'name': name, - 'time': time, - 'span': span.map((e) => e.toJson()).toList(), - 'score': score, - 'vote': vote, - 'id': id, - 'canEdit': canEdit, - 'canVote': canVote, - 'showTranslate': showTranslate - }; + 'name': name, + 'time': time, + 'span': span.map((e) => e.toJson()).toList(), + 'score': score, + 'vote': vote, + 'id': id, + 'canEdit': canEdit, + 'canVote': canVote, + 'showTranslate': showTranslate + }; GalleryComment clone() => GalleryComment( - name: name, - time: time, - span: span.map((e) => e.clone()).toList(), - score: score, - vote: vote, - id: id, - canEdit: canEdit, - canVote: canVote, - showTranslate: showTranslate - ); + name: name, + time: time, + span: span.map((e) => e.clone()).toList(), + score: score, + vote: vote, + id: id, + canEdit: canEdit, + canVote: canVote, + showTranslate: showTranslate); - - GalleryComment copyWith({ - String? name, - String? time, - List? span, - String? score, - int? vote, - String? id, - bool? canEdit, - bool? canVote, - bool? showTranslate - }) => GalleryComment( - name: name ?? this.name, - time: time ?? this.time, - span: span ?? this.span, - score: score ?? this.score, - vote: vote ?? this.vote, - id: id ?? this.id, - canEdit: canEdit ?? this.canEdit, - canVote: canVote ?? this.canVote, - showTranslate: showTranslate ?? this.showTranslate, - ); + GalleryComment copyWith( + {String? name, + String? time, + List? span, + String? score, + int? vote, + String? id, + bool? canEdit, + bool? canVote, + bool? showTranslate}) => + GalleryComment( + name: name ?? this.name, + time: time ?? this.time, + span: span ?? this.span, + score: score ?? this.score, + vote: vote ?? this.vote, + id: id ?? this.id, + canEdit: canEdit ?? this.canEdit, + canVote: canVote ?? this.canVote, + showTranslate: showTranslate ?? this.showTranslate, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is GalleryComment && name == other.name && time == other.time && span == other.span && score == other.score && vote == other.vote && id == other.id && canEdit == other.canEdit && canVote == other.canVote && showTranslate == other.showTranslate; + bool operator ==(Object other) => + identical(this, other) || + other is GalleryComment && + name == other.name && + time == other.time && + span == other.span && + score == other.score && + vote == other.vote && + id == other.id && + canEdit == other.canEdit && + canVote == other.canVote && + showTranslate == other.showTranslate; @override - int get hashCode => name.hashCode ^ time.hashCode ^ span.hashCode ^ score.hashCode ^ vote.hashCode ^ id.hashCode ^ canEdit.hashCode ^ canVote.hashCode ^ showTranslate.hashCode; + int get hashCode => + name.hashCode ^ + time.hashCode ^ + span.hashCode ^ + score.hashCode ^ + vote.hashCode ^ + id.hashCode ^ + canEdit.hashCode ^ + canVote.hashCode ^ + showTranslate.hashCode; } diff --git a/lib/models/gallery_item.dart b/lib/models/gallery_item.dart index 338fcd0e3..cb75c6bef 100644 --- a/lib/models/gallery_item.dart +++ b/lib/models/gallery_item.dart @@ -1,13 +1,13 @@ import 'package:flutter/foundation.dart'; + +import 'gallery_comment.dart'; +import 'gallery_image.dart'; import 'gallery_torrent.dart'; import 'simple_tag.dart'; import 'tag_group.dart'; -import 'gallery_comment.dart'; -import 'gallery_image.dart'; @immutable class GalleryItem { - const GalleryItem({ this.gid, this.token, @@ -100,244 +100,373 @@ class GalleryItem { final int? lastViewTime; final int? pageOfList; - factory GalleryItem.fromJson(Map json) => GalleryItem( - gid: json['gid'] != null ? json['gid'] as String : null, - token: json['token'] != null ? json['token'] as String : null, - showKey: json['showKey'] != null ? json['showKey'] as String : null, - url: json['url'] != null ? json['url'] as String : null, - imgUrl: json['imgUrl'] != null ? json['imgUrl'] as String : null, - imgUrlL: json['imgUrlL'] != null ? json['imgUrlL'] as String : null, - imgHeight: json['imgHeight'] != null ? json['imgHeight'] as double : null, - imgWidth: json['imgWidth'] != null ? json['imgWidth'] as double : null, - japaneseTitle: json['japaneseTitle'] != null ? json['japaneseTitle'] as String : null, - englishTitle: json['englishTitle'] != null ? json['englishTitle'] as String : null, - category: json['category'] != null ? json['category'] as String : null, - uploader: json['uploader'] != null ? json['uploader'] as String : null, - posted: json['posted'] != null ? json['posted'] as String : null, - language: json['language'] != null ? json['language'] as String : null, - filecount: json['filecount'] != null ? json['filecount'] as String : null, - rating: json['rating'] != null ? json['rating'] as double : null, - ratingCount: json['ratingCount'] != null ? json['ratingCount'] as String : null, - torrentcount: json['torrentcount'] != null ? json['torrentcount'] as String : null, - torrents: json['torrents'] != null ? (json['torrents'] as List? ?? []).map((e) => GalleryTorrent.fromJson(e as Map)).toList() : null, - filesize: json['filesize'] != null ? json['filesize'] as int : null, - filesizeText: json['filesizeText'] != null ? json['filesizeText'] as String : null, - visible: json['visible'] != null ? json['visible'] as String : null, - parent: json['parent'] != null ? json['parent'] as String : null, - ratingFallBack: json['ratingFallBack'] != null ? json['ratingFallBack'] as double : null, - numberOfReviews: json['numberOfReviews'] != null ? json['numberOfReviews'] as String : null, - postTime: json['postTime'] != null ? json['postTime'] as String : null, - favoritedCount: json['favoritedCount'] != null ? json['favoritedCount'] as String : null, - favTitle: json['favTitle'] != null ? json['favTitle'] as String : null, - favcat: json['favcat'] != null ? json['favcat'] as String : null, - localFav: json['localFav'] != null ? json['localFav'] as bool : null, - simpleTags: json['simpleTags'] != null ? (json['simpleTags'] as List? ?? []).map((e) => SimpleTag.fromJson(e as Map)).toList() : null, - tagsFromApi: json['tagsFromApi'] != null ? (json['tagsFromApi'] as List? ?? []).map((e) => e as dynamic).toList() : null, - translated: json['translated'] != null ? json['translated'] as String : null, - tagGroup: json['tagGroup'] != null ? (json['tagGroup'] as List? ?? []).map((e) => TagGroup.fromJson(e as Map)).toList() : null, - galleryComment: json['galleryComment'] != null ? (json['galleryComment'] as List? ?? []).map((e) => GalleryComment.fromJson(e as Map)).toList() : null, - galleryImages: json['galleryImages'] != null ? (json['galleryImages'] as List? ?? []).map((e) => GalleryImage.fromJson(e as Map)).toList() : null, - apikey: json['apikey'] != null ? json['apikey'] as String : null, - apiuid: json['apiuid'] != null ? json['apiuid'] as String : null, - isRatinged: json['isRatinged'] != null ? json['isRatinged'] as bool : null, - colorRating: json['colorRating'] != null ? json['colorRating'] as String : null, - archiverLink: json['archiverLink'] != null ? json['archiverLink'] as String : null, - torrentLink: json['torrentLink'] != null ? json['torrentLink'] as String : null, - lastViewTime: json['lastViewTime'] != null ? json['lastViewTime'] as int : null, - pageOfList: json['pageOfList'] != null ? json['pageOfList'] as int : null - ); - + factory GalleryItem.fromJson(Map json) => GalleryItem( + gid: json['gid'] != null ? json['gid'] as String : null, + token: json['token'] != null ? json['token'] as String : null, + showKey: json['showKey'] != null ? json['showKey'] as String : null, + url: json['url'] != null ? json['url'] as String : null, + imgUrl: json['imgUrl'] != null ? json['imgUrl'] as String : null, + imgUrlL: json['imgUrlL'] != null ? json['imgUrlL'] as String : null, + imgHeight: json['imgHeight'] != null ? json['imgHeight'] as double : null, + imgWidth: json['imgWidth'] != null ? json['imgWidth'] as double : null, + japaneseTitle: json['japaneseTitle'] != null + ? json['japaneseTitle'] as String + : null, + englishTitle: + json['englishTitle'] != null ? json['englishTitle'] as String : null, + category: json['category'] != null ? json['category'] as String : null, + uploader: json['uploader'] != null ? json['uploader'] as String : null, + posted: json['posted'] != null ? json['posted'] as String : null, + language: json['language'] != null ? json['language'] as String : null, + filecount: json['filecount'] != null ? json['filecount'] as String : null, + rating: json['rating'] != null ? json['rating'] as double : null, + ratingCount: + json['ratingCount'] != null ? json['ratingCount'] as String : null, + torrentcount: + json['torrentcount'] != null ? json['torrentcount'] as String : null, + torrents: json['torrents'] != null + ? (json['torrents'] as List? ?? []) + .map((e) => GalleryTorrent.fromJson(e as Map)) + .toList() + : null, + filesize: json['filesize'] != null ? json['filesize'] as int : null, + filesizeText: + json['filesizeText'] != null ? json['filesizeText'] as String : null, + visible: json['visible'] != null ? json['visible'] as String : null, + parent: json['parent'] != null ? json['parent'] as String : null, + ratingFallBack: json['ratingFallBack'] != null + ? json['ratingFallBack'] as double + : null, + numberOfReviews: json['numberOfReviews'] != null + ? json['numberOfReviews'] as String + : null, + postTime: json['postTime'] != null ? json['postTime'] as String : null, + favoritedCount: json['favoritedCount'] != null + ? json['favoritedCount'] as String + : null, + favTitle: json['favTitle'] != null ? json['favTitle'] as String : null, + favcat: json['favcat'] != null ? json['favcat'] as String : null, + localFav: json['localFav'] != null ? json['localFav'] as bool : null, + simpleTags: json['simpleTags'] != null + ? (json['simpleTags'] as List? ?? []) + .map((e) => SimpleTag.fromJson(e as Map)) + .toList() + : null, + tagsFromApi: json['tagsFromApi'] != null + ? (json['tagsFromApi'] as List? ?? []) + .map((e) => e as dynamic) + .toList() + : null, + translated: + json['translated'] != null ? json['translated'] as String : null, + tagGroup: json['tagGroup'] != null + ? (json['tagGroup'] as List? ?? []) + .map((e) => TagGroup.fromJson(e as Map)) + .toList() + : null, + galleryComment: json['galleryComment'] != null + ? (json['galleryComment'] as List? ?? []) + .map((e) => GalleryComment.fromJson(e as Map)) + .toList() + : null, + galleryImages: json['galleryImages'] != null + ? (json['galleryImages'] as List? ?? []) + .map((e) => GalleryImage.fromJson(e as Map)) + .toList() + : null, + apikey: json['apikey'] != null ? json['apikey'] as String : null, + apiuid: json['apiuid'] != null ? json['apiuid'] as String : null, + isRatinged: + json['isRatinged'] != null ? json['isRatinged'] as bool : null, + colorRating: + json['colorRating'] != null ? json['colorRating'] as String : null, + archiverLink: + json['archiverLink'] != null ? json['archiverLink'] as String : null, + torrentLink: + json['torrentLink'] != null ? json['torrentLink'] as String : null, + lastViewTime: + json['lastViewTime'] != null ? json['lastViewTime'] as int : null, + pageOfList: + json['pageOfList'] != null ? json['pageOfList'] as int : null); + Map toJson() => { - 'gid': gid, - 'token': token, - 'showKey': showKey, - 'url': url, - 'imgUrl': imgUrl, - 'imgUrlL': imgUrlL, - 'imgHeight': imgHeight, - 'imgWidth': imgWidth, - 'japaneseTitle': japaneseTitle, - 'englishTitle': englishTitle, - 'category': category, - 'uploader': uploader, - 'posted': posted, - 'language': language, - 'filecount': filecount, - 'rating': rating, - 'ratingCount': ratingCount, - 'torrentcount': torrentcount, - 'torrents': torrents?.map((e) => e.toJson()).toList(), - 'filesize': filesize, - 'filesizeText': filesizeText, - 'visible': visible, - 'parent': parent, - 'ratingFallBack': ratingFallBack, - 'numberOfReviews': numberOfReviews, - 'postTime': postTime, - 'favoritedCount': favoritedCount, - 'favTitle': favTitle, - 'favcat': favcat, - 'localFav': localFav, - 'simpleTags': simpleTags?.map((e) => e.toJson()).toList(), - 'tagsFromApi': tagsFromApi?.map((e) => e.toString()).toList(), - 'translated': translated, - 'tagGroup': tagGroup?.map((e) => e.toJson()).toList(), - 'galleryComment': galleryComment?.map((e) => e.toJson()).toList(), - 'galleryImages': galleryImages?.map((e) => e.toJson()).toList(), - 'apikey': apikey, - 'apiuid': apiuid, - 'isRatinged': isRatinged, - 'colorRating': colorRating, - 'archiverLink': archiverLink, - 'torrentLink': torrentLink, - 'lastViewTime': lastViewTime, - 'pageOfList': pageOfList - }; + 'gid': gid, + 'token': token, + 'showKey': showKey, + 'url': url, + 'imgUrl': imgUrl, + 'imgUrlL': imgUrlL, + 'imgHeight': imgHeight, + 'imgWidth': imgWidth, + 'japaneseTitle': japaneseTitle, + 'englishTitle': englishTitle, + 'category': category, + 'uploader': uploader, + 'posted': posted, + 'language': language, + 'filecount': filecount, + 'rating': rating, + 'ratingCount': ratingCount, + 'torrentcount': torrentcount, + 'torrents': torrents?.map((e) => e.toJson()).toList(), + 'filesize': filesize, + 'filesizeText': filesizeText, + 'visible': visible, + 'parent': parent, + 'ratingFallBack': ratingFallBack, + 'numberOfReviews': numberOfReviews, + 'postTime': postTime, + 'favoritedCount': favoritedCount, + 'favTitle': favTitle, + 'favcat': favcat, + 'localFav': localFav, + 'simpleTags': simpleTags?.map((e) => e.toJson()).toList(), + 'tagsFromApi': tagsFromApi?.map((e) => e.toString()).toList(), + 'translated': translated, + 'tagGroup': tagGroup?.map((e) => e.toJson()).toList(), + 'galleryComment': galleryComment?.map((e) => e.toJson()).toList(), + 'galleryImages': galleryImages?.map((e) => e.toJson()).toList(), + 'apikey': apikey, + 'apiuid': apiuid, + 'isRatinged': isRatinged, + 'colorRating': colorRating, + 'archiverLink': archiverLink, + 'torrentLink': torrentLink, + 'lastViewTime': lastViewTime, + 'pageOfList': pageOfList + }; GalleryItem clone() => GalleryItem( - gid: gid, - token: token, - showKey: showKey, - url: url, - imgUrl: imgUrl, - imgUrlL: imgUrlL, - imgHeight: imgHeight, - imgWidth: imgWidth, - japaneseTitle: japaneseTitle, - englishTitle: englishTitle, - category: category, - uploader: uploader, - posted: posted, - language: language, - filecount: filecount, - rating: rating, - ratingCount: ratingCount, - torrentcount: torrentcount, - torrents: torrents?.map((e) => e.clone()).toList(), - filesize: filesize, - filesizeText: filesizeText, - visible: visible, - parent: parent, - ratingFallBack: ratingFallBack, - numberOfReviews: numberOfReviews, - postTime: postTime, - favoritedCount: favoritedCount, - favTitle: favTitle, - favcat: favcat, - localFav: localFav, - simpleTags: simpleTags?.map((e) => e.clone()).toList(), - tagsFromApi: tagsFromApi?.toList(), - translated: translated, - tagGroup: tagGroup?.map((e) => e.clone()).toList(), - galleryComment: galleryComment?.map((e) => e.clone()).toList(), - galleryImages: galleryImages?.map((e) => e.clone()).toList(), - apikey: apikey, - apiuid: apiuid, - isRatinged: isRatinged, - colorRating: colorRating, - archiverLink: archiverLink, - torrentLink: torrentLink, - lastViewTime: lastViewTime, - pageOfList: pageOfList - ); + gid: gid, + token: token, + showKey: showKey, + url: url, + imgUrl: imgUrl, + imgUrlL: imgUrlL, + imgHeight: imgHeight, + imgWidth: imgWidth, + japaneseTitle: japaneseTitle, + englishTitle: englishTitle, + category: category, + uploader: uploader, + posted: posted, + language: language, + filecount: filecount, + rating: rating, + ratingCount: ratingCount, + torrentcount: torrentcount, + torrents: torrents?.map((e) => e.clone()).toList(), + filesize: filesize, + filesizeText: filesizeText, + visible: visible, + parent: parent, + ratingFallBack: ratingFallBack, + numberOfReviews: numberOfReviews, + postTime: postTime, + favoritedCount: favoritedCount, + favTitle: favTitle, + favcat: favcat, + localFav: localFav, + simpleTags: simpleTags?.map((e) => e.clone()).toList(), + tagsFromApi: tagsFromApi?.toList(), + translated: translated, + tagGroup: tagGroup?.map((e) => e.clone()).toList(), + galleryComment: galleryComment?.map((e) => e.clone()).toList(), + galleryImages: galleryImages?.map((e) => e.clone()).toList(), + apikey: apikey, + apiuid: apiuid, + isRatinged: isRatinged, + colorRating: colorRating, + archiverLink: archiverLink, + torrentLink: torrentLink, + lastViewTime: lastViewTime, + pageOfList: pageOfList); - - GalleryItem copyWith({ - String? gid, - String? token, - String? showKey, - String? url, - String? imgUrl, - String? imgUrlL, - double? imgHeight, - double? imgWidth, - String? japaneseTitle, - String? englishTitle, - String? category, - String? uploader, - String? posted, - String? language, - String? filecount, - double? rating, - String? ratingCount, - String? torrentcount, - List? torrents, - int? filesize, - String? filesizeText, - String? visible, - String? parent, - double? ratingFallBack, - String? numberOfReviews, - String? postTime, - String? favoritedCount, - String? favTitle, - String? favcat, - bool? localFav, - List? simpleTags, - List? tagsFromApi, - String? translated, - List? tagGroup, - List? galleryComment, - List? galleryImages, - String? apikey, - String? apiuid, - bool? isRatinged, - String? colorRating, - String? archiverLink, - String? torrentLink, - int? lastViewTime, - int? pageOfList - }) => GalleryItem( - gid: gid ?? this.gid, - token: token ?? this.token, - showKey: showKey ?? this.showKey, - url: url ?? this.url, - imgUrl: imgUrl ?? this.imgUrl, - imgUrlL: imgUrlL ?? this.imgUrlL, - imgHeight: imgHeight ?? this.imgHeight, - imgWidth: imgWidth ?? this.imgWidth, - japaneseTitle: japaneseTitle ?? this.japaneseTitle, - englishTitle: englishTitle ?? this.englishTitle, - category: category ?? this.category, - uploader: uploader ?? this.uploader, - posted: posted ?? this.posted, - language: language ?? this.language, - filecount: filecount ?? this.filecount, - rating: rating ?? this.rating, - ratingCount: ratingCount ?? this.ratingCount, - torrentcount: torrentcount ?? this.torrentcount, - torrents: torrents ?? this.torrents, - filesize: filesize ?? this.filesize, - filesizeText: filesizeText ?? this.filesizeText, - visible: visible ?? this.visible, - parent: parent ?? this.parent, - ratingFallBack: ratingFallBack ?? this.ratingFallBack, - numberOfReviews: numberOfReviews ?? this.numberOfReviews, - postTime: postTime ?? this.postTime, - favoritedCount: favoritedCount ?? this.favoritedCount, - favTitle: favTitle ?? this.favTitle, - favcat: favcat ?? this.favcat, - localFav: localFav ?? this.localFav, - simpleTags: simpleTags ?? this.simpleTags, - tagsFromApi: tagsFromApi ?? this.tagsFromApi, - translated: translated ?? this.translated, - tagGroup: tagGroup ?? this.tagGroup, - galleryComment: galleryComment ?? this.galleryComment, - galleryImages: galleryImages ?? this.galleryImages, - apikey: apikey ?? this.apikey, - apiuid: apiuid ?? this.apiuid, - isRatinged: isRatinged ?? this.isRatinged, - colorRating: colorRating ?? this.colorRating, - archiverLink: archiverLink ?? this.archiverLink, - torrentLink: torrentLink ?? this.torrentLink, - lastViewTime: lastViewTime ?? this.lastViewTime, - pageOfList: pageOfList ?? this.pageOfList, - ); + GalleryItem copyWith( + {String? gid, + String? token, + String? showKey, + String? url, + String? imgUrl, + String? imgUrlL, + double? imgHeight, + double? imgWidth, + String? japaneseTitle, + String? englishTitle, + String? category, + String? uploader, + String? posted, + String? language, + String? filecount, + double? rating, + String? ratingCount, + String? torrentcount, + List? torrents, + int? filesize, + String? filesizeText, + String? visible, + String? parent, + double? ratingFallBack, + String? numberOfReviews, + String? postTime, + String? favoritedCount, + String? favTitle, + String? favcat, + bool? localFav, + List? simpleTags, + List? tagsFromApi, + String? translated, + List? tagGroup, + List? galleryComment, + List? galleryImages, + String? apikey, + String? apiuid, + bool? isRatinged, + String? colorRating, + String? archiverLink, + String? torrentLink, + int? lastViewTime, + int? pageOfList}) => + GalleryItem( + gid: gid ?? this.gid, + token: token ?? this.token, + showKey: showKey ?? this.showKey, + url: url ?? this.url, + imgUrl: imgUrl ?? this.imgUrl, + imgUrlL: imgUrlL ?? this.imgUrlL, + imgHeight: imgHeight ?? this.imgHeight, + imgWidth: imgWidth ?? this.imgWidth, + japaneseTitle: japaneseTitle ?? this.japaneseTitle, + englishTitle: englishTitle ?? this.englishTitle, + category: category ?? this.category, + uploader: uploader ?? this.uploader, + posted: posted ?? this.posted, + language: language ?? this.language, + filecount: filecount ?? this.filecount, + rating: rating ?? this.rating, + ratingCount: ratingCount ?? this.ratingCount, + torrentcount: torrentcount ?? this.torrentcount, + torrents: torrents ?? this.torrents, + filesize: filesize ?? this.filesize, + filesizeText: filesizeText ?? this.filesizeText, + visible: visible ?? this.visible, + parent: parent ?? this.parent, + ratingFallBack: ratingFallBack ?? this.ratingFallBack, + numberOfReviews: numberOfReviews ?? this.numberOfReviews, + postTime: postTime ?? this.postTime, + favoritedCount: favoritedCount ?? this.favoritedCount, + favTitle: favTitle ?? this.favTitle, + favcat: favcat ?? this.favcat, + localFav: localFav ?? this.localFav, + simpleTags: simpleTags ?? this.simpleTags, + tagsFromApi: tagsFromApi ?? this.tagsFromApi, + translated: translated ?? this.translated, + tagGroup: tagGroup ?? this.tagGroup, + galleryComment: galleryComment ?? this.galleryComment, + galleryImages: galleryImages ?? this.galleryImages, + apikey: apikey ?? this.apikey, + apiuid: apiuid ?? this.apiuid, + isRatinged: isRatinged ?? this.isRatinged, + colorRating: colorRating ?? this.colorRating, + archiverLink: archiverLink ?? this.archiverLink, + torrentLink: torrentLink ?? this.torrentLink, + lastViewTime: lastViewTime ?? this.lastViewTime, + pageOfList: pageOfList ?? this.pageOfList, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is GalleryItem && gid == other.gid && token == other.token && showKey == other.showKey && url == other.url && imgUrl == other.imgUrl && imgUrlL == other.imgUrlL && imgHeight == other.imgHeight && imgWidth == other.imgWidth && japaneseTitle == other.japaneseTitle && englishTitle == other.englishTitle && category == other.category && uploader == other.uploader && posted == other.posted && language == other.language && filecount == other.filecount && rating == other.rating && ratingCount == other.ratingCount && torrentcount == other.torrentcount && torrents == other.torrents && filesize == other.filesize && filesizeText == other.filesizeText && visible == other.visible && parent == other.parent && ratingFallBack == other.ratingFallBack && numberOfReviews == other.numberOfReviews && postTime == other.postTime && favoritedCount == other.favoritedCount && favTitle == other.favTitle && favcat == other.favcat && localFav == other.localFav && simpleTags == other.simpleTags && tagsFromApi == other.tagsFromApi && translated == other.translated && tagGroup == other.tagGroup && galleryComment == other.galleryComment && galleryImages == other.galleryImages && apikey == other.apikey && apiuid == other.apiuid && isRatinged == other.isRatinged && colorRating == other.colorRating && archiverLink == other.archiverLink && torrentLink == other.torrentLink && lastViewTime == other.lastViewTime && pageOfList == other.pageOfList; + bool operator ==(Object other) => + identical(this, other) || + other is GalleryItem && + gid == other.gid && + token == other.token && + showKey == other.showKey && + url == other.url && + imgUrl == other.imgUrl && + imgUrlL == other.imgUrlL && + imgHeight == other.imgHeight && + imgWidth == other.imgWidth && + japaneseTitle == other.japaneseTitle && + englishTitle == other.englishTitle && + category == other.category && + uploader == other.uploader && + posted == other.posted && + language == other.language && + filecount == other.filecount && + rating == other.rating && + ratingCount == other.ratingCount && + torrentcount == other.torrentcount && + torrents == other.torrents && + filesize == other.filesize && + filesizeText == other.filesizeText && + visible == other.visible && + parent == other.parent && + ratingFallBack == other.ratingFallBack && + numberOfReviews == other.numberOfReviews && + postTime == other.postTime && + favoritedCount == other.favoritedCount && + favTitle == other.favTitle && + favcat == other.favcat && + localFav == other.localFav && + simpleTags == other.simpleTags && + tagsFromApi == other.tagsFromApi && + translated == other.translated && + tagGroup == other.tagGroup && + galleryComment == other.galleryComment && + galleryImages == other.galleryImages && + apikey == other.apikey && + apiuid == other.apiuid && + isRatinged == other.isRatinged && + colorRating == other.colorRating && + archiverLink == other.archiverLink && + torrentLink == other.torrentLink && + lastViewTime == other.lastViewTime && + pageOfList == other.pageOfList; @override - int get hashCode => gid.hashCode ^ token.hashCode ^ showKey.hashCode ^ url.hashCode ^ imgUrl.hashCode ^ imgUrlL.hashCode ^ imgHeight.hashCode ^ imgWidth.hashCode ^ japaneseTitle.hashCode ^ englishTitle.hashCode ^ category.hashCode ^ uploader.hashCode ^ posted.hashCode ^ language.hashCode ^ filecount.hashCode ^ rating.hashCode ^ ratingCount.hashCode ^ torrentcount.hashCode ^ torrents.hashCode ^ filesize.hashCode ^ filesizeText.hashCode ^ visible.hashCode ^ parent.hashCode ^ ratingFallBack.hashCode ^ numberOfReviews.hashCode ^ postTime.hashCode ^ favoritedCount.hashCode ^ favTitle.hashCode ^ favcat.hashCode ^ localFav.hashCode ^ simpleTags.hashCode ^ tagsFromApi.hashCode ^ translated.hashCode ^ tagGroup.hashCode ^ galleryComment.hashCode ^ galleryImages.hashCode ^ apikey.hashCode ^ apiuid.hashCode ^ isRatinged.hashCode ^ colorRating.hashCode ^ archiverLink.hashCode ^ torrentLink.hashCode ^ lastViewTime.hashCode ^ pageOfList.hashCode; + int get hashCode => + gid.hashCode ^ + token.hashCode ^ + showKey.hashCode ^ + url.hashCode ^ + imgUrl.hashCode ^ + imgUrlL.hashCode ^ + imgHeight.hashCode ^ + imgWidth.hashCode ^ + japaneseTitle.hashCode ^ + englishTitle.hashCode ^ + category.hashCode ^ + uploader.hashCode ^ + posted.hashCode ^ + language.hashCode ^ + filecount.hashCode ^ + rating.hashCode ^ + ratingCount.hashCode ^ + torrentcount.hashCode ^ + torrents.hashCode ^ + filesize.hashCode ^ + filesizeText.hashCode ^ + visible.hashCode ^ + parent.hashCode ^ + ratingFallBack.hashCode ^ + numberOfReviews.hashCode ^ + postTime.hashCode ^ + favoritedCount.hashCode ^ + favTitle.hashCode ^ + favcat.hashCode ^ + localFav.hashCode ^ + simpleTags.hashCode ^ + tagsFromApi.hashCode ^ + translated.hashCode ^ + tagGroup.hashCode ^ + galleryComment.hashCode ^ + galleryImages.hashCode ^ + apikey.hashCode ^ + apiuid.hashCode ^ + isRatinged.hashCode ^ + colorRating.hashCode ^ + archiverLink.hashCode ^ + torrentLink.hashCode ^ + lastViewTime.hashCode ^ + pageOfList.hashCode; } diff --git a/lib/models/index.dart b/lib/models/index.dart index b52ec2c38..8fc614143 100644 --- a/lib/models/index.dart +++ b/lib/models/index.dart @@ -1,27 +1,27 @@ -export 'local_fav.dart'; -export 'eh_config.dart'; -export 'simple_tag.dart'; -export 'commit_vote_res.dart'; -export 'gallery_image.dart'; +export 'advance_search.dart'; export 'auto_lock.dart'; -export 'gallery_item.dart'; -export 'download_task_info.dart'; +export 'cache_config.dart'; +export 'commit_vote_res.dart'; +export 'dns_cache.dart'; export 'dns_config.dart'; +export 'download_config.dart'; +export 'download_task_info.dart'; +export 'eh_config.dart'; +export 'eh_profile.dart'; +export 'favcat.dart'; export 'gallery_cache.dart'; -export 'gallery_comment_span.dart'; -export 'uconfig.dart'; export 'gallery_comment.dart'; -export 'openl_translation.dart'; +export 'gallery_comment_span.dart'; +export 'gallery_image.dart'; +export 'gallery_item.dart'; export 'gallery_tag.dart'; -export 'dns_cache.dart'; -export 'tab_item.dart'; -export 'eh_profile.dart'; -export 'user.dart'; -export 'download_config.dart'; export 'gallery_torrent.dart'; -export 'advance_search.dart'; -export 'tag_group.dart'; -export 'tab_config.dart'; -export 'favcat.dart'; -export 'cache_config.dart'; +export 'local_fav.dart'; +export 'openl_translation.dart'; export 'profile.dart'; +export 'simple_tag.dart'; +export 'tab_config.dart'; +export 'tab_item.dart'; +export 'tag_group.dart'; +export 'uconfig.dart'; +export 'user.dart'; diff --git a/lib/models/local_fav.dart b/lib/models/local_fav.dart index c33626c6b..b292e33a9 100644 --- a/lib/models/local_fav.dart +++ b/lib/models/local_fav.dart @@ -1,37 +1,35 @@ import 'package:flutter/foundation.dart'; + import 'gallery_item.dart'; @immutable class LocalFav { - const LocalFav({ this.gallerys, }); final List? gallerys; - factory LocalFav.fromJson(Map json) => LocalFav( - gallerys: json['gallerys'] != null ? (json['gallerys'] as List? ?? []).map((e) => GalleryItem.fromJson(e as Map)).toList() : null - ); - - Map toJson() => { - 'gallerys': gallerys?.map((e) => e.toJson()).toList() - }; - - LocalFav clone() => LocalFav( - gallerys: gallerys?.map((e) => e.clone()).toList() - ); - - - LocalFav copyWith({ - List? gallerys - }) => LocalFav( - gallerys: gallerys ?? this.gallerys, - ); + factory LocalFav.fromJson(Map json) => LocalFav( + gallerys: json['gallerys'] != null + ? (json['gallerys'] as List? ?? []) + .map((e) => GalleryItem.fromJson(e as Map)) + .toList() + : null); + + Map toJson() => + {'gallerys': gallerys?.map((e) => e.toJson()).toList()}; + + LocalFav clone() => + LocalFav(gallerys: gallerys?.map((e) => e.clone()).toList()); + + LocalFav copyWith({List? gallerys}) => LocalFav( + gallerys: gallerys ?? this.gallerys, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is LocalFav && gallerys == other.gallerys; + bool operator ==(Object other) => + identical(this, other) || other is LocalFav && gallerys == other.gallerys; @override int get hashCode => gallerys.hashCode; diff --git a/lib/models/profile.dart b/lib/models/profile.dart index b954505c4..da0064e78 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -1,15 +1,15 @@ import 'package:flutter/foundation.dart'; -import 'eh_config.dart'; -import 'user.dart'; -import 'local_fav.dart'; + import 'advance_search.dart'; +import 'auto_lock.dart'; import 'dns_config.dart'; import 'download_config.dart'; -import 'auto_lock.dart'; +import 'eh_config.dart'; +import 'local_fav.dart'; +import 'user.dart'; @immutable class Profile { - const Profile({ required this.ehConfig, required this.user, @@ -38,84 +38,109 @@ class Profile { final DownloadConfig downloadConfig; final AutoLock autoLock; - factory Profile.fromJson(Map json) => Profile( - ehConfig: EhConfig.fromJson(json['ehConfig'] as Map), - user: User.fromJson(json['user'] as Map), - lastLogin: json['lastLogin'] as String, - locale: json['locale'] as String, - theme: json['theme'] as String, - searchText: (json['searchText'] as List? ?? []).map((e) => e as dynamic).toList(), - localFav: LocalFav.fromJson(json['localFav'] as Map), - enableAdvanceSearch: json['enableAdvanceSearch'] as bool, - advanceSearch: AdvanceSearch.fromJson(json['advanceSearch'] as Map), - dnsConfig: DnsConfig.fromJson(json['dnsConfig'] as Map), - downloadConfig: DownloadConfig.fromJson(json['downloadConfig'] as Map), - autoLock: AutoLock.fromJson(json['autoLock'] as Map) - ); - + factory Profile.fromJson(Map json) => Profile( + ehConfig: EhConfig.fromJson(json['ehConfig'] as Map), + user: User.fromJson(json['user'] as Map), + lastLogin: json['lastLogin'] as String, + locale: json['locale'] as String, + theme: json['theme'] as String, + searchText: + (json['searchText'] as List? ?? []).map((e) => e as dynamic).toList(), + localFav: LocalFav.fromJson(json['localFav'] as Map), + enableAdvanceSearch: json['enableAdvanceSearch'] as bool, + advanceSearch: + AdvanceSearch.fromJson(json['advanceSearch'] as Map), + dnsConfig: DnsConfig.fromJson(json['dnsConfig'] as Map), + downloadConfig: DownloadConfig.fromJson( + json['downloadConfig'] as Map), + autoLock: AutoLock.fromJson(json['autoLock'] as Map)); + Map toJson() => { - 'ehConfig': ehConfig.toJson(), - 'user': user.toJson(), - 'lastLogin': lastLogin, - 'locale': locale, - 'theme': theme, - 'searchText': searchText.map((e) => e.toString()).toList(), - 'localFav': localFav.toJson(), - 'enableAdvanceSearch': enableAdvanceSearch, - 'advanceSearch': advanceSearch.toJson(), - 'dnsConfig': dnsConfig.toJson(), - 'downloadConfig': downloadConfig.toJson(), - 'autoLock': autoLock.toJson() - }; + 'ehConfig': ehConfig.toJson(), + 'user': user.toJson(), + 'lastLogin': lastLogin, + 'locale': locale, + 'theme': theme, + 'searchText': searchText.map((e) => e.toString()).toList(), + 'localFav': localFav.toJson(), + 'enableAdvanceSearch': enableAdvanceSearch, + 'advanceSearch': advanceSearch.toJson(), + 'dnsConfig': dnsConfig.toJson(), + 'downloadConfig': downloadConfig.toJson(), + 'autoLock': autoLock.toJson() + }; Profile clone() => Profile( - ehConfig: ehConfig.clone(), - user: user.clone(), - lastLogin: lastLogin, - locale: locale, - theme: theme, - searchText: searchText.toList(), - localFav: localFav.clone(), - enableAdvanceSearch: enableAdvanceSearch, - advanceSearch: advanceSearch.clone(), - dnsConfig: dnsConfig.clone(), - downloadConfig: downloadConfig.clone(), - autoLock: autoLock.clone() - ); + ehConfig: ehConfig.clone(), + user: user.clone(), + lastLogin: lastLogin, + locale: locale, + theme: theme, + searchText: searchText.toList(), + localFav: localFav.clone(), + enableAdvanceSearch: enableAdvanceSearch, + advanceSearch: advanceSearch.clone(), + dnsConfig: dnsConfig.clone(), + downloadConfig: downloadConfig.clone(), + autoLock: autoLock.clone()); - - Profile copyWith({ - EhConfig? ehConfig, - User? user, - String? lastLogin, - String? locale, - String? theme, - List? searchText, - LocalFav? localFav, - bool? enableAdvanceSearch, - AdvanceSearch? advanceSearch, - DnsConfig? dnsConfig, - DownloadConfig? downloadConfig, - AutoLock? autoLock - }) => Profile( - ehConfig: ehConfig ?? this.ehConfig, - user: user ?? this.user, - lastLogin: lastLogin ?? this.lastLogin, - locale: locale ?? this.locale, - theme: theme ?? this.theme, - searchText: searchText ?? this.searchText, - localFav: localFav ?? this.localFav, - enableAdvanceSearch: enableAdvanceSearch ?? this.enableAdvanceSearch, - advanceSearch: advanceSearch ?? this.advanceSearch, - dnsConfig: dnsConfig ?? this.dnsConfig, - downloadConfig: downloadConfig ?? this.downloadConfig, - autoLock: autoLock ?? this.autoLock, - ); + Profile copyWith( + {EhConfig? ehConfig, + User? user, + String? lastLogin, + String? locale, + String? theme, + List? searchText, + LocalFav? localFav, + bool? enableAdvanceSearch, + AdvanceSearch? advanceSearch, + DnsConfig? dnsConfig, + DownloadConfig? downloadConfig, + AutoLock? autoLock}) => + Profile( + ehConfig: ehConfig ?? this.ehConfig, + user: user ?? this.user, + lastLogin: lastLogin ?? this.lastLogin, + locale: locale ?? this.locale, + theme: theme ?? this.theme, + searchText: searchText ?? this.searchText, + localFav: localFav ?? this.localFav, + enableAdvanceSearch: enableAdvanceSearch ?? this.enableAdvanceSearch, + advanceSearch: advanceSearch ?? this.advanceSearch, + dnsConfig: dnsConfig ?? this.dnsConfig, + downloadConfig: downloadConfig ?? this.downloadConfig, + autoLock: autoLock ?? this.autoLock, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is Profile && ehConfig == other.ehConfig && user == other.user && lastLogin == other.lastLogin && locale == other.locale && theme == other.theme && searchText == other.searchText && localFav == other.localFav && enableAdvanceSearch == other.enableAdvanceSearch && advanceSearch == other.advanceSearch && dnsConfig == other.dnsConfig && downloadConfig == other.downloadConfig && autoLock == other.autoLock; + bool operator ==(Object other) => + identical(this, other) || + other is Profile && + ehConfig == other.ehConfig && + user == other.user && + lastLogin == other.lastLogin && + locale == other.locale && + theme == other.theme && + searchText == other.searchText && + localFav == other.localFav && + enableAdvanceSearch == other.enableAdvanceSearch && + advanceSearch == other.advanceSearch && + dnsConfig == other.dnsConfig && + downloadConfig == other.downloadConfig && + autoLock == other.autoLock; @override - int get hashCode => ehConfig.hashCode ^ user.hashCode ^ lastLogin.hashCode ^ locale.hashCode ^ theme.hashCode ^ searchText.hashCode ^ localFav.hashCode ^ enableAdvanceSearch.hashCode ^ advanceSearch.hashCode ^ dnsConfig.hashCode ^ downloadConfig.hashCode ^ autoLock.hashCode; + int get hashCode => + ehConfig.hashCode ^ + user.hashCode ^ + lastLogin.hashCode ^ + locale.hashCode ^ + theme.hashCode ^ + searchText.hashCode ^ + localFav.hashCode ^ + enableAdvanceSearch.hashCode ^ + advanceSearch.hashCode ^ + dnsConfig.hashCode ^ + downloadConfig.hashCode ^ + autoLock.hashCode; } diff --git a/lib/models/tab_config.dart b/lib/models/tab_config.dart index fd922ef0e..f65c49a2f 100644 --- a/lib/models/tab_config.dart +++ b/lib/models/tab_config.dart @@ -1,37 +1,34 @@ import 'package:flutter/foundation.dart'; + import 'tab_item.dart'; @immutable class TabConfig { - const TabConfig({ required this.tabItemList, }); final List tabItemList; - factory TabConfig.fromJson(Map json) => TabConfig( - tabItemList: (json['tabItemList'] as List? ?? []).map((e) => TabItem.fromJson(e as Map)).toList() - ); - - Map toJson() => { - 'tabItemList': tabItemList.map((e) => e.toJson()).toList() - }; - - TabConfig clone() => TabConfig( - tabItemList: tabItemList.map((e) => e.clone()).toList() - ); - - - TabConfig copyWith({ - List? tabItemList - }) => TabConfig( - tabItemList: tabItemList ?? this.tabItemList, - ); + factory TabConfig.fromJson(Map json) => TabConfig( + tabItemList: (json['tabItemList'] as List? ?? []) + .map((e) => TabItem.fromJson(e as Map)) + .toList()); + + Map toJson() => + {'tabItemList': tabItemList.map((e) => e.toJson()).toList()}; + + TabConfig clone() => + TabConfig(tabItemList: tabItemList.map((e) => e.clone()).toList()); + + TabConfig copyWith({List? tabItemList}) => TabConfig( + tabItemList: tabItemList ?? this.tabItemList, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is TabConfig && tabItemList == other.tabItemList; + bool operator ==(Object other) => + identical(this, other) || + other is TabConfig && tabItemList == other.tabItemList; @override int get hashCode => tabItemList.hashCode; diff --git a/lib/models/tag_group.dart b/lib/models/tag_group.dart index 0153321e1..c72e175ac 100644 --- a/lib/models/tag_group.dart +++ b/lib/models/tag_group.dart @@ -1,9 +1,9 @@ import 'package:flutter/foundation.dart'; + import 'gallery_tag.dart'; @immutable class TagGroup { - const TagGroup({ this.tagType, required this.galleryTags, @@ -12,33 +12,33 @@ class TagGroup { final String? tagType; final List galleryTags; - factory TagGroup.fromJson(Map json) => TagGroup( - tagType: json['tagType'] != null ? json['tagType'] as String : null, - galleryTags: (json['galleryTags'] as List? ?? []).map((e) => GalleryTag.fromJson(e as Map)).toList() - ); - + factory TagGroup.fromJson(Map json) => TagGroup( + tagType: json['tagType'] != null ? json['tagType'] as String : null, + galleryTags: (json['galleryTags'] as List? ?? []) + .map((e) => GalleryTag.fromJson(e as Map)) + .toList()); + Map toJson() => { - 'tagType': tagType, - 'galleryTags': galleryTags.map((e) => e.toJson()).toList() - }; + 'tagType': tagType, + 'galleryTags': galleryTags.map((e) => e.toJson()).toList() + }; TagGroup clone() => TagGroup( - tagType: tagType, - galleryTags: galleryTags.map((e) => e.clone()).toList() - ); - - - TagGroup copyWith({ - String? tagType, - List? galleryTags - }) => TagGroup( - tagType: tagType ?? this.tagType, - galleryTags: galleryTags ?? this.galleryTags, - ); + tagType: tagType, + galleryTags: galleryTags.map((e) => e.clone()).toList()); + + TagGroup copyWith({String? tagType, List? galleryTags}) => + TagGroup( + tagType: tagType ?? this.tagType, + galleryTags: galleryTags ?? this.galleryTags, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is TagGroup && tagType == other.tagType && galleryTags == other.galleryTags; + bool operator ==(Object other) => + identical(this, other) || + other is TagGroup && + tagType == other.tagType && + galleryTags == other.galleryTags; @override int get hashCode => tagType.hashCode ^ galleryTags.hashCode; diff --git a/lib/models/uconfig.dart b/lib/models/uconfig.dart index a6d44ca1c..e36a835cc 100644 --- a/lib/models/uconfig.dart +++ b/lib/models/uconfig.dart @@ -1,9 +1,9 @@ import 'package:flutter/foundation.dart'; + import 'eh_profile.dart'; @immutable class Uconfig { - const Uconfig({ required this.profilelist, required this.profileSelected, @@ -18,49 +18,62 @@ class Uconfig { final int? thumbnailSize; final int? thumbnailRows; - factory Uconfig.fromJson(Map json) => Uconfig( - profilelist: (json['profilelist'] as List? ?? []).map((e) => EhProfile.fromJson(e as Map)).toList(), - profileSelected: json['profileSelected'] as String, - nameDisplay: json['nameDisplay'] != null ? json['nameDisplay'] as int : null, - thumbnailSize: json['thumbnailSize'] != null ? json['thumbnailSize'] as int : null, - thumbnailRows: json['thumbnailRows'] != null ? json['thumbnailRows'] as int : null - ); - + factory Uconfig.fromJson(Map json) => Uconfig( + profilelist: (json['profilelist'] as List? ?? []) + .map((e) => EhProfile.fromJson(e as Map)) + .toList(), + profileSelected: json['profileSelected'] as String, + nameDisplay: + json['nameDisplay'] != null ? json['nameDisplay'] as int : null, + thumbnailSize: + json['thumbnailSize'] != null ? json['thumbnailSize'] as int : null, + thumbnailRows: + json['thumbnailRows'] != null ? json['thumbnailRows'] as int : null); + Map toJson() => { - 'profilelist': profilelist.map((e) => e.toJson()).toList(), - 'profileSelected': profileSelected, - 'nameDisplay': nameDisplay, - 'thumbnailSize': thumbnailSize, - 'thumbnailRows': thumbnailRows - }; + 'profilelist': profilelist.map((e) => e.toJson()).toList(), + 'profileSelected': profileSelected, + 'nameDisplay': nameDisplay, + 'thumbnailSize': thumbnailSize, + 'thumbnailRows': thumbnailRows + }; Uconfig clone() => Uconfig( - profilelist: profilelist.map((e) => e.clone()).toList(), - profileSelected: profileSelected, - nameDisplay: nameDisplay, - thumbnailSize: thumbnailSize, - thumbnailRows: thumbnailRows - ); + profilelist: profilelist.map((e) => e.clone()).toList(), + profileSelected: profileSelected, + nameDisplay: nameDisplay, + thumbnailSize: thumbnailSize, + thumbnailRows: thumbnailRows); - - Uconfig copyWith({ - List? profilelist, - String? profileSelected, - int? nameDisplay, - int? thumbnailSize, - int? thumbnailRows - }) => Uconfig( - profilelist: profilelist ?? this.profilelist, - profileSelected: profileSelected ?? this.profileSelected, - nameDisplay: nameDisplay ?? this.nameDisplay, - thumbnailSize: thumbnailSize ?? this.thumbnailSize, - thumbnailRows: thumbnailRows ?? this.thumbnailRows, - ); + Uconfig copyWith( + {List? profilelist, + String? profileSelected, + int? nameDisplay, + int? thumbnailSize, + int? thumbnailRows}) => + Uconfig( + profilelist: profilelist ?? this.profilelist, + profileSelected: profileSelected ?? this.profileSelected, + nameDisplay: nameDisplay ?? this.nameDisplay, + thumbnailSize: thumbnailSize ?? this.thumbnailSize, + thumbnailRows: thumbnailRows ?? this.thumbnailRows, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is Uconfig && profilelist == other.profilelist && profileSelected == other.profileSelected && nameDisplay == other.nameDisplay && thumbnailSize == other.thumbnailSize && thumbnailRows == other.thumbnailRows; + bool operator ==(Object other) => + identical(this, other) || + other is Uconfig && + profilelist == other.profilelist && + profileSelected == other.profileSelected && + nameDisplay == other.nameDisplay && + thumbnailSize == other.thumbnailSize && + thumbnailRows == other.thumbnailRows; @override - int get hashCode => profilelist.hashCode ^ profileSelected.hashCode ^ nameDisplay.hashCode ^ thumbnailSize.hashCode ^ thumbnailRows.hashCode; + int get hashCode => + profilelist.hashCode ^ + profileSelected.hashCode ^ + nameDisplay.hashCode ^ + thumbnailSize.hashCode ^ + thumbnailRows.hashCode; } diff --git a/lib/models/user.dart b/lib/models/user.dart index d30002ff2..9b31a0da9 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -1,9 +1,9 @@ import 'package:flutter/foundation.dart'; + import 'favcat.dart'; @immutable class User { - const User({ this.username, this.nickName, @@ -24,64 +24,82 @@ class User { final String? avatarUrl; final List? favcat; - factory User.fromJson(Map json) => User( - username: json['username'] != null ? json['username'] as String : null, - nickName: json['nickName'] != null ? json['nickName'] as String : null, - memberId: json['memberId'] != null ? json['memberId'] as String : null, - passHash: json['passHash'] != null ? json['passHash'] as String : null, - igneous: json['igneous'] != null ? json['igneous'] as String : null, - cookie: json['cookie'] != null ? json['cookie'] as String : null, - avatarUrl: json['avatarUrl'] != null ? json['avatarUrl'] as String : null, - favcat: json['favcat'] != null ? (json['favcat'] as List? ?? []).map((e) => Favcat.fromJson(e as Map)).toList() : null - ); - + factory User.fromJson(Map json) => User( + username: json['username'] != null ? json['username'] as String : null, + nickName: json['nickName'] != null ? json['nickName'] as String : null, + memberId: json['memberId'] != null ? json['memberId'] as String : null, + passHash: json['passHash'] != null ? json['passHash'] as String : null, + igneous: json['igneous'] != null ? json['igneous'] as String : null, + cookie: json['cookie'] != null ? json['cookie'] as String : null, + avatarUrl: json['avatarUrl'] != null ? json['avatarUrl'] as String : null, + favcat: json['favcat'] != null + ? (json['favcat'] as List? ?? []) + .map((e) => Favcat.fromJson(e as Map)) + .toList() + : null); + Map toJson() => { - 'username': username, - 'nickName': nickName, - 'memberId': memberId, - 'passHash': passHash, - 'igneous': igneous, - 'cookie': cookie, - 'avatarUrl': avatarUrl, - 'favcat': favcat?.map((e) => e.toJson()).toList() - }; + 'username': username, + 'nickName': nickName, + 'memberId': memberId, + 'passHash': passHash, + 'igneous': igneous, + 'cookie': cookie, + 'avatarUrl': avatarUrl, + 'favcat': favcat?.map((e) => e.toJson()).toList() + }; User clone() => User( - username: username, - nickName: nickName, - memberId: memberId, - passHash: passHash, - igneous: igneous, - cookie: cookie, - avatarUrl: avatarUrl, - favcat: favcat?.map((e) => e.clone()).toList() - ); + username: username, + nickName: nickName, + memberId: memberId, + passHash: passHash, + igneous: igneous, + cookie: cookie, + avatarUrl: avatarUrl, + favcat: favcat?.map((e) => e.clone()).toList()); - - User copyWith({ - String? username, - String? nickName, - String? memberId, - String? passHash, - String? igneous, - String? cookie, - String? avatarUrl, - List? favcat - }) => User( - username: username ?? this.username, - nickName: nickName ?? this.nickName, - memberId: memberId ?? this.memberId, - passHash: passHash ?? this.passHash, - igneous: igneous ?? this.igneous, - cookie: cookie ?? this.cookie, - avatarUrl: avatarUrl ?? this.avatarUrl, - favcat: favcat ?? this.favcat, - ); + User copyWith( + {String? username, + String? nickName, + String? memberId, + String? passHash, + String? igneous, + String? cookie, + String? avatarUrl, + List? favcat}) => + User( + username: username ?? this.username, + nickName: nickName ?? this.nickName, + memberId: memberId ?? this.memberId, + passHash: passHash ?? this.passHash, + igneous: igneous ?? this.igneous, + cookie: cookie ?? this.cookie, + avatarUrl: avatarUrl ?? this.avatarUrl, + favcat: favcat ?? this.favcat, + ); @override - bool operator ==(Object other) => identical(this, other) - || other is User && username == other.username && nickName == other.nickName && memberId == other.memberId && passHash == other.passHash && igneous == other.igneous && cookie == other.cookie && avatarUrl == other.avatarUrl && favcat == other.favcat; + bool operator ==(Object other) => + identical(this, other) || + other is User && + username == other.username && + nickName == other.nickName && + memberId == other.memberId && + passHash == other.passHash && + igneous == other.igneous && + cookie == other.cookie && + avatarUrl == other.avatarUrl && + favcat == other.favcat; @override - int get hashCode => username.hashCode ^ nickName.hashCode ^ memberId.hashCode ^ passHash.hashCode ^ igneous.hashCode ^ cookie.hashCode ^ avatarUrl.hashCode ^ favcat.hashCode; + int get hashCode => + username.hashCode ^ + nickName.hashCode ^ + memberId.hashCode ^ + passHash.hashCode ^ + igneous.hashCode ^ + cookie.hashCode ^ + avatarUrl.hashCode ^ + favcat.hashCode; } diff --git a/lib/pages/gallery/view/gallery_widget.dart b/lib/pages/gallery/view/gallery_widget.dart index 00d331f42..a3508934c 100644 --- a/lib/pages/gallery/view/gallery_widget.dart +++ b/lib/pages/gallery/view/gallery_widget.dart @@ -19,7 +19,6 @@ import 'package:fehviewer/route/routes.dart'; // import 'package:fehviewer/utils/cust_lib/selectable_text.dart'; import 'package:fehviewer/utils/logger.dart'; import 'package:fehviewer/widget/eh_cached_network_image.dart'; -import 'package:fehviewer/widget/network_extended_image.dart'; import 'package:fehviewer/widget/rating_bar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/pages/gallery/view/taginfo_dialog.dart b/lib/pages/gallery/view/taginfo_dialog.dart index 42ad4fb22..8786ffccc 100644 --- a/lib/pages/gallery/view/taginfo_dialog.dart +++ b/lib/pages/gallery/view/taginfo_dialog.dart @@ -10,7 +10,6 @@ import 'package:fehviewer/store/floor/entity/tag_translat.dart'; import 'package:fehviewer/utils/logger.dart'; import 'package:fehviewer/utils/vibrate.dart'; import 'package:fehviewer/widget/eh_cached_network_image.dart'; -import 'package:fehviewer/widget/network_extended_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; diff --git a/lib/pages/item/gallery_item.dart b/lib/pages/item/gallery_item.dart index efb1f1a21..d800c1ebd 100644 --- a/lib/pages/item/gallery_item.dart +++ b/lib/pages/item/gallery_item.dart @@ -8,7 +8,6 @@ import 'package:fehviewer/models/index.dart'; import 'package:fehviewer/pages/item/controller/galleryitem_controller.dart'; import 'package:fehviewer/utils/utility.dart'; import 'package:fehviewer/widget/blur_image.dart'; -import 'package:fehviewer/widget/network_extended_image.dart'; import 'package:fehviewer/widget/rating_bar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/pages/item/gallery_item_simple.dart b/lib/pages/item/gallery_item_simple.dart index 1f99932e4..fdb738d79 100644 --- a/lib/pages/item/gallery_item_simple.dart +++ b/lib/pages/item/gallery_item_simple.dart @@ -1,18 +1,14 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:fehviewer/common/global.dart'; import 'package:fehviewer/common/service/ehconfig_service.dart'; import 'package:fehviewer/const/theme_colors.dart'; import 'package:fehviewer/models/base/eh_models.dart'; import 'package:fehviewer/pages/item/controller/galleryitem_controller.dart'; import 'package:fehviewer/widget/blur_image.dart'; import 'package:fehviewer/widget/eh_cached_network_image.dart'; -import 'package:fehviewer/widget/network_extended_image.dart'; import 'package:fehviewer/widget/rating_bar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get.dart'; -import 'package:fehviewer/common/exts.dart'; const double kCoverImageWidth = 70.0; const double kItemWidth = 115.0; diff --git a/lib/pages/item/user_item.dart b/lib/pages/item/user_item.dart index 7e19818a6..34b02e475 100644 --- a/lib/pages/item/user_item.dart +++ b/lib/pages/item/user_item.dart @@ -1,7 +1,5 @@ // import 'package:cached_network_image/cached_network_image.dart'; -import 'package:extended_image/extended_image.dart'; import 'package:fehviewer/common/controller/user_controller.dart'; -import 'package:fehviewer/common/exts.dart'; import 'package:fehviewer/common/service/theme_service.dart'; import 'package:fehviewer/generated/l10n.dart'; import 'package:fehviewer/route/routes.dart'; diff --git a/lib/pages/tab/view/search_page_new.dart b/lib/pages/tab/view/search_page_new.dart index 1d11c730e..badbb3ac1 100644 --- a/lib/pages/tab/view/search_page_new.dart +++ b/lib/pages/tab/view/search_page_new.dart @@ -144,17 +144,15 @@ class GallerySearchPageNew extends StatelessWidget { navigationBar: GetPlatform.isAndroid ? getNavigationBar(context) : null, child: Column( children: [ - // getSearchTextFieldIn().paddingOnly(top: 100), if (GetPlatform.isAndroid) SafeArea( child: Container( decoration: BoxDecoration( border: _kDefaultNavBarBorder, - color: ehTheme.themeData!.barBackgroundColor, + color: CupertinoTheme.of(context).barBackgroundColor, ), - child: - const SearchTextFieldIn(iconOpacity: 1.0, multiline: true) - .paddingSymmetric(horizontal: 12, vertical: 4), + child: SearchTextFieldIn(iconOpacity: 1.0, multiline: true) + .paddingSymmetric(horizontal: 12, vertical: 4), ), ), Expanded(child: _buildSearchRult(context)), @@ -328,10 +326,10 @@ class GallerySearchPageNew extends StatelessWidget { ), padding: const EdgeInsets.symmetric(horizontal: 8), child: Row( - children: const [ + children: [ Expanded( child: Padding( - padding: EdgeInsets.only(left: 4, top: 4, bottom: 4), + padding: const EdgeInsets.only(left: 4, top: 4, bottom: 4), child: SearchTextFieldIn(multiline: true), ), ), @@ -698,7 +696,7 @@ class GallerySearchPageNew extends StatelessWidget { } class SearchTextFieldIn extends StatelessWidget { - const SearchTextFieldIn({ + SearchTextFieldIn({ Key? key, this.multiline = false, this.iconOpacity = 0.0, diff --git a/lib/widget/eh_cached_network_image.dart b/lib/widget/eh_cached_network_image.dart index f42d2dec2..14ed6a0e7 100644 --- a/lib/widget/eh_cached_network_image.dart +++ b/lib/widget/eh_cached_network_image.dart @@ -1,7 +1,7 @@ import 'package:cached_network_image/cached_network_image.dart'; +import 'package:fehviewer/common/exts.dart'; import 'package:fehviewer/common/global.dart'; import 'package:flutter/cupertino.dart'; -import 'package:fehviewer/common/exts.dart'; class EhCachedNetworkImage extends StatelessWidget { const EhCachedNetworkImage({ diff --git a/pubspec.yaml b/pubspec.yaml index 52ee2d2f9..9c384ebbc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: fehviewer publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.1.20+240 +version: 1.1.20+241 environment: sdk: '>=2.13.0 <3.0.0'