info: improved metadata split in landscape
This commit is contained in:
parent
dbe5a4aa7c
commit
ce715c5866
1 changed files with 11 additions and 8 deletions
|
@ -47,16 +47,19 @@ class MetadataSectionState extends State<MetadataSection> {
|
||||||
|
|
||||||
Widget content;
|
Widget content;
|
||||||
if (MediaQuery.of(context).size.width > 400) {
|
if (MediaQuery.of(context).size.width > 400) {
|
||||||
final threshold = (2 * directoryNames.length + directoryNames.map((k) => metadataMap[k].length).reduce((v, e) => v + e)) / 2;
|
|
||||||
final first = <String>[], second = <String>[];
|
final first = <String>[], second = <String>[];
|
||||||
var processed = 0;
|
var firstItemCount = 0, secondItemCount = 0;
|
||||||
for (int i = 0; i < directoryNames.length; i++) {
|
var firstIndex = 0, secondIndex = directoryNames.length - 1;
|
||||||
final directoryName = directoryNames[i];
|
while (firstIndex <= secondIndex) {
|
||||||
if (processed <= threshold)
|
if (firstItemCount <= secondItemCount) {
|
||||||
|
final directoryName = directoryNames[firstIndex++];
|
||||||
first.add(directoryName);
|
first.add(directoryName);
|
||||||
else
|
firstItemCount += 2 + metadataMap[directoryName].length;
|
||||||
second.add(directoryName);
|
} else {
|
||||||
processed += 2 + metadataMap[directoryName].length;
|
final directoryName = directoryNames[secondIndex--];
|
||||||
|
second.insert(0, directoryName);
|
||||||
|
secondItemCount += 2 + metadataMap[directoryName].length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
content = Row(
|
content = Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|
Loading…
Reference in a new issue