diff --git a/images/categories_screen.png b/images/categories_screen.png index c460124..50e11ed 100644 Binary files a/images/categories_screen.png and b/images/categories_screen.png differ diff --git a/lib/basic/enum/ErrorTypes.dart b/lib/basic/enum/ErrorTypes.dart index 47191fe..b96011b 100644 --- a/lib/basic/enum/ErrorTypes.dart +++ b/lib/basic/enum/ErrorTypes.dart @@ -1,6 +1,7 @@ const ERROR_TYPE_NETWORK = "NETWORK_ERROR"; const ERROR_TYPE_PERMISSION = "PERMISSION_ERROR"; const ERROR_TYPE_TIME = "TIME_ERROR"; +const ERROR_TYPE_UNDER_VIEW = "UNDER_VIEW_ERROR"; // 错误的类型, 方便照展示和谐的提示 String errorType(String error) { @@ -19,5 +20,8 @@ String errorType(String error) { if (error.contains("time is not synchronize")) { return ERROR_TYPE_TIME; } + if (error.contains("under view")) { + return ERROR_TYPE_UNDER_VIEW; + } return ""; } diff --git a/lib/screens/ViewLogsScreen.dart b/lib/screens/ViewLogsScreen.dart index 15d2467..cdbf05f 100644 --- a/lib/screens/ViewLogsScreen.dart +++ b/lib/screens/ViewLogsScreen.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:pikapi/basic/Common.dart'; import 'package:pikapi/basic/Method.dart'; @@ -51,13 +50,8 @@ class _ViewLogsScreenState extends State { setState(() { for (var i = 0; i < _comicList.length; i++) { if (_comicList[i].id == id) { - _comicList[i] = ViewLogWrapEntity( - _comicList[i].id, - _comicList[i].title, - _comicList[i].fileServer, - _comicList[i].path, - deleted: true, - ); + _comicList.removeAt(i); + _offset--; break; } } @@ -153,7 +147,6 @@ class _ViewLogsScreenState extends State { } } - class ViewLogWrap extends StatelessWidget { final Function(String) onTapComic; final List comics; @@ -174,8 +167,15 @@ class ViewLogWrap extends StatelessWidget { return Wrap( alignment: WrapAlignment.spaceAround, children: comics.map((e) { - if (e.deleted) { - return Card( + return InkWell( + key: e.key, + onTap: () { + onTapComic(e.id); + }, + onLongPress: () { + onDelete(e.id); + }, + child: Card( child: Container( width: width, child: Column( @@ -188,7 +188,7 @@ class ViewLogWrap extends StatelessWidget { path: e.path); }), Text( - '已删除\n', + e.title + '\n', maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle(height: 1.4), @@ -197,52 +197,19 @@ class ViewLogWrap extends StatelessWidget { ], ), ), - ); - } else { - return InkWell( - onTap: () { - onTapComic(e.id); - }, - onLongPress: () { - onDelete(e.id); - }, - child: Card( - child: Container( - width: width, - child: Column( - children: [ - LayoutBuilder(builder: - (BuildContext context, BoxConstraints constraints) { - return RemoteImage( - width: constraints.maxWidth, - fileServer: e.fileServer, - path: e.path); - }), - Text( - e.title + '\n', - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle(height: 1.4), - strutStyle: StrutStyle(height: 1.4), - ), - ], - ), - ), - ), - ); - } + ), + ); }).toList(), ); } } class ViewLogWrapEntity { + final Key key = UniqueKey(); final String id; final String title; final String fileServer; final String path; - final bool deleted; - ViewLogWrapEntity(this.id, this.title, this.fileServer, this.path, - {this.deleted = false}); + ViewLogWrapEntity(this.id, this.title, this.fileServer, this.path); } diff --git a/lib/screens/components/ContentError.dart b/lib/screens/components/ContentError.dart index 190536c..be5e6be 100644 --- a/lib/screens/components/ContentError.dart +++ b/lib/screens/components/ContentError.dart @@ -30,6 +30,9 @@ class ContentError extends StatelessWidget { case ERROR_TYPE_TIME: message = "请检查设备时间"; break; + case ERROR_TYPE_UNDER_VIEW: + message = "资源未审核或不可用"; + break; default: message = "啊哦, 被玩坏了"; break;