view log del action +
This commit is contained in:
parent
b939cf1258
commit
3591c316ba
Binary file not shown.
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 309 KiB |
|
@ -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 "";
|
||||
}
|
||||
|
|
|
@ -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<ViewLogsScreen> {
|
|||
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<ViewLogsScreen> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ViewLogWrap extends StatelessWidget {
|
||||
final Function(String) onTapComic;
|
||||
final List<ViewLogWrapEntity> comics;
|
||||
|
@ -174,32 +167,8 @@ class ViewLogWrap extends StatelessWidget {
|
|||
return Wrap(
|
||||
alignment: WrapAlignment.spaceAround,
|
||||
children: comics.map((e) {
|
||||
if (e.deleted) {
|
||||
return 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(
|
||||
'已删除\n',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(height: 1.4),
|
||||
strutStyle: StrutStyle(height: 1.4),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return InkWell(
|
||||
key: e.key,
|
||||
onTap: () {
|
||||
onTapComic(e.id);
|
||||
},
|
||||
|
@ -230,19 +199,17 @@ class ViewLogWrap extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}).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);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@ class ContentError extends StatelessWidget {
|
|||
case ERROR_TYPE_TIME:
|
||||
message = "请检查设备时间";
|
||||
break;
|
||||
case ERROR_TYPE_UNDER_VIEW:
|
||||
message = "资源未审核或不可用";
|
||||
break;
|
||||
default:
|
||||
message = "啊哦, 被玩坏了";
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue