improve ui; update version code

This commit is contained in:
wgh19
2024-06-14 12:22:37 +08:00
parent a03ad12837
commit 21fe14f88b
11 changed files with 236 additions and 211 deletions

View File

@@ -5,6 +5,7 @@
<application <application
android:label="pixes" android:label="pixes"
android:name="${applicationName}" android:name="${applicationName}"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"

View File

@@ -112,7 +112,6 @@
"Multiple path separators will be automatically replaced with a single": "多个路径分隔符将被自动替换为单个", "Multiple path separators will be automatically replaced with a single": "多个路径分隔符将被自动替换为单个",
"Login": "登录", "Login": "登录",
"You need to complete the login operation in the browser window that will open.": "您需要在打开的浏览器窗口中完成登录操作", "You need to complete the login operation in the browser window that will open.": "您需要在打开的浏览器窗口中完成登录操作",
"I have read and agree to the Terms of Use": "我已阅读并同意使用条款",
"Waiting..." : "等待中...", "Waiting..." : "等待中...",
"Waiting for authentication. Please finished in the browser." : "等待验证. 请在浏览器中完成.", "Waiting for authentication. Please finished in the browser." : "等待验证. 请在浏览器中完成.",
"Back" : "返回", "Back" : "返回",
@@ -179,7 +178,9 @@
"A new version of Pixes is available. Do you want to update now?" : "Pixes有新版本可用. 您要立即更新吗?", "A new version of Pixes is available. Do you want to update now?" : "Pixes有新版本可用. 您要立即更新吗?",
"Update": "更新", "Update": "更新",
"Check for updates": "检查更新", "Check for updates": "检查更新",
"Check for updates on startup": "启动时检查更新" "Check for updates on startup": "启动时检查更新",
"I understand pixes is a free unofficial application.": "我了解Pixes是一个免费的非官方应用程序",
"Related Artworks": "相关作品"
}, },
"zh_TW": { "zh_TW": {
"Search": "搜索", "Search": "搜索",
@@ -294,7 +295,6 @@
"Multiple path separators will be automatically replaced with a single": "多個路徑分隔符號將自動替換為單一", "Multiple path separators will be automatically replaced with a single": "多個路徑分隔符號將自動替換為單一",
"Login": "登錄", "Login": "登錄",
"You need to complete the login operation in the browser window that will open.": "您需要在打開的瀏覽器窗口中完成登錄操作", "You need to complete the login operation in the browser window that will open.": "您需要在打開的瀏覽器窗口中完成登錄操作",
"I have read and agree to the Terms of Use": "我已閱讀並同意使用條款",
"Waiting..." : "等待中...", "Waiting..." : "等待中...",
"Waiting for authentication. Please finished in the browser." : "等待驗證. 請在瀏覽器中完成.", "Waiting for authentication. Please finished in the browser." : "等待驗證. 請在瀏覽器中完成.",
"Back" : "返回", "Back" : "返回",
@@ -361,6 +361,8 @@
"A new version of Pixes is available. Do you want to update now?" : "Pixes有新版本可用. 您要立即更新嗎?", "A new version of Pixes is available. Do you want to update now?" : "Pixes有新版本可用. 您要立即更新嗎?",
"Update": "更新", "Update": "更新",
"Check for updates": "檢查更新", "Check for updates": "檢查更新",
"Check for updates on startup": "啟動時檢查更新" "Check for updates on startup": "啟動時檢查更新",
"I understand pixes is a free unofficial application.": "我了解Pixes是一個免費的非官方應用程序",
"Related Artworks": "相關作品"
} }
} }

View File

