info: open at most one metadata directory

This commit is contained in:
Thibault Deckers 2020-04-12 16:15:14 +09:00
parent 96aedf0dc2
commit acc2cd6c9e
3 changed files with 14 additions and 3 deletions

View file

@ -26,6 +26,7 @@ class MetadataSectionSliver extends StatefulWidget {
class _MetadataSectionSliverState extends State<MetadataSectionSliver> with AutomaticKeepAliveClientMixin {
List<_MetadataDirectory> _metadata = [];
String _loadedMetadataUri;
final ValueNotifier<String> _expandedDirectoryNotifier = ValueNotifier(null);
bool get isVisible => widget.visibleNotifier.value;
@ -81,6 +82,8 @@ class _MetadataSectionSliverState extends State<MetadataSectionSliver> with Auto
}
final dir = directoriesWithTitle[index - 1 - untitledDirectoryCount];
return ExpansionTileCard(
value: dir.name,
expandedNotifier: _expandedDirectoryNotifier,
title: _DirectoryTitle(dir.name),
children: [
const Divider(thickness: 1.0, height: 1.0),
@ -91,6 +94,7 @@ class _MetadataSectionSliverState extends State<MetadataSectionSliver> with Auto
),
],
baseColor: Colors.grey[900],
expandedColor: Colors.grey[850],
);
},
childCount: 1 + _metadata.length,
@ -119,6 +123,7 @@ class _MetadataSectionSliverState extends State<MetadataSectionSliver> with Auto
_metadata = [];
_loadedMetadataUri = null;
}
_expandedDirectoryNotifier.value = null;
if (mounted) setState(() {});
}

View file

@ -104,9 +104,11 @@ packages:
expansion_tile_card:
dependency: "direct main"
description:
name: expansion_tile_card
url: "https://pub.dartlang.org"
source: hosted
path: "."
ref: HEAD
resolved-ref: edb6b11bb448fc2f30e566a20605b37093503176
url: "git://github.com/deckerst/expansion_tile_card.git"
source: git
version: "1.0.3"
flushbar:
dependency: "direct main"

View file

@ -20,10 +20,14 @@ dependencies:
charts_flutter:
collection:
draggable_scrollbar:
# path: ../flutter-draggable-scrollbar
git:
url: git://github.com/deckerst/flutter-draggable-scrollbar.git
event_bus:
expansion_tile_card:
# path: ../expansion_tile_card
git:
url: git://github.com/deckerst/expansion_tile_card.git
flushbar:
# flushbar-1.9.1 cannot be built with Flutter 1.15.17
git: