|
@@ -135,8 +135,8 @@ class _MyAppState extends State<MyApp> {
|
|
|
|
|
|
|
|
return Expanded(
|
|
return Expanded(
|
|
|
child: ListView(
|
|
child: ListView(
|
|
|
- children: [
|
|
|
|
|
- _buildResultItem('相似图片组', _similarResult.length, isGroup: true),
|
|
|
|
|
|
|
+ children: [
|
|
|
|
|
+ _buildResultItem('相似图片组', _similarResult.length),
|
|
|
_buildResultItem('人物照片', _peopleResult.length),
|
|
_buildResultItem('人物照片', _peopleResult.length),
|
|
|
_buildResultItem('屏幕截图', _screenshotResult.length),
|
|
_buildResultItem('屏幕截图', _screenshotResult.length),
|
|
|
_buildResultItem('模糊图片', _blurryResult.length),
|
|
_buildResultItem('模糊图片', _blurryResult.length),
|
|
@@ -145,18 +145,15 @@ class _MyAppState extends State<MyApp> {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget _buildResultItem(String title, dynamic items, {bool isGroup = false}) {
|
|
|
|
|
- if (items == null) return const SizedBox.shrink();
|
|
|
|
|
-
|
|
|
|
|
- final count = isGroup ? (items as List).length : (items as List).length;
|
|
|
|
|
- final itemsText = isGroup ? '$count 组' : '$count 张';
|
|
|
|
|
|
|
+ Widget _buildResultItem(String title, int itemsCount) {
|
|
|
|
|
+ if (itemsCount == 0) return const SizedBox.shrink();
|
|
|
|
|
|
|
|
return Padding(
|
|
return Padding(
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
|
|
child: Column(
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
children: [
|
|
|
- Text('$title: $itemsText',
|
|
|
|
|
|
|
+ Text('$title: $itemsCount',
|
|
|
style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
|
// 这里可以添加图片预览
|
|
// 这里可以添加图片预览
|
|
|
],
|
|
],
|
|
@@ -229,6 +226,7 @@ class _MyAppState extends State<MyApp> {
|
|
|
_blurryResult.addAll(result.blurryImages?.map((image) => image).toList() ?? []);
|
|
_blurryResult.addAll(result.blurryImages?.map((image) => image).toList() ?? []);
|
|
|
}
|
|
}
|
|
|
if (event.progress?.isCompleted == true) {
|
|
if (event.progress?.isCompleted == true) {
|
|
|
|
|
+ print("分类完成, 总耗时: ${event.progress?.totalDuration}");
|
|
|
_isClassifying = false;
|
|
_isClassifying = false;
|
|
|
_subscription?.cancel();
|
|
_subscription?.cancel();
|
|
|
// 取消订阅
|
|
// 取消订阅
|