mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 06:19:35 +00:00
修改图标插件
This commit is contained in:
parent
2a92ae3b5d
commit
671a1dcf07
3 changed files with 88 additions and 77 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:animated_theme_switcher/animated_theme_switcher.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
import 'package:shelfsdk/audiobookshelf_api.dart' as shelfsdk;
|
||||
import 'package:vaani/api/image_provider.dart';
|
||||
import 'package:vaani/api/library_item_provider.dart';
|
||||
|
|
@ -223,8 +223,6 @@ class _HeroSectionSubLabelWithIcon extends HookConsumerWidget {
|
|||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final themeData = Theme.of(context);
|
||||
final useFontAwesome =
|
||||
icon.runtimeType == FontAwesomeIcons.book.runtimeType;
|
||||
final useMaterialThemeOnItemPage =
|
||||
ref.watch(appSettingsProvider).themeSettings.useMaterialThemeOnItemPage;
|
||||
final color = useMaterialThemeOnItemPage
|
||||
|
|
@ -236,17 +234,11 @@ class _HeroSectionSubLabelWithIcon extends HookConsumerWidget {
|
|||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(right: 8, top: 2),
|
||||
child: useFontAwesome
|
||||
? FaIcon(
|
||||
icon,
|
||||
size: 16,
|
||||
color: color,
|
||||
)
|
||||
: Icon(
|
||||
icon,
|
||||
size: 16,
|
||||
color: color,
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 16,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: text,
|
||||
|
|
@ -347,66 +339,44 @@ class _BookCover extends HookConsumerWidget {
|
|||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final coverImage = ref.watch(coverImageProvider(itemId));
|
||||
final themeData = Theme.of(context);
|
||||
// final themeData = Theme.of(context);
|
||||
// final item = ref.watch(libraryItemProvider(itemId));
|
||||
final themeSettings = ref.watch(appSettingsProvider).themeSettings;
|
||||
// final themeSettings = ref.watch(appSettingsProvider).themeSettings;
|
||||
|
||||
ColorScheme? coverColorScheme;
|
||||
if (themeSettings.useMaterialThemeOnItemPage) {
|
||||
coverColorScheme = ref
|
||||
.watch(
|
||||
themeOfLibraryItemProvider(
|
||||
itemId,
|
||||
brightness: Theme.of(context).brightness,
|
||||
highContrast: themeSettings.highContrast ||
|
||||
MediaQuery.of(context).highContrast,
|
||||
),
|
||||
)
|
||||
.valueOrNull;
|
||||
}
|
||||
// ColorScheme? coverColorScheme;
|
||||
// if (themeSettings.useMaterialThemeOnItemPage) {
|
||||
// coverColorScheme = ref
|
||||
// .watch(
|
||||
// themeOfLibraryItemProvider(
|
||||
// itemId,
|
||||
// brightness: Theme.of(context).brightness,
|
||||
// highContrast: themeSettings.highContrast ||
|
||||
// MediaQuery.of(context).highContrast,
|
||||
// ),
|
||||
// )
|
||||
// .valueOrNull;
|
||||
// }
|
||||
|
||||
return ThemeSwitcher(
|
||||
builder: (context) {
|
||||
// change theme after 2 seconds
|
||||
if (themeSettings.useMaterialThemeOnItemPage) {
|
||||
final theme = ThemeSwitcher.of(context);
|
||||
Future.delayed(150.ms, () {
|
||||
try {
|
||||
theme.changeTheme(
|
||||
theme: coverColorScheme != null
|
||||
? ThemeData.from(
|
||||
colorScheme: coverColorScheme,
|
||||
textTheme: themeData.textTheme,
|
||||
)
|
||||
: themeData,
|
||||
);
|
||||
} catch (e) {
|
||||
appLogger.severe('Error changing theme: $e');
|
||||
}
|
||||
});
|
||||
return coverImage.when(
|
||||
data: (image) {
|
||||
// return const BookCoverSkeleton();
|
||||
if (image.isEmpty) {
|
||||
return const Icon(Icons.error);
|
||||
}
|
||||
return coverImage.when(
|
||||
data: (image) {
|
||||
// return const BookCoverSkeleton();
|
||||
if (image.isEmpty) {
|
||||
return const Icon(Icons.error);
|
||||
}
|
||||
|
||||
return Image.memory(
|
||||
image,
|
||||
fit: BoxFit.cover,
|
||||
);
|
||||
},
|
||||
loading: () {
|
||||
return const Center(
|
||||
child: BookCoverSkeleton(),
|
||||
);
|
||||
},
|
||||
error: (error, stack) {
|
||||
return const Center(child: Icon(Icons.error));
|
||||
},
|
||||
return Image.memory(
|
||||
image,
|
||||
fit: BoxFit.cover,
|
||||
);
|
||||
},
|
||||
loading: () {
|
||||
return const Center(
|
||||
child: BookCoverSkeleton(),
|
||||
);
|
||||
},
|
||||
error: (error, stack) {
|
||||
return const Center(child: Icon(Icons.error));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -480,7 +450,7 @@ class _BookAuthors extends StatelessWidget {
|
|||
return generateAuthorsString() == ''
|
||||
? const SizedBox.shrink()
|
||||
: _HeroSectionSubLabelWithIcon(
|
||||
icon: FontAwesomeIcons.penNib,
|
||||
icon: FontAwesome.pen_nib_solid,
|
||||
text: Text(
|
||||
style: themeData.textTheme.titleSmall,
|
||||
generateAuthorsString(),
|
||||
|
|
|
|||
56
pubspec.lock
56
pubspec.lock
|
|
@ -552,6 +552,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
flutter_svg:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_svg
|
||||
sha256: "055de8921be7b8e8b98a233c7a5ef84b3a6fcc32f46f1ebf5b9bb3576d108355"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
|
@ -562,14 +570,6 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
font_awesome_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: font_awesome_flutter
|
||||
sha256: b738e35f8bb4957896c34957baf922f99c5d415b38ddc8b070d14b7fa95715d4
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.9.1"
|
||||
freezed:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
@ -674,6 +674,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
icons_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: icons_plus
|
||||
sha256: "8e2f601b8605d45dd55b106a0da084a1809125077a49574ca22e8bcd5b6e86f0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
image:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -979,6 +987,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
path_parsing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_parsing
|
||||
sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1575,6 +1591,30 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.5.1"
|
||||
vector_graphics:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics
|
||||
sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.19"
|
||||
vector_graphics_codec:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_codec
|
||||
sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.13"
|
||||
vector_graphics_compiler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_compiler
|
||||
sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.19"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ dependencies:
|
|||
flutter_cache_manager: ^3.3.2
|
||||
flutter_hooks: ^0.21.2
|
||||
flutter_settings_ui: ^3.0.1
|
||||
font_awesome_flutter: ^10.7.0
|
||||
# font_awesome_flutter: ^10.7.0
|
||||
freezed_annotation: ^2.4.1
|
||||
go_router: ^14.0.2
|
||||
hive: ^4.0.0-dev.2
|
||||
|
|
@ -102,6 +102,7 @@ dependencies:
|
|||
sdk: flutter
|
||||
window_manager: ^0.5.1
|
||||
tray_manager: ^0.5.2
|
||||
icons_plus: ^5.0.0
|
||||
# http_cache_client: ^1.0.4
|
||||
# http_cache_isar_store: ^3.0.0-dev.1
|
||||
dev_dependencies:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue