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_NETWORK = "NETWORK_ERROR";
|
||||||
const ERROR_TYPE_PERMISSION = "PERMISSION_ERROR";
|
const ERROR_TYPE_PERMISSION = "PERMISSION_ERROR";
|
||||||
const ERROR_TYPE_TIME = "TIME_ERROR";
|
const ERROR_TYPE_TIME = "TIME_ERROR";
|
||||||
|
const ERROR_TYPE_UNDER_VIEW = "UNDER_VIEW_ERROR";
|
||||||
|
|
||||||
// 错误的类型, 方便照展示和谐的提示
|
// 错误的类型, 方便照展示和谐的提示
|
||||||
String errorType(String error) {
|
String errorType(String error) {
|
||||||
|
@ -19,5 +20,8 @@ String errorType(String error) {
|
||||||
if (error.contains("time is not synchronize")) {
|
if (error.contains("time is not synchronize")) {
|
||||||
return ERROR_TYPE_TIME;
|
return ERROR_TYPE_TIME;
|
||||||
}
|
}
|
||||||
|
if (error.contains("under view")) {
|
||||||
|
return ERROR_TYPE_UNDER_VIEW;
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pikapi/basic/Common.dart';
|
import 'package:pikapi/basic/Common.dart';
|
||||||
import 'package:pikapi/basic/Method.dart';
|
import 'package:pikapi/basic/Method.dart';
|
||||||
|
@ -51,13 +50,8 @@ class _ViewLogsScreenState extends State<ViewLogsScreen> {
|
||||||
setState(() {
|
setState(() {
|
||||||
for (var i = 0; i < _comicList.length; i++) {
|
for (var i = 0; i < _comicList.length; i++) {
|
||||||
if (_comicList[i].id == id) {
|
if (_comicList[i].id == id) {
|
||||||
_comicList[i] = ViewLogWrapEntity(
|
_comicList.removeAt(i);
|
||||||
_comicList[i].id,
|
_offset--;
|
||||||
_comicList[i].title,
|
|
||||||
_comicList[i].fileServer,
|
|
||||||
_comicList[i].path,
|
|
||||||
deleted: true,
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +147,6 @@ class _ViewLogsScreenState extends State<ViewLogsScreen> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ViewLogWrap extends StatelessWidget {
|
class ViewLogWrap extends StatelessWidget {
|
||||||
final Function(String) onTapComic;
|
final Function(String) onTapComic;
|
||||||
final List<ViewLogWrapEntity> comics;
|
final List<ViewLogWrapEntity> comics;
|
||||||
|
@ -174,32 +167,8 @@ class ViewLogWrap extends StatelessWidget {
|
||||||
return Wrap(
|
return Wrap(
|
||||||
alignment: WrapAlignment.spaceAround,
|
alignment: WrapAlignment.spaceAround,
|
||||||
children: comics.map((e) {
|
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(
|
return InkWell(
|
||||||
|
key: e.key,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
onTapComic(e.id);
|
onTapComic(e.id);
|
||||||
},
|
},
|
||||||
|
@ -230,19 +199,17 @@ class ViewLogWrap extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}).toList(),
|
}).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ViewLogWrapEntity {
|
class ViewLogWrapEntity {
|
||||||
|
final Key key = UniqueKey();
|
||||||
final String id;
|
final String id;
|
||||||
final String title;
|
final String title;
|
||||||
final String fileServer;
|
final String fileServer;
|
||||||
final String path;
|
final String path;
|
||||||
final bool deleted;
|
|
||||||
|
|
||||||
ViewLogWrapEntity(this.id, this.title, this.fileServer, this.path,
|
ViewLogWrapEntity(this.id, this.title, this.fileServer, this.path);
|
||||||
{this.deleted = false});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ class ContentError extends StatelessWidget {
|
||||||
case ERROR_TYPE_TIME:
|
case ERROR_TYPE_TIME:
|
||||||
message = "请检查设备时间";
|
message = "请检查设备时间";
|
||||||
break;
|
break;
|
||||||
|
case ERROR_TYPE_UNDER_VIEW:
|
||||||
|
message = "资源未审核或不可用";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
message = "啊哦, 被玩坏了";
|
message = "啊哦, 被玩坏了";
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue