improve ui

This commit is contained in:
wgh19
2024-05-17 09:43:00 +08:00
parent 8ff269c8a8
commit 38f57584b6
6 changed files with 105 additions and 90 deletions

View File

@@ -1,6 +1,9 @@
import 'package:flutter/material.dart' as md; import 'package:flutter/material.dart' as md;
typedef MdIcons = md.Icons; typedef MdIcons = md.Icons;
typedef MdTheme = md.Theme;
typedef MdThemeData = md.ThemeData;
typedef MdColorScheme = md.ColorScheme;
class ColorScheme { class ColorScheme {
static md.ColorScheme of(md.BuildContext context) { static md.ColorScheme of(md.BuildContext context) {

View File

@@ -3,6 +3,7 @@ import "dart:ui";
import "package:fluent_ui/fluent_ui.dart"; import "package:fluent_ui/fluent_ui.dart";
import "package:flutter/services.dart"; import "package:flutter/services.dart";
import "package:pixes/appdata.dart"; import "package:pixes/appdata.dart";
import "package:pixes/components/md.dart";
import "package:pixes/components/message.dart"; import "package:pixes/components/message.dart";
import "package:pixes/foundation/app.dart"; import "package:pixes/foundation/app.dart";
import "package:pixes/foundation/log.dart"; import "package:pixes/foundation/log.dart";
@@ -99,7 +100,21 @@ class MyApp extends StatelessWidget {
throw "widget is null"; throw "widget is null";
} }
return OverlayWidget(child); return MdTheme(
data: MdThemeData.from(
colorScheme: MdColorScheme.fromSeed(
seedColor: FluentTheme.of(context).accentColor,
brightness: FluentTheme.of(context).brightness,
),
useMaterial3: true
),
child: DefaultTextStyle.merge(
style: TextStyle(
fontFamily: App.isWindows ? 'font' : null,
),
child: OverlayWidget(child),
),
);
}), }),
); );
}); });

View File

@@ -173,7 +173,7 @@ class Illust {
final int restrict; final int restrict;
final IllustAuthor author; final IllustAuthor author;
final List<Tag> tags; final List<Tag> tags;
final String createDate; final DateTime createDate;
final int pageCount; final int pageCount;
final int width; final int width;
final int height; final int height;
@@ -220,7 +220,7 @@ class Illust {
tags = (json['tags'] as List) tags = (json['tags'] as List)
.map((e) => Tag(e['name'], e['translated_name'])) .map((e) => Tag(e['name'], e['translated_name']))
.toList(), .toList(),
createDate = json['create_date'], createDate = DateTime.parse(json['create_date']),
pageCount = json['page_count'], pageCount = json['page_count'],
width = json['width'], width = json['width'],
height = json['height'], height = json['height'],

View File

@@ -314,7 +314,12 @@ class _BottomBarState extends State<_BottomBar> with TickerProviderStateMixin{
buildStats(), buildStats(),
buildTags(), buildTags(),
buildMoreActions(), buildMoreActions(),
SelectableText("${"Artwork ID".tl}: ${widget.illust.id}\n${"Artist ID".tl}: ${widget.illust.author.id}", style: TextStyle(color: ColorScheme.of(context).outline),).paddingLeft(4), SelectableText(
"${"Artwork ID".tl}: ${widget.illust.id}\n"
"${"Artist ID".tl}: ${widget.illust.author.id}\n"
"${widget.illust.createDate.toString().split('.').first}",
style: TextStyle(color: ColorScheme.of(context).outline),)
.paddingLeft(4),
SizedBox(height: 8 + context.padding.bottom,) SizedBox(height: 8 + context.padding.bottom,)
], ],
), ),

View File

@@ -2,7 +2,6 @@ import "dart:async";
import "package:fluent_ui/fluent_ui.dart"; import "package:fluent_ui/fluent_ui.dart";
import "package:flutter/foundation.dart"; import "package:flutter/foundation.dart";
import "package:flutter/material.dart" as md;
import "package:pixes/appdata.dart"; import "package:pixes/appdata.dart";
import "package:pixes/components/md.dart"; import "package:pixes/components/md.dart";
import "package:pixes/foundation/app.dart"; import "package:pixes/foundation/app.dart";
@@ -79,14 +78,7 @@ class _MainPageState extends State<MainPage> with WindowListener {
content: LoginPage(() => setState(() {})), content: LoginPage(() => setState(() {})),
); );
} }
return md.Theme( return DefaultSelectionStyle.merge(
data: md.ThemeData.from(
useMaterial3: true,
colorScheme: md.ColorScheme.fromSeed(
seedColor: FluentTheme.of(context).accentColor.withOpacity(1),
brightness: FluentTheme.of(context).brightness,
)),
child: DefaultSelectionStyle.merge(
selectionColor: FluentTheme.of(context).selectionColor.withOpacity(0.4), selectionColor: FluentTheme.of(context).selectionColor.withOpacity(0.4),
child: NavigationView( child: NavigationView(
appBar: buildAppBar(context, navigatorKey), appBar: buildAppBar(context, navigatorKey),
@@ -163,7 +155,7 @@ class _MainPageState extends State<MainPage> with WindowListener {
builder: (context) => const RecommendationPage()), builder: (context) => const RecommendationPage()),
), ),
))), ))),
)); );
} }
static final pageBuilders = <Widget Function()>[ static final pageBuilders = <Widget Function()>[

View File

@@ -410,7 +410,7 @@ ${"Some keywords will be replaced by the following rule:".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}
\${AI} -> ${"Replace with 'AI' if the work was generated by AI, otherwise replace with blank".tl} \${AI} -> ${"Replace with 'AI' if the work was generated by AI, otherwise replace with blank".tl}
\${tag{*}} -> ${"Replace with * if the work have tag *, otherwise replace with blank.".tl} \${tag(*)} -> ${"Replace with * if the work have tag *, otherwise replace with blank.".tl}
${"Multiple path separators will be automatically replaced with a single".tl} ${"Multiple path separators will be automatically replaced with a single".tl}
"""; """;