@@ -4,6 +4,7 @@ import 'package:pixes/foundation/app.dart';
import 'package:pixes/foundation/history.dart'; import 'package:pixes/foundation/history.dart';
import 'package:pixes/foundation/image_provider.dart'; import 'package:pixes/foundation/image_provider.dart';
import 'package:pixes/network/download.dart'; import 'package:pixes/network/download.dart';
import 'package:pixes/pages/related_page.dart';
import 'package:pixes/utils/translation.dart'; import 'package:pixes/utils/translation.dart';
import '../network/network.dart'; import '../network/network.dart';
@@ -75,6 +76,7 @@ class _IllustWidgetState extends State<IllustWidget> {
context.to(() => IllustPage(widget.illust)); context.to(() => IllustPage(widget.illust));
}, },
onSecondaryTapUp: showMenu, onSecondaryTapUp: showMenu,
onLongPress: showMenu,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(4.0), borderRadius: BorderRadius.circular(4.0),
child: AnimatedImage( child: AnimatedImage(
@@ -211,13 +213,13 @@ class _IllustWidgetState extends State<IllustWidget> {
}); });
} }
void showMenu(TapUpDetails details) { void showMenu([TapUpDetails? details]) {
// This calculates the position of the flyout according to the parent navigator // This calculates the position of the flyout according to the parent navigator
final targetContext = contextAttachKey.currentContext; final targetContext = contextAttachKey.currentContext;
if (targetContext == null) return; if (targetContext == null) return;
final box = targetContext.findRenderObject() as RenderBox; final box = targetContext.findRenderObject() as RenderBox;
final position = box.localToGlobal( Offset? position = box.localToGlobal(
details.localPosition, details?.localPosition ?? box.size.center(Offset.zero),
ancestor: Navigator.of(context).context.findRenderObject(), ancestor: Navigator.of(context).context.findRenderObject(),
); );
@@ -243,6 +245,12 @@ class _IllustWidgetState extends State<IllustWidget> {
context.showToast(message: "Added"); context.showToast(message: "Added");
DownloadManager().addDownloadingTask(widget.illust); DownloadManager().addDownloadingTask(widget.illust);
}), }),
MenuFlyoutItem(
text: Text("Related Artworks".tl),
onPressed: () {
context.to(
() => RelatedIllustsPage(widget.illust.id.toString()));
}),
], ],
); );
}, },
@@ -340,8 +348,7 @@ class IllustHistoryWidget extends StatelessWidget {
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(4.0), borderRadius: BorderRadius.circular(4.0),
child: AnimatedImage( child: AnimatedImage(
image: CachedImageProvider( image: CachedImageProvider(illust.imgPath),
illust.imgPath),
fit: BoxFit.cover, fit: BoxFit.cover,
width: width - 16.0, width: width - 16.0,
height: height - 16.0, height: height - 16.0,

View File

@@ -12,7 +12,7 @@ export "state_controller.dart";
export "navigation.dart"; export "navigation.dart";
class _App { class _App {
final version = "1.0.7"; final version = "1.0.8";
bool get isAndroid => Platform.isAndroid; bool get isAndroid => Platform.isAndroid;
bool get isIOS => Platform.isIOS; bool get isIOS => Platform.isIOS;

View File

@@ -4,7 +4,6 @@ import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart' show Icons; import 'package:flutter/material.dart' show Icons;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:pixes/appdata.dart'; import 'package:pixes/appdata.dart';
import 'package:pixes/components/animated_image.dart'; import 'package:pixes/components/animated_image.dart';
import 'package:pixes/components/keyboard.dart'; import 'package:pixes/components/keyboard.dart';
@@ -20,6 +19,7 @@ import 'package:pixes/network/download.dart';
import 'package:pixes/network/network.dart'; import 'package:pixes/network/network.dart';
import 'package:pixes/pages/comments_page.dart'; import 'package:pixes/pages/comments_page.dart';
import 'package:pixes/pages/image_page.dart'; import 'package:pixes/pages/image_page.dart';
import 'package:pixes/pages/related_page.dart';
import 'package:pixes/pages/search_page.dart'; import 'package:pixes/pages/search_page.dart';
import 'package:pixes/pages/user_info_page.dart'; import 'package:pixes/pages/user_info_page.dart';
import 'package:pixes/utils/block.dart'; import 'package:pixes/utils/block.dart';
@@ -1140,7 +1140,7 @@ class _BottomBarState extends State<_BottomBar> with TickerProviderStateMixin {
).fixWidth(96), ).fixWidth(96),
Button( Button(
onPressed: () { onPressed: () {
context.to(() => _RelatedIllustsPage(widget.illust.id.toString())); context.to(() => RelatedIllustsPage(widget.illust.id.toString()));
}, },
child: SizedBox( child: SizedBox(
height: 28, height: 28,
@@ -1357,64 +1357,3 @@ class _IllustPageWithIdState extends LoadingState<IllustPageWithId, Illust> {
return Network().getIllustByID(widget.id); return Network().getIllustByID(widget.id);
} }
} }
class _RelatedIllustsPage extends StatefulWidget {
const _RelatedIllustsPage(this.id);
final String id;
@override
State<_RelatedIllustsPage> createState() => _RelatedIllustsPageState();
}
class _RelatedIllustsPageState
extends MultiPageLoadingState<_RelatedIllustsPage, Illust> {
@override
Widget? buildFrame(BuildContext context, Widget child) {
return Column(
children: [
TitleBar(title: "Related artworks".tl),
Expanded(
child: child,
)
],
);
}
@override
Widget buildContent(BuildContext context, final List<Illust> data) {
return LayoutBuilder(builder: (context, constrains) {
return MasonryGridView.builder(
padding: const EdgeInsets.symmetric(horizontal: 8) +
EdgeInsets.only(bottom: context.padding.bottom),
gridDelegate: const SliverSimpleGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 240,
),
itemCount: data.length,
itemBuilder: (context, index) {
if (index == data.length - 1) {
nextPage();
}
return IllustWidget(data[index]);
},
);
});
}
String? nextUrl;
@override
Future<Res<List<Illust>>> loadData(page) async {
if (nextUrl == "end") {
return Res.error("No more data");
}
var res = nextUrl == null
? await Network().relatedIllusts(widget.id)
: await Network().getIllustsWithNextUrl(nextUrl!);
if (!res.error) {
nextUrl = res.subData;
nextUrl ??= "end";
}
return res;
}
}

View File

@@ -188,6 +188,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
var image = widget.urls[index]; var image = widget.urls[index];
return PhotoViewGalleryPageOptions( return PhotoViewGalleryPageOptions(
filterQuality: FilterQuality.medium,
imageProvider: getImageProvider(image), imageProvider: getImageProvider(image),
); );
}, },

View File

@@ -87,7 +87,9 @@ class _LoginPageState extends State<LoginPage> {
const SizedBox( const SizedBox(
width: 8, width: 8,
), ),
Text("I have read and agree to the Terms of Use".tl) Expanded(
child: Text("I understand pixes is a free unofficial application.".tl),
)
], ],
) )
], ],

