improve ui

This commit is contained in:
wgh19
2024-05-15 12:40:05 +08:00
parent 2826f9f592
commit 51bff418c7
6 changed files with 33 additions and 30 deletions

View File

@@ -120,7 +120,7 @@ mixin _AppRouteTransitionMixin<T> on PageRoute<T> {
parent: animation, parent: animation,
curve: FluentTheme.of(context).animationCurve, curve: FluentTheme.of(context).animationCurve,
), ),
child: enableIOSGesture child: enableIOSGesture && App.isIOS
? IOSBackGestureDetector( ? IOSBackGestureDetector(
gestureWidth: _kBackGestureWidth, gestureWidth: _kBackGestureWidth,
enabledCallback: () => _isPopGestureEnabled<T>(this), enabledCallback: () => _isPopGestureEnabled<T>(this),

View File

@@ -111,7 +111,7 @@ class Network {
if(res.statusCode != 200) { if(res.statusCode != 200) {
var data = res.data ?? ""; var data = res.data ?? "";
if(data.contains("Invalid refresh token")) { if(data.contains("Invalid refresh token")) {
throw "Failed to refresh token. Plaese logout and re-login"; throw "Failed to refresh token. Please log out.";
} }
} }
var account = Account.fromJson(json.decode(res.data!)); var account = Account.fromJson(json.decode(res.data!));

View File

@@ -1,5 +1,6 @@
import 'package:fluent_ui/fluent_ui.dart'; import 'package:fluent_ui/fluent_ui.dart';
import 'package:pixes/components/md.dart'; import 'package:pixes/components/md.dart';
import 'package:pixes/components/title_bar.dart';
import 'package:pixes/foundation/app.dart'; import 'package:pixes/foundation/app.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';
@@ -32,6 +33,7 @@ class _DownloadingPageState extends State<DownloadingPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ScaffoldPage( return ScaffoldPage(
padding: EdgeInsets.zero,
content: CustomScrollView( content: CustomScrollView(
slivers: [ slivers: [
buildTop(), buildTop(),
@@ -45,15 +47,7 @@ class _DownloadingPageState extends State<DownloadingPage> {
Widget buildTop() { Widget buildTop() {
int bytesPerSecond = DownloadManager().bytesPerSecond; int bytesPerSecond = DownloadManager().bytesPerSecond;
return SliverToBoxAdapter( return SliverTitleBar(title: "${"Speed".tl}: ${bytesToText(bytesPerSecond)}/s");
child: SizedBox(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text("${"Speed".tl}: ${bytesToText(bytesPerSecond)}/s",
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold)),
),
),
);
} }
Widget buildContent() { Widget buildContent() {

View File

@@ -146,10 +146,14 @@ class _MainPageState extends State<MainPage> with WindowListener {
paneBodyBuilder: (pane, child) => NavigatorPopHandler( paneBodyBuilder: (pane, child) => NavigatorPopHandler(
key: const Key("navigator"), key: const Key("navigator"),
onPop: () => navigatorKey.currentState?.pop(), onPop: () => navigatorKey.currentState?.pop(),
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: Navigator( child: Navigator(
key: navigatorKey, key: navigatorKey,
onGenerateRoute: (settings) => AppPageRoute( onGenerateRoute: (settings) => AppPageRoute(
builder: (context) => const RecommendationPage()), builder: (context) => const RecommendationPage()),
),
))), ))),
)); ));
} }

View File

@@ -124,6 +124,7 @@ class _SearchPageState extends State<SearchPage> {
onPressed: () { onPressed: () {
optionController.showFlyout( optionController.showFlyout(
navigatorKey: App.rootNavigatorKey.currentState, navigatorKey: App.rootNavigatorKey.currentState,
placementMode: FlyoutPlacementMode.bottomCenter,
builder: buildSearchOption, builder: buildSearchOption,
); );
}, },

View File

@@ -208,7 +208,7 @@ class __SetDownloadPathPageState extends State<_SetDownloadPathPage> {
} }
class _SetDownloadSubPathPage extends StatefulWidget { class _SetDownloadSubPathPage extends StatefulWidget {
const _SetDownloadSubPathPage({super.key}); const _SetDownloadSubPathPage();
@override @override
State<_SetDownloadSubPathPage> createState() => State<_SetDownloadSubPathPage> createState() =>
@@ -227,7 +227,7 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
TitleBar(title: "Download Subpath".tl), TitleBar(title: "Download subpath".tl),
Text("Rule".tl) Text("Rule".tl)
.padding(const EdgeInsets.symmetric(vertical: 8, horizontal: 16)), .padding(const EdgeInsets.symmetric(vertical: 8, horizontal: 16)),
TextBox( TextBox(
@@ -246,7 +246,9 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
trailing: ToggleSwitch( trailing: ToggleSwitch(
checked: appdata.settings["useTranslatedNameForDownload"], checked: appdata.settings["useTranslatedNameForDownload"],
onChanged: (value) { onChanged: (value) {
setState(() {
appdata.settings["useTranslatedNameForDownload"] = value; appdata.settings["useTranslatedNameForDownload"] = value;
});
appdata.writeSettings(); appdata.writeSettings();
}, },
), ),
@@ -270,7 +272,7 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
Text(_instruction).paddingHorizontal(16) SelectableText(_instruction).paddingHorizontal(16)
], ],
), ),
); );
@@ -284,22 +286,24 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> {
} }
String get _instruction => """ String get _instruction => """
${"Edit the rule of where to store a image.".tl} ${"Edit the rule for where to save an image.".tl}
${"Note: The rule should contain file name.".tl} ${"Note: The rule should include the filename.".tl}
${"Some keyword will be replaced as following rule:"} ${"Some keywords will be replaced by the following rule:"}
\${title} -> ${"Title of the actwork".tl} \${title} -> ${"Title of the work".tl}
\${author} -> ${"Name of the author".tl} \${author} -> ${"Name of the author".tl}
\${id} -> ${"Actwork ID".tl} \${id} -> ${"Artwork ID".tl}
\${index} -> ${"Index of the image in the artwork".tl} \${index} -> ${"Index of the image in the artwork".tl}
\${ext} -> ${"File extension".tl} \${ext} -> ${"File extension".tl}
${"Tags: Tags will be sorted with \"Weights of tags\" setting and be replaced with following rule".tl}
${"The final text will be affect by the setting og \"Use translated tag name\"".tl} ${"Tags: Tags will be sorted by the \"Weights of tags\" setting and replaced by the following rule:".tl}
${"The final text will be affected by the \"Use translated tag name\" setting.".tl}
\${tag0} -> ${"The first tag of the artwork".tl} \${tag0} -> ${"The first tag of the artwork".tl}
\${tag1} -> ${"The sencondary tag of the artwork".tl} \${tag1} -> ${"The second tag of the artwork".tl}
...
${"Weights of the tags".tl}: ${"Weights of the tags".tl}:
Filled with tags. The tags should be splited with a space. The tag in the front have higher weight. Filled with tags. The tags should be separated by a space. The tag in front has higher weight.
It is required to use originlal name instead of translated name. It is required to use the original name instead of the translated name.
"""; """;
} }