This commit is contained in:
2025-02-11 17:55:17 +08:00
parent a4e2d4f6e4
commit c7d72347a9
6 changed files with 8 additions and 10 deletions

View File

@@ -742,7 +742,7 @@ class _SliverGridComicsState extends State<SliverGridComics> {
@override @override
void didUpdateWidget(covariant SliverGridComics oldWidget) { void didUpdateWidget(covariant SliverGridComics oldWidget) {
if (oldWidget.comics.isEqualsTo(widget.comics)) { if (oldWidget.comics.isEqualTo(widget.comics)) {
comics.clear(); comics.clear();
for (var comic in widget.comics) { for (var comic in widget.comics) {
if (isBlocked(comic) == null) { if (isBlocked(comic) == null) {

View File

@@ -32,7 +32,7 @@ class _CategoriesPageState extends State<CategoriesPage> {
.toList(); .toList();
categories = categories =
categories.where((element) => allCategories.contains(element)).toList(); categories.where((element) => allCategories.contains(element)).toList();
if (!categories.isEqualsTo(this.categories)) { if (!categories.isEqualTo(this.categories)) {
setState(() { setState(() {
this.categories = categories; this.categories = categories;
}); });

View File

@@ -37,7 +37,7 @@ class _ExplorePageState extends State<ExplorePage>
.expand((e) => e.map((e) => e.title)) .expand((e) => e.map((e) => e.title))
.toList(); .toList();
explorePages = explorePages.where((e) => all.contains(e)).toList(); explorePages = explorePages.where((e) => all.contains(e)).toList();
if (!pages.isEqualsTo(explorePages)) { if (!pages.isEqualTo(explorePages)) {
setState(() { setState(() {
pages = explorePages; pages = explorePages;
controller = TabController( controller = TabController(

View File

@@ -189,7 +189,7 @@ class _SearchPageState extends State<SearchPage> {
void updateSearchSourcesIfNeeded() { void updateSearchSourcesIfNeeded() {
var old = searchSources; var old = searchSources;
findSearchSources(); findSearchSources();
if (old.isEqualsTo(searchSources)) { if (old.isEqualTo(searchSources)) {
return; return;
} }
setState(() {}); setState(() {});

View File

@@ -196,7 +196,7 @@ class _SearchResultPageState extends State<SearchResultPage> {
return _SearchSettingsDialog(state: this); return _SearchSettingsDialog(state: this);
}, },
); );
if (!previousOptions.isEqualsTo(options) || if (!previousOptions.isEqualTo(options) ||
previousSourceKey != sourceKey) { previousSourceKey != sourceKey) {
text = checkAutoLanguage(controller.text); text = checkAutoLanguage(controller.text);
controller.currentText = text; controller.currentText = text;

View File

@@ -25,7 +25,9 @@ extension ListExt<T> on List<T>{
} }
} }
bool isEqualsTo(List<T> list){ /// Compare every element of this list with another list.
/// Return true if all elements are equal.
bool isEqualTo(List<T> list){
if(length != list.length){ if(length != list.length){
return false; return false;
} }
@@ -81,10 +83,6 @@ extension StringExt on String{
return '$before$to$after'; return '$before$to$after';
} }
static bool hasMatch(String? value, String pattern) {
return (value == null) ? false : RegExp(pattern).hasMatch(value);
}
bool _isURL(){ bool _isURL(){
final regex = RegExp( final regex = RegExp(
r'^((http|https|ftp)://)[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-|]*[\w@?^=%&/~+#-])?$', r'^((http|https|ftp)://)[\w-]+(\.[\w-]+)+([\w.,@?^=%&:/~+#-|]*[\w@?^=%&/~+#-])?$',