Skip to content

Commit

Permalink
glance
Browse files Browse the repository at this point in the history
  • Loading branch information
Notsfsssf committed Aug 10, 2024
1 parent 19cf6d4 commit 6fca314
Show file tree
Hide file tree
Showing 29 changed files with 186 additions and 109 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ android {
applicationId packageName
minSdkVersion 21
targetSdkVersion 34
versionCode 10009440
versionName "0.9.44 Ta"
versionCode 10009450
versionName "0.9.45 hon"
ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' }
}
compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private fun updateWidget(
val request = ImageRequest.Builder(context)
.data(trueUrl)
.transformations(RoundedCornersTransformation(radius))
.size(540, 540)
.setHeader("referer", "https://app-api.pixiv.net/")
.setHeader("User-Agent", "PixivIOSApp/5.8.0")
.setHeader("host", Uri.parse(trueUrl).host!!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ private fun updateWidget(
.setHeader("referer", "https://app-api.pixiv.net/")
.setHeader("User-Agent", "PixivIOSApp/5.8.0")
.setHeader("host", Uri.parse(trueUrl).host!!)
.size(540, 540)
.listener(onError = { i, j ->
io.flutter.Log.e("Card app widget", "url error: ${trueUrl}", j.throwable)
})
Expand Down
5 changes: 3 additions & 2 deletions lib/component/illust_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'package:pixez/er/lprinter.dart';
import 'package:pixez/i18n.dart';
import 'package:pixez/lighting/lighting_store.dart';
import 'package:pixez/main.dart';
import 'package:pixez/models/illust.dart';
import 'package:pixez/page/picture/illust_lighting_page.dart';
import 'package:pixez/page/picture/illust_store.dart';
import 'package:pixez/page/picture/picture_list_page.dart';
Expand Down Expand Up @@ -165,8 +166,8 @@ class _IllustCardState extends State<IllustCard> {
)
: NullHero(
tag: tag,
child: PixivImage(store.illusts!.imageUrls.medium,
fit: BoxFit.fitWidth),
child:
PixivImage(store.illusts!.feedPreviewUrl, fit: BoxFit.fitWidth),
);
}

Expand Down
27 changes: 24 additions & 3 deletions lib/component/sort_group.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

class SortGroup extends StatefulWidget {
final List<String> children;
Expand All @@ -21,9 +22,29 @@ class _SortGroupState extends State<SortGroup> {

@override
Widget build(BuildContext context) {
return Wrap(
spacing: 8,
children: [for (var i in widget.children) _buildChip(i, context)],
return SegmentedButton(
style: ButtonStyle(backgroundColor:
WidgetStateProperty.resolveWith((Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return null;
}
if (states.contains(WidgetState.selected)) {
return Theme.of(context).colorScheme.secondaryContainer;
}
return Theme.of(context).colorScheme.surface;
})),
segments: [
for (var (index, i) in widget.children.indexed)
ButtonSegment(value: index, label: Text(i)),
],
selected: {index},
onSelectionChanged: (p0) {
widget.onChange(p0.first);
if (mounted)
setState(() {
this.index = p0.first;
});
},
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import 'dart:io';

class Constants {
static String tagName = "0.9.44";
static String tagName = "0.9.45";
static const isGooglePlay =
bool.fromEnvironment("IS_GOOGLEPLAY", defaultValue: false);
static int type = 0;
Expand Down
5 changes: 2 additions & 3 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,13 @@
"automatically_bookmark_when_downloading": "Automatically bookmark when downloading",
"footer_loading": "Loading...",
"successed": "Successed",
"failed": "Failed",
"reply": "Reply",
"reply_to": "Reply to",
"show_feed_ai_badge": "Show feed AI badge",
"illust_detail_save_skip_confirm": "Skip confirmation when saving on details page",
"secure_window": "Secure window",
"open_saucenao_using_webview": "Open SauceNao using webview",
"appwidget_recommend_type": "Appwidget recommend type",
"popular_male_desc": "Popular male desc",
"popular_female_desc": "Popular female desc"
"popular_female_desc": "Popular female desc",
"feed_preview_quality": "Feed preview quality"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_en_US.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,13 @@
"automatically_bookmark_when_downloading": "Automatically bookmark when downloading",
"footer_loading": "Loading...",
"successed": "Successed",
"failed": "Failed",
"reply": "Reply",
"reply_to": "Reply to",
"show_feed_ai_badge": "Show feed AI badge",
"illust_detail_save_skip_confirm": "Skip confirmation when saving on details page",
"secure_window": "Secure window",
"open_saucenao_using_webview": "Open SauceNao using webview",
"appwidget_recommend_type": "Appwidget recommend type",
"popular_male_desc": "Popular male desc",
"popular_female_desc": "Popular female desc"
"popular_female_desc": "Popular female desc",
"feed_preview_quality": "Feed preview quality"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,11 @@
"automatically_bookmark_when_downloading": "Automatically bookmark when downloading",
"footer_loading": "Loading...",
"successed": "Successed",
"failed": "Failed",
"reply": "Reply",
"reply_to": "Reply to",
"show_feed_ai_badge": "Show feed AI badge",
"illust_detail_save_skip_confirm": "Skip confirmation when saving on details page",
"secure_window": "Secure window",
"open_saucenao_using_webview": "Open SauceNao using webview",
"appwidget_recommend_type": "Appwidget recommend type"
"appwidget_recommend_type": "Appwidget recommend type",
"feed_preview_quality": "Feed preview quality"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,11 @@
"automatically_bookmark_when_downloading": "ダウンロードしたら自動的にブックマークする",
"footer_loading": "読み込み中…",
"successed": "完了",
"failed": "失敗",
"reply": "返信",
"reply_to": "返信先: ",
"show_feed_ai_badge": "AI バッジを表示",
"illust_detail_save_skip_confirm": "詳細ページで保存するときの確認をスキップする",
"secure_window": "セキュアなウインドウ",
"open_saucenao_using_webview": "WebView を使用して SauceNao を開く",
"appwidget_recommend_type": "アプリウィジェットで表示する種類"
"appwidget_recommend_type": "アプリウィジェットで表示する種類",
"feed_preview_quality": "Feed preview quality"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_ko.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,11 @@
"automatically_bookmark_when_downloading": "Automatically bookmark when downloading",
"footer_loading": "Loading...",
"successed": "Successed",
"failed": "Failed",
"reply": "Reply",
"reply_to": "Reply to",
"show_feed_ai_badge": "Show feed AI badge",
"illust_detail_save_skip_confirm": "Skip confirmation when saving on details page",
"secure_window": "Secure window",
"open_saucenao_using_webview": "Open SauceNao using webview",
"appwidget_recommend_type": "Appwidget recommend type"
"appwidget_recommend_type": "Appwidget recommend type",
"feed_preview_quality": "Feed preview quality"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,11 @@
"automatically_bookmark_when_downloading": "Автоматически добавлять в закладки при загрузке",
"footer_loading": "Загрузка...",
"successed": "Успешно",
"failed": "Неудачно",
"reply": "Ответить",
"reply_to": "Ответить на",
"show_feed_ai_badge": "Показать значок ленты ИИ",
"illust_detail_save_skip_confirm": "Пропустить подтверждение при сохранении на странице деталей",
"secure_window": "Защищённое окно",
"open_saucenao_using_webview": "Открыть SauceNao через webview",
"appwidget_recommend_type": "Рекомендуемый тип Appwidget"
"appwidget_recommend_type": "Рекомендуемый тип Appwidget",
"feed_preview_quality": "Feed preview quality"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_tr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,11 @@
"automatically_bookmark_when_downloading": "İndirince otomatik olarak yer işaretlerine ekle",
"footer_loading": "Yükleniyor...",
"successed": "Başarılı",
"failed": "Başarısız",
"reply": "Yanıtla",
"reply_to": "Yanıtla",
"show_feed_ai_badge": "Akışta AI etiketini göster",
"illust_detail_save_skip_confirm": "Skip confirmation when saving on details page",
"secure_window": "Secure window",
"open_saucenao_using_webview": "Open SauceNao using webview",
"appwidget_recommend_type": "Appwidget recommend type"
"appwidget_recommend_type": "Appwidget recommend type",
"feed_preview_quality": "Feed preview quality"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,13 @@
"automatically_bookmark_when_downloading": "下载时自动收藏",
"footer_loading": "加载中...",
"successed": "加载成功",
"failed": "加载失败",
"reply": "回复",
"reply_to": "回复给",
"show_feed_ai_badge": "显示列表中的AI生成标记",
"illust_detail_save_skip_confirm": "插画作品页保存时跳过确认",
"secure_window": "禁用屏幕抓取",
"open_saucenao_using_webview": "用webview打开Saucenao",
"appwidget_recommend_type": "小组件推荐类型",
"popular_male_desc": "受男性喜爱",
"popular_female_desc": "受女性喜爱"
"popular_female_desc": "受女性喜爱",
"feed_preview_quality": "列表预览画质"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,13 @@
"automatically_bookmark_when_downloading": "下载时自动收藏",
"footer_loading": "加载中...",
"successed": "加载成功",
"failed": "加载失败",
"reply": "回复",
"reply_to": "回复给",
"show_feed_ai_badge": "显示列表中的AI生成标记",
"illust_detail_save_skip_confirm": "插画作品页保存时跳过确认",
"secure_window": "禁用屏幕抓取",
"open_saucenao_using_webview": "用webview打开Saucenao",
"appwidget_recommend_type": "小组件推荐类型",
"popular_male_desc": "受男性喜爱",
"popular_female_desc": "受女性喜爱"
"popular_female_desc": "受女性喜爱",
"feed_preview_quality": "列表预览画质"
}
5 changes: 2 additions & 3 deletions lib/l10n/intl_zh_TW.arb
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,11 @@
"automatically_bookmark_when_downloading": "下載時自動收藏",
"footer_loading": "加載中...",
"successed": "加載成功",
"failed": "加載失敗",
"reply": "回覆",
"reply_to": "回覆給",
"show_feed_ai_badge": "顯示列表中的AI生成標記",
"illust_detail_save_skip_confirm": "插畫作品頁保存時跳過確認",
"secure_window": "禁用螢幕擷取",
"open_saucenao_using_webview": "用Webview打開Saucenao",
"appwidget_recommend_type": "小組件推薦類型"
"appwidget_recommend_type": "小組件推薦類型",
"feed_preview_quality": "列表预览画质"
}
34 changes: 26 additions & 8 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'dart:io';

import 'package:bot_toast/bot_toast.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -153,16 +154,27 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
if (userSetting.useDynamicColor &&
lightDynamic != null &&
darkDynamic != null) {
lightColorScheme = lightDynamic.harmonized();
darkColorScheme = darkDynamic.harmonized();
lightColorScheme = SeedColorScheme.fromSeeds(
brightness: Brightness.light,
primaryKey: lightDynamic.harmonized().primary,
variant: FlexSchemeVariant.fidelity,
);
darkColorScheme = SeedColorScheme.fromSeeds(
brightness: Brightness.light,
primaryKey: darkDynamic.harmonized().primary,
variant: FlexSchemeVariant.fidelity,
);
} else {
Color primary = userSetting.seedColor;
lightColorScheme = ColorScheme.fromSeed(
seedColor: primary,
lightColorScheme = SeedColorScheme.fromSeeds(
brightness: Brightness.light,
primaryKey: primary,
variant: FlexSchemeVariant.fidelity,
);
darkColorScheme = ColorScheme.fromSeed(
seedColor: primary,
darkColorScheme = SeedColorScheme.fromSeeds(
brightness: Brightness.dark,
primaryKey: primary,
variant: FlexSchemeVariant.fidelity,
);
}
if (userSetting.themeInitState != 1) {
Expand Down Expand Up @@ -190,8 +202,14 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
},
themeMode: userSetting.themeMode,
theme: ThemeData.light().copyWith(
colorScheme: lightColorScheme,
scaffoldBackgroundColor: lightColorScheme.surface),
primaryColor: lightColorScheme.primary,
colorScheme: lightColorScheme,
scaffoldBackgroundColor: lightColorScheme.surface,
cardColor: lightColorScheme.surfaceContainer,
chipTheme: ChipThemeData(
backgroundColor: lightColorScheme.surface,
),
),
darkTheme: ThemeData.dark().copyWith(
scaffoldBackgroundColor:
userSetting.isAMOLED ? Colors.black : null,
Expand Down
10 changes: 10 additions & 0 deletions lib/models/illust.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
*/
import 'package:json_annotation/json_annotation.dart';
import 'package:pixez/main.dart';

part 'illust.g.dart';

Expand Down Expand Up @@ -137,6 +138,15 @@ class ImageUrls {
Map<String, dynamic> toJson() => _$ImageUrlsToJson(this);
}

extension IllustExtension on Illusts {
String get feedPreviewUrl => (userSetting.feedPreviewQuality == 0)
? imageUrls.medium
: (userSetting.feedPreviewQuality == 1)
? this.imageUrls.large
: this.metaSinglePage?.originalImageUrl ??
this.metaPages[0].imageUrls!.original;
}

@JsonSerializable()
class User {
int id;
Expand Down
3 changes: 2 additions & 1 deletion lib/page/Init/init_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class _InitPageState extends State<InitPage> {
duration: Duration(milliseconds: 300),
opacity: userSetting.languageNum == index ? 1 : 0.3,
child: ListTile(
title: Text(title),
title: Text(title,
style: Theme.of(context).textTheme.titleSmall),
onTap: () async {
await userSetting.setLanguageNum(index);
setState(() {});
Expand Down
1 change: 0 additions & 1 deletion lib/page/comment/comment_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ class _CommentPageState extends State<CommentPage> {
child: Column(
children: [
Container(
color: Theme.of(context).dialogBackgroundColor,
child: Row(
children: <Widget>[
IconButton(
Expand Down
2 changes: 1 addition & 1 deletion lib/page/hello/recom/recom_spotlight_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class _RecomSpolightPageState extends State<RecomSpolightPage>
elevation: 0.0,
titleSpacing: 0.0,
automaticallyImplyLeading: false,
backgroundColor: Theme.of(context).canvasColor,
// backgroundColor: Theme.of(context).canvasColor,
title: Text(""),
)
],
Expand Down
Loading

0 comments on commit 6fca314

Please sign in to comment.