minor fixes
This commit is contained in:
parent
e2f9377045
commit
bfe2b4d319
4 changed files with 111 additions and 87 deletions
|
@ -6,6 +6,7 @@ import 'package:aves/widgets/album/filtered_collection_page.dart';
|
||||||
import 'package:aves/widgets/common/icons.dart';
|
import 'package:aves/widgets/common/icons.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class AllCollectionDrawer extends StatelessWidget {
|
class AllCollectionDrawer extends StatelessWidget {
|
||||||
final ImageCollection collection;
|
final ImageCollection collection;
|
||||||
|
@ -17,96 +18,114 @@ class AllCollectionDrawer extends StatelessWidget {
|
||||||
final albums = collection.sortedAlbums;
|
final albums = collection.sortedAlbums;
|
||||||
final tags = collection.sortedTags;
|
final tags = collection.sortedTags;
|
||||||
return Drawer(
|
return Drawer(
|
||||||
child: ListView(
|
child: Selector<MediaQueryData, double>(
|
||||||
padding: EdgeInsets.only(bottom: window.viewInsets.bottom),
|
selector: (c, mq) => mq.viewInsets.bottom,
|
||||||
children: [
|
builder: (c, mqViewInsetsBottom, child) => ListView(
|
||||||
DrawerHeader(
|
padding: EdgeInsets.only(bottom: mqViewInsetsBottom),
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
color: Theme.of(context).accentColor,
|
DrawerHeader(
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
child: SafeArea(
|
color: Theme.of(context).accentColor,
|
||||||
child: Column(
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: SafeArea(
|
||||||
children: [
|
child: Column(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
Row(
|
||||||
backgroundColor: Colors.white,
|
children: [
|
||||||
radius: 44,
|
CircleAvatar(
|
||||||
child: Padding(
|
backgroundColor: Colors.white,
|
||||||
padding: const EdgeInsets.only(top: 6.0),
|
radius: 44,
|
||||||
child: SvgPicture.asset(
|
child: Padding(
|
||||||
'assets/aves_logo.svg',
|
padding: const EdgeInsets.only(top: 6.0),
|
||||||
width: 64,
|
child: SvgPicture.asset(
|
||||||
|
'assets/aves_logo.svg',
|
||||||
|
width: 64,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 16),
|
||||||
const SizedBox(width: 16),
|
const Text(
|
||||||
const Text(
|
'Aves',
|
||||||
'Aves',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 44,
|
||||||
fontSize: 44,
|
fontFamily: 'Concourse Caps',
|
||||||
fontFamily: 'Concourse Caps',
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(height: 16),
|
||||||
const SizedBox(height: 16),
|
Row(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
children: [
|
Row(children: [
|
||||||
Row(children: [
|
Icon(Icons.photo_library),
|
||||||
Icon(Icons.photo_library),
|
const SizedBox(width: 4),
|
||||||
const SizedBox(width: 4),
|
Text('${collection.imageCount}')
|
||||||
Text('${collection.imageCount}')
|
]),
|
||||||
]),
|
Row(children: [
|
||||||
Row(children: [
|
Icon(Icons.video_library),
|
||||||
Icon(Icons.video_library),
|
const SizedBox(width: 4),
|
||||||
const SizedBox(width: 4),
|
Text('${collection.videoCount}')
|
||||||
Text('${collection.videoCount}')
|
]),
|
||||||
]),
|
Row(children: [
|
||||||
Row(children: [
|
Icon(Icons.photo_album),
|
||||||
Icon(Icons.photo_album),
|
const SizedBox(width: 4),
|
||||||
const SizedBox(width: 4),
|
Text('${collection.albumCount}')
|
||||||
Text('${collection.albumCount}')
|
]),
|
||||||
]),
|
Row(children: [
|
||||||
Row(children: [
|
Icon(Icons.label),
|
||||||
Icon(Icons.label),
|
const SizedBox(width: 4),
|
||||||
const SizedBox(width: 4),
|
Text('${collection.tagCount}')
|
||||||
Text('${collection.tagCount}')
|
]),
|
||||||
]),
|
],
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
_FilteredCollectionNavTile(
|
||||||
_buildFilteredCollectionNavTile(
|
collection: collection,
|
||||||
context: context,
|
leading: Icon(Icons.video_library),
|
||||||
leading: Icon(Icons.video_library),
|
title: 'Videos',
|
||||||
title: 'Videos',
|
filter: (entry) => entry.isVideo,
|
||||||
filter: (entry) => entry.isVideo,
|
),
|
||||||
),
|
const Divider(),
|
||||||
const Divider(),
|
...albums.map((album) => _FilteredCollectionNavTile(
|
||||||
...albums.map((album) => _buildFilteredCollectionNavTile(
|
collection: collection,
|
||||||
context: context,
|
leading: IconUtils.getAlbumIcon(context, album) ?? Icon(Icons.photo_album),
|
||||||
leading: IconUtils.getAlbumIcon(context, album) ?? Icon(Icons.photo_album),
|
title: collection.getUniqueAlbumName(album, albums),
|
||||||
title: collection.getUniqueAlbumName(album, albums),
|
filter: (entry) => entry.directory == album,
|
||||||
filter: (entry) => entry.directory == album,
|
)),
|
||||||
)),
|
const Divider(),
|
||||||
const Divider(),
|
...tags.map((tag) => _FilteredCollectionNavTile(
|
||||||
...tags.map((tag) => _buildFilteredCollectionNavTile(
|
collection: collection,
|
||||||
context: context,
|
leading: Icon(Icons.label),
|
||||||
leading: Icon(Icons.label),
|
title: tag,
|
||||||
title: tag,
|
filter: (entry) => entry.xmpSubjects.contains(tag),
|
||||||
filter: (entry) => entry.xmpSubjects.contains(tag),
|
)),
|
||||||
)),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildFilteredCollectionNavTile({BuildContext context, Widget leading, String title, bool Function(ImageEntry) filter}) {
|
class _FilteredCollectionNavTile extends StatelessWidget {
|
||||||
|
final ImageCollection collection;
|
||||||
|
final Widget leading;
|
||||||
|
final String title;
|
||||||
|
final bool Function(ImageEntry) filter;
|
||||||
|
|
||||||
|
const _FilteredCollectionNavTile({
|
||||||
|
@required this.collection,
|
||||||
|
@required this.leading,
|
||||||
|
@required this.title,
|
||||||
|
@required this.filter,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
top: false,
|
top: false,
|
||||||
bottom: false,
|
bottom: false,
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:aves/utils/android_file_utils.dart';
|
||||||
import 'package:aves/widgets/common/app_icon.dart';
|
import 'package:aves/widgets/common/app_icon.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class VideoIcon extends StatelessWidget {
|
class VideoIcon extends StatelessWidget {
|
||||||
final ImageEntry entry;
|
final ImageEntry entry;
|
||||||
|
@ -103,10 +104,13 @@ class IconUtils {
|
||||||
final parts = albumDirectory.split(separator);
|
final parts = albumDirectory.split(separator);
|
||||||
if (albumDirectory.startsWith(androidFileUtils.externalStorage) && appNameMap.keys.contains(parts.last)) {
|
if (albumDirectory.startsWith(androidFileUtils.externalStorage) && appNameMap.keys.contains(parts.last)) {
|
||||||
final packageName = appNameMap[parts.last];
|
final packageName = appNameMap[parts.last];
|
||||||
return AppIcon(
|
return Selector<MediaQueryData, double>(
|
||||||
packageName: packageName,
|
selector: (c, mq) => mq.devicePixelRatio,
|
||||||
size: IconTheme.of(context).size,
|
builder: (c, devicePixelRatio, child) => AppIcon(
|
||||||
devicePixelRatio: window.devicePixelRatio,
|
packageName: packageName,
|
||||||
|
size: IconTheme.of(context).size,
|
||||||
|
devicePixelRatio: devicePixelRatio,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -43,9 +43,9 @@ class MetadataSectionState extends State<MetadataSection> {
|
||||||
builder: (c, mqWidth, child) => FutureBuilder(
|
builder: (c, mqWidth, child) => FutureBuilder(
|
||||||
future: _metadataLoader,
|
future: _metadataLoader,
|
||||||
builder: (futureContext, AsyncSnapshot<Map> snapshot) {
|
builder: (futureContext, AsyncSnapshot<Map> snapshot) {
|
||||||
final metadataMap = snapshot.data.cast<String, Map>();
|
|
||||||
if (snapshot.hasError) return Text(snapshot.error.toString());
|
if (snapshot.hasError) return Text(snapshot.error.toString());
|
||||||
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
|
if (snapshot.connectionState != ConnectionState.done) return const SizedBox.shrink();
|
||||||
|
final metadataMap = snapshot.data.cast<String, Map>();
|
||||||
final directoryNames = metadataMap.keys.toList()..sort();
|
final directoryNames = metadataMap.keys.toList()..sort();
|
||||||
|
|
||||||
Widget content;
|
Widget content;
|
||||||
|
|
|
@ -133,7 +133,8 @@ class _FullscreenBottomOverlayContent extends StatelessWidget {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
softWrap: false,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
child: Selector<MediaQueryData, Orientation>(
|
child: Selector<MediaQueryData, Orientation>(
|
||||||
selector: (c, mq) => mq.orientation,
|
selector: (c, mq) => mq.orientation,
|
||||||
|
|
Loading…
Reference in a new issue