Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: text cover #75

Merged
merged 2 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/models/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ class ExtensionListItem {
ExtensionListItem({
required this.title,
required this.url,
required this.cover,
this.cover,
this.update,
this.headers,
});

final String title;
final String url;
final String cover;
final String? cover;
final String? update;
late Map<String, String>? headers;

Expand All @@ -98,14 +98,14 @@ class ExtensionListItem {
class ExtensionDetail {
ExtensionDetail({
required this.title,
required this.cover,
this.cover,
this.desc,
this.episodes,
this.headers,
});

final String title;
final String cover;
final String? cover;
final String? desc;
final List<ExtensionEpisodeGroup>? episodes;
late Map<String, String>? headers;
Expand Down
4 changes: 2 additions & 2 deletions lib/models/extension.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/models/favorite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class Favorite {
@Enumerated(EnumType.name)
late ExtensionType type;
late String title;
late String cover;
String? cover;
DateTime date = DateTime.now();
}
39 changes: 30 additions & 9 deletions lib/models/favorite.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/models/history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class History {
late String package;
late String url;
// 截图,保存封面地址
late String cover;
String? cover;
@Enumerated(EnumType.name)
late ExtensionType type;
// 不同线路
Expand Down
39 changes: 30 additions & 9 deletions lib/models/history.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/pages/detail/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class DetailPageController extends GetxController {
TMDBDetail? get tmdbDetail => tmdb.value;
set tmdbDetail(TMDBDetail? value) => tmdb.value = value;

String get backgorund {
String bg = '';
String? get backgorund {
String? bg;
if (tmdbDetail != null && tmdbDetail!.backdrop != null) {
bg = TmdbApi.getImageUrl(tmdbDetail!.backdrop!) ?? '';
} else {
bg = detail?.cover ?? '';
bg = detail?.cover;
}
return bg;
}
Expand Down
43 changes: 22 additions & 21 deletions lib/pages/detail/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:miru_app/utils/i18n.dart';
import 'package:miru_app/utils/layout.dart';
import 'package:miru_app/widgets/cache_network_image.dart';
import 'package:miru_app/widgets/card_tile.dart';
import 'package:miru_app/widgets/cover.dart';
import 'package:miru_app/widgets/platform_widget.dart';
import 'package:miru_app/widgets/progress.dart';
import 'package:url_launcher/url_launcher.dart';
Expand Down Expand Up @@ -232,11 +233,10 @@ class _DetailPageState extends State<DetailPage> {
return Stack(
children: [
Animate(
child: CacheNetWorkImage(
c.backgorund,
width: double.infinity,
height: double.infinity,
headers: c.detail?.headers,
child: Cover(
alt: c.detail?.title ?? '',
url: c.backgorund,
noText: true,
),
).blur(
begin: const Offset(10, 10),
Expand All @@ -260,24 +260,25 @@ class _DetailPageState extends State<DetailPage> {
height: 330,
child: Row(
children: [
if (constraints.maxWidth > 600) ...[
Hero(
tag: c.heroTag ?? '',
child: Container(
width: 230,
height: double.infinity,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
),
child: CacheNetWorkImage(
c.detail?.cover ?? '',
headers: c.detail?.headers,
if (c.detail!.cover != null)
if (constraints.maxWidth > 600) ...[
Hero(
tag: c.heroTag ?? '',
child: Container(
width: 230,
height: double.infinity,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
),
child: CacheNetWorkImage(
c.detail?.cover ?? '',
headers: c.detail?.headers,
),
),
),
),
const SizedBox(width: 30),
],
const SizedBox(width: 30),
],
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
Loading