Skip to content

Commit 5fbcef4

Browse files
committed
Fix the bug that the gallery language is displayed incorrectly on the details page when the gallery list layout
that does not select to display tags 修复在未选择显示标签的画廊列表布局时,详情页画廊语言展示错误的bug
1 parent 4fa8dff commit 5fbcef4

File tree

6 files changed

+40
-16
lines changed

6 files changed

+40
-16
lines changed

changelog/v7.4.11+150.md

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- 修复iOS下更新版本后保存原图失败的bug
2020
- 修复手动重新下载的状态bug
2121
- 修复瀑布流布局下图片周围存在空白区域的bug
22+
- 修复在未选择显示标签的画廊列表布局时,详情页画廊语言展示错误的bug
2223
- 升级数据库组件、网络组件、缓存组件、cookie组件
2324

2425
------------------------------------------------------------------------------------------
@@ -47,4 +48,6 @@
4748
- Fix the bug that saving the original image fails after updating the version on iOS
4849
- Fix the bug that the status of manual re-download is incorrect
4950
- Fix the bug that there is a blank area around the image in the waterfall layout
51+
- Fix the bug that the gallery language is displayed incorrectly on the details page when the gallery list layout
52+
that does not select to display tags
5053
- Upgrade database component, network component, cache component, cookie component

lib/src/model/gallery_detail.dart

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'gallery_thumbnail.dart';
99
class GalleryDetail {
1010
String rawTitle;
1111
String? japaneseTitle;
12+
String language;
1213
int ratingCount;
1314
double realRating;
1415
String size;
@@ -30,6 +31,7 @@ class GalleryDetail {
3031
GalleryDetail({
3132
required this.rawTitle,
3233
this.japaneseTitle,
34+
required this.language,
3335
required this.ratingCount,
3436
required this.realRating,
3537
required this.size,

lib/src/pages/details/details_page.dart

+28-15
Original file line numberDiff line numberDiff line change
@@ -426,24 +426,37 @@ class DetailsPage extends StatelessWidget with Scroll2TopPageMixin {
426426

427427
Widget _buildLanguage(double iconSize, double space, BuildContext context) {
428428
return GetBuilder<DetailsPageLogic>(
429-
id: DetailsPageLogic.galleryId,
429+
id: DetailsPageLogic.languageId,
430430
global: false,
431431
init: logic,
432-
builder: (_) => Row(
433-
mainAxisSize: MainAxisSize.min,
434-
children: [
435-
Icon(Icons.language, size: iconSize, color: UIConfig.detailsPageIconColor(context)),
436-
SizedBox(width: space),
437-
AnimatedSwitcher(
438-
duration: const Duration(milliseconds: UIConfig.detailsPageAnimationDuration),
439-
child: Text(
440-
state.gallery == null ? '...' : state.gallery!.language?.capitalizeFirst ?? 'Japanese',
441-
key: ValueKey(state.gallery == null ? '...' : state.gallery!.language?.capitalizeFirst ?? 'Japanese'),
442-
style: const TextStyle(fontSize: UIConfig.detailsPageInfoTextSize),
432+
builder: (_) {
433+
String language;
434+
if (state.galleryDetails != null) {
435+
language = state.galleryDetails!.language.capitalizeFirst!;
436+
} else if (state.gallery?.language != null) {
437+
language = state.gallery!.language!.capitalizeFirst!;
438+
} else if (state.gallery?.tags.isNotEmpty ?? false) {
439+
language = 'Japanese';
440+
} else {
441+
language = '...';
442+
}
443+
444+
return Row(
445+
mainAxisSize: MainAxisSize.min,
446+
children: [
447+
Icon(Icons.language, size: iconSize, color: UIConfig.detailsPageIconColor(context)),
448+
SizedBox(width: space),
449+
AnimatedSwitcher(
450+
duration: const Duration(milliseconds: UIConfig.detailsPageAnimationDuration),
451+
child: Text(
452+
language,
453+
key: ValueKey(language),
454+
style: const TextStyle(fontSize: UIConfig.detailsPageInfoTextSize),
455+
),
443456
),
444-
),
445-
],
446-
),
457+
],
458+
);
459+
},
447460
);
448461
}
449462

lib/src/pages/details/details_page_logic.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ import '../../widget/eh_download_dialog.dart';
5959
import '../../widget/eh_download_hh_dialog.dart';
6060
import '../../widget/eh_gallery_history_dialog.dart';
6161
import '../../widget/jump_page_dialog.dart';
62-
import '../download/list/local/local_gallery_list_page_logic.dart';
6362
import 'details_page_state.dart';
6463

6564
class DetailsPageLogic extends GetxController with LoginRequiredMixin, Scroll2TopLogicMixin, UpdateGlobalGalleryStatusLogicMixin {
6665
static const String galleryId = 'galleryId';
6766
static const String uploaderId = 'uploaderId';
6867
static const String detailsId = 'detailsId';
68+
static const String languageId = 'languageId';
6969
static const String pageCountId = 'pageCountId';
7070
static const String ratingId = 'ratingId';
7171
static const String favoriteId = 'favoriteId';
@@ -788,6 +788,10 @@ class DetailsPageLogic extends GetxController with LoginRequiredMixin, Scroll2To
788788
return;
789789
}
790790

791+
if (state.gallery?.language == null) {
792+
updateIds.add(languageId);
793+
}
794+
791795
/// page count is null in favorite page
792796
if (state.gallery?.pageCount != newGallery.pageCount) {
793797
state.gallery?.pageCount = newGallery.pageCount;

lib/src/pages/setting/style/theme_color/preview_page/detail_preview_page.dart

+1
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ class DetailsPreviewPageState extends DetailsPageState {
295295

296296
galleryDetails = GalleryDetail(
297297
rawTitle: 'Title - This is the detail preview page',
298+
language: 'Chinese',
298299
ratingCount: 666,
299300
realRating: 4,
300301
size: '66.66MB',

lib/src/utils/eh_spider_parser.dart

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ class EHSpiderParser {
253253
GalleryDetail galleryDetail = GalleryDetail(
254254
rawTitle: document.querySelector('#gn')!.text,
255255
japaneseTitle: document.querySelector('#gj')!.text,
256+
language: document.querySelector('#gdd > table > tbody')?.children[3].children[1].nodes[0].text?.trim() ?? '',
256257
ratingCount: int.parse(document.querySelector('#rating_count')?.text ?? '0'),
257258
realRating: _parseGalleryDetailsRealRating(document),
258259
size: document.querySelector('#gdd > table > tbody')?.children[4].children[1].text ?? '',

0 commit comments

Comments
 (0)