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