Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix: history card sometimes overflow (#1014)

ErBW_s9765e1796910
diff --git a/lib/bean/card/bangumi_history_card.dart b/lib/bean/card/bangumi_history_card.dart
index caa27e14..d33c2715 100644
--- a/lib/bean/card/bangumi_history_card.dart
+++ b/lib/bean/card/bangumi_history_card.dart
@@ -94,7 +94,7 @@ class _BangumiHistoryCardVState extends State<BangumiHistoryCardV> {
}
},
child: Padding(
- padding: const EdgeInsets.all(7),
+ padding: const EdgeInsets.all(6),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -110,12 +110,12 @@ class _BangumiHistoryCardVState extends State<BangumiHistoryCardV> {
);
}),
),
- const SizedBox(width: 15),
+ const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const SizedBox(height: 4),
+ const SizedBox(height: 6),
Text(
widget.historyItem.bangumiItem.nameCn == ''
? widget.historyItem.bangumiItem.name
@@ -128,49 +128,53 @@ class _BangumiHistoryCardVState extends State<BangumiHistoryCardV> {
maxLines: 1,
),
const SizedBox(height: 12),
- // 测试 因为API问题评分功能搁置
Wrap(
spacing: 4,
runSpacing: 4,
children: [
propertyChip(
- title: '番剧源',
+ title: '来源',
value: widget.historyItem.adapterName,
+ showTitle: true,
),
propertyChip(
- title: '上次看到',
+ title: '看到',
value: widget.historyItem.lastWatchEpisodeName.isEmpty
? '第${widget.historyItem.lastWatchEpisode}话'
: widget.historyItem.lastWatchEpisodeName,
- ),
- propertyChip(
- title: '排名',
- value: widget.historyItem.bangumiItem.rank.toString(),
showTitle: true,
),
- // 只有 '番剧'
- // propertyChip(
- // title: '种类',
- // value: widget.historyItem.bangumiItem.type == 2 ? '番剧' : '其他',
- // ),
- propertyChip(
- title: '首播',
- value: widget.historyItem.bangumiItem.airDate,
- ),
],
)
],
),
),
Column(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- CollectButton(
- onClose: () {
- FocusScope.of(context).unfocus();
- },
- bangumiItem: widget.historyItem.bangumiItem,
- color: Theme.of(context).colorScheme.onSecondaryContainer,
- ),
+ if (!widget.showDelete) ...[
+ CollectButton(
+ onClose: () {
+ FocusScope.of(context).unfocus();
+ },
+ bangumiItem: widget.historyItem.bangumiItem,
+ color: Theme.of(context).colorScheme.onSecondaryContainer,
+ ),
+ IconButton(
+ icon: Icon(
+ Icons.open_in_new,
+ color:
+ Theme.of(context).colorScheme.onSecondaryContainer,
+ ),
+ tooltip: '番剧详情',
+ onPressed: () {
+ Modular.to.pushNamed(
+ '/info/',
+ arguments: widget.historyItem.bangumiItem,
+ );
+ },
+ ),
+ ],
if (widget.showDelete)
IconButton(
icon: Icon(
@@ -181,7 +185,7 @@ class _BangumiHistoryCardVState extends State<BangumiHistoryCardV> {
onPressed: () {
historyController.deleteHistory(widget.historyItem);
},
- )
+ ),
],
),
],
diff --git a/lib/pages/history/history_page.dart b/lib/pages/history/history_page.dart
index 4031d26f..cb321cff 100644
--- a/lib/pages/history/history_page.dart
+++ b/lib/pages/history/history_page.dart
@@ -63,44 +63,42 @@ class _HistoryPageState extends State<HistoryPage>
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) {});
- return OrientationBuilder(builder: (context, orientation) {
- return Observer(builder: (context) {
- return PopScope(
- canPop: true,
- onPopInvokedWithResult: (bool didPop, Object? result) async {
- onBackPressed(context);
- },
- child: Scaffold(
- appBar: SysAppBar(
- title: const Text('历史记录'),
- actions: [
- IconButton(
- onPressed: () {
- setState(() {
- showDelete = !showDelete;
- });
- },
- icon: showDelete
- ? const Icon(Icons.edit_outlined)
- : const Icon(Icons.edit))
- ],
- ),
- body: renderBody(orientation),
- floatingActionButton: FloatingActionButton(
- child: const Icon(Icons.clear_all),
- onPressed: () {
- showHistoryClearDialog();
- },
- ),
+ return Observer(builder: (context) {
+ return PopScope(
+ canPop: true,
+ onPopInvokedWithResult: (bool didPop, Object? result) async {
+ onBackPressed(context);
+ },
+ child: Scaffold(
+ appBar: SysAppBar(
+ title: const Text('历史记录'),
+ actions: [
+ IconButton(
+ onPressed: () {
+ setState(() {
+ showDelete = !showDelete;
+ });
+ },
+ icon: showDelete
+ ? const Icon(Icons.edit_outlined)
+ : const Icon(Icons.edit))
+ ],
),
- );
- });
+ body: renderBody,
+ floatingActionButton: FloatingActionButton(
+ child: const Icon(Icons.clear_all),
+ onPressed: () {
+ showHistoryClearDialog();
+ },
+ ),
+ ),
+ );
});
}
- Widget renderBody(Orientation orientation) {
+ Widget get renderBody {
if (historyController.histories.isNotEmpty) {
- return contentGrid(orientation);
+ return contentGrid;
} else {
return const Center(
child: Text('没有找到历史记录 (´;ω;`)'),
@@ -108,8 +106,14 @@ class _HistoryPageState extends State<HistoryPage>
}
}
- Widget contentGrid(Orientation orientation) {
- int crossCount = (orientation != Orientation.portrait) ? 3 : 1;
+ Widget get contentGrid {
+ int crossCount = 1;
+ if (MediaQuery.sizeOf(context).width > LayoutBreakpoint.compact['width']!) {
+ crossCount = 2;
+ }
+ if (MediaQuery.sizeOf(context).width > LayoutBreakpoint.medium['width']!) {
+ crossCount = 3;
+ }
return CustomScrollView(
slivers: [