generated from dellevin/template
优化打包体积
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../providers/app_provider.dart';
|
||||
import '../models/data_models.dart';
|
||||
import '../models/note_plus_models.dart';
|
||||
import '../utils/toast_util.dart';
|
||||
|
||||
/// 回收站页面
|
||||
@@ -13,7 +12,7 @@ class RecycleBinPage extends StatefulWidget {
|
||||
State<RecycleBinPage> createState() => _RecycleBinPageState();
|
||||
}
|
||||
|
||||
enum _ItemType { movie, book, note, movieReview, bookReview, bookExcerpt, notePlus }
|
||||
enum _ItemType { movie, book, note, movieReview, bookReview, bookExcerpt }
|
||||
|
||||
class _DeletedItem {
|
||||
final _ItemType type;
|
||||
@@ -71,13 +70,6 @@ class _DeletedItem {
|
||||
icon = Icons.format_quote_outlined,
|
||||
typeLabel = '书摘';
|
||||
|
||||
_DeletedItem.notePlus(NotePlusDocument d)
|
||||
: type = _ItemType.notePlus,
|
||||
id = d.id,
|
||||
title = d.title.isNotEmpty ? d.title : '未命名文档',
|
||||
subtitle = '删除于 ${d.updatedAt.year}.${d.updatedAt.month.toString().padLeft(2, '0')}.${d.updatedAt.day.toString().padLeft(2, '0')}',
|
||||
icon = Icons.edit_note_outlined,
|
||||
typeLabel = '高级笔记';
|
||||
}
|
||||
|
||||
class _RecycleBinPageState extends State<RecycleBinPage> {
|
||||
@@ -103,7 +95,6 @@ class _RecycleBinPageState extends State<RecycleBinPage> {
|
||||
final movieReviews = await provider.getDeletedMovieReviews();
|
||||
final bookReviews = await provider.getDeletedBookReviews();
|
||||
final bookExcerpts = await provider.getDeletedBookExcerpts();
|
||||
final notePlusDocs = await provider.getDeletedNotePlusDocs();
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_allItems = [
|
||||
@@ -113,7 +104,6 @@ class _RecycleBinPageState extends State<RecycleBinPage> {
|
||||
for (final r in movieReviews) _DeletedItem.movieReview(r),
|
||||
for (final r in bookReviews) _DeletedItem.bookReview(r),
|
||||
for (final e in bookExcerpts) _DeletedItem.bookExcerpt(e),
|
||||
for (final d in notePlusDocs) _DeletedItem.notePlus(d),
|
||||
];
|
||||
_isLoading = false;
|
||||
});
|
||||
@@ -188,7 +178,6 @@ class _RecycleBinPageState extends State<RecycleBinPage> {
|
||||
_filterChip('影评', _ItemType.movieReview),
|
||||
_filterChip('书评', _ItemType.bookReview),
|
||||
_filterChip('书摘', _ItemType.bookExcerpt),
|
||||
_filterChip('高级笔记', _ItemType.notePlus),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -411,9 +400,6 @@ class _RecycleBinPageState extends State<RecycleBinPage> {
|
||||
case _ItemType.bookExcerpt:
|
||||
await provider.restoreBookExcerpt(item.id);
|
||||
if (mounted) ToastUtil.show(context, '书摘已恢复');
|
||||
case _ItemType.notePlus:
|
||||
await provider.restoreNotePlusDoc(item.id);
|
||||
if (mounted) ToastUtil.show(context, '高级笔记已恢复');
|
||||
}
|
||||
_loadDeletedItems();
|
||||
}
|
||||
@@ -435,8 +421,6 @@ class _RecycleBinPageState extends State<RecycleBinPage> {
|
||||
await provider.permanentDeleteBookReview(item.id);
|
||||
case _ItemType.bookExcerpt:
|
||||
await provider.permanentDeleteBookExcerpt(item.id);
|
||||
case _ItemType.notePlus:
|
||||
await provider.permanentDeleteNotePlusDoc(item.id);
|
||||
}
|
||||
_loadDeletedItems();
|
||||
if (mounted) ToastUtil.show(context, '已彻底删除');
|
||||
|
||||
Reference in New Issue
Block a user