View File

@@ -0,0 +1,69 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:pixes/components/illust_widget.dart';
import 'package:pixes/components/loading.dart';
import 'package:pixes/components/title_bar.dart';
import 'package:pixes/foundation/app.dart';
import 'package:pixes/network/network.dart';
import 'package:pixes/utils/translation.dart';
class RelatedIllustsPage extends StatefulWidget {
const RelatedIllustsPage(this.id, {super.key});
final String id;
@override
State<RelatedIllustsPage> createState() => _RelatedIllustsPageState();
}
class _RelatedIllustsPageState
extends MultiPageLoadingState<RelatedIllustsPage, Illust> {
@override
Widget? buildFrame(BuildContext context, Widget child) {
return Column(
children: [
TitleBar(title: "Related artworks".tl),
Expanded(
child: child,
)
],
);
}
@override
Widget buildContent(BuildContext context, final List<Illust> data) {
return LayoutBuilder(builder: (context, constrains) {
return MasonryGridView.builder(
padding: const EdgeInsets.symmetric(horizontal: 8) +
EdgeInsets.only(bottom: context.padding.bottom),
gridDelegate: const SliverSimpleGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 240,
),
itemCount: data.length,
itemBuilder: (context, index) {
if (index == data.length - 1) {
nextPage();
}
return IllustWidget(data[index]);
},
);
});
}
String? nextUrl;
@override
Future<Res<List<Illust>>> loadData(page) async {
if (nextUrl == "end") {
return Res.error("No more data");
}
var res = nextUrl == null
? await Network().relatedIllusts(widget.id)
: await Network().getIllustsWithNextUrl(nextUrl!);
if (!res.error) {
nextUrl = res.subData;
nextUrl ??= "end";
}
return res;
}
}

View File

@@ -33,6 +33,8 @@ class _SearchPageState extends State<SearchPage> {
int searchType = 0; int searchType = 0;
final focusNode = FocusNode();
static const searchTypes = [ static const searchTypes = [
"Search artwork", "Search artwork",
"Search novel", "Search novel",
@@ -100,6 +102,9 @@ class _SearchPageState extends State<SearchPage> {
children: [ children: [
Expanded( Expanded(
child: TextBox( child: TextBox(
focusNode: focusNode,
autofocus: false,
padding: const EdgeInsets.symmetric(horizontal: 12),
placeholder: placeholder:
'${searchTypes[searchType].tl} / ${"Open link".tl}', '${searchTypes[searchType].tl} / ${"Open link".tl}',
onChanged: (s) => text = s, onChanged: (s) => text = s,

View File

@@ -12,7 +12,6 @@ import 'package:pixes/foundation/app.dart';
import 'package:pixes/pages/main_page.dart'; import 'package:pixes/pages/main_page.dart';
import 'package:pixes/utils/io.dart'; import 'package:pixes/utils/io.dart';
import 'package:pixes/utils/translation.dart'; import 'package:pixes/utils/translation.dart';
import 'package:pixes/utils/update.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
import 'logs.dart'; import 'logs.dart';

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.7+107 version: 1.0.8+108
environment: environment:
sdk: '>=3.3.4 <4.0.0' sdk: '>=3.3.4 <4.0.0'