drawer on all pages
This commit is contained in:
parent
578835d3d2
commit
4ea985b8f8
9 changed files with 179 additions and 183 deletions
|
@ -1,10 +1,10 @@
|
||||||
|
import 'package:aves/model/collection_lens.dart';
|
||||||
import 'package:aves/model/image_entry.dart';
|
import 'package:aves/model/image_entry.dart';
|
||||||
import 'package:aves/model/image_file_service.dart';
|
import 'package:aves/model/image_file_service.dart';
|
||||||
import 'package:aves/model/settings.dart';
|
import 'package:aves/model/settings.dart';
|
||||||
import 'package:aves/utils/android_file_utils.dart';
|
import 'package:aves/utils/android_file_utils.dart';
|
||||||
import 'package:aves/utils/viewer_service.dart';
|
import 'package:aves/utils/viewer_service.dart';
|
||||||
import 'package:aves/widgets/album/all_collection_drawer.dart';
|
import 'package:aves/widgets/album/collection_page.dart';
|
||||||
import 'package:aves/widgets/album/all_collection_page.dart';
|
|
||||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||||
import 'package:aves/widgets/common/providers/media_store_collection_provider.dart';
|
import 'package:aves/widgets/common/providers/media_store_collection_provider.dart';
|
||||||
import 'package:aves/widgets/fullscreen/fullscreen_page.dart';
|
import 'package:aves/widgets/fullscreen/fullscreen_page.dart';
|
||||||
|
@ -13,6 +13,7 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:outline_material_icons/outline_material_icons.dart';
|
import 'package:outline_material_icons/outline_material_icons.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
import 'package:pedantic/pedantic.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:screen/screen.dart';
|
import 'package:screen/screen.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -104,24 +105,14 @@ class _HomePageState extends State<HomePage> {
|
||||||
? SingleFullscreenPage(
|
? SingleFullscreenPage(
|
||||||
entry: _sharedEntry,
|
entry: _sharedEntry,
|
||||||
)
|
)
|
||||||
: const MediaStoreCollectionPage();
|
: MediaStoreCollectionProvider(
|
||||||
|
child: Consumer<CollectionLens>(
|
||||||
|
builder: (context, collection, child) => CollectionPage(
|
||||||
|
collection: collection,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MediaStoreCollectionPage extends StatelessWidget {
|
|
||||||
const MediaStoreCollectionPage();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
debugPrint('$runtimeType build');
|
|
||||||
return const MediaStoreCollectionProvider(
|
|
||||||
child: Scaffold(
|
|
||||||
body: AllCollectionPage(),
|
|
||||||
drawer: AllCollectionDrawer(),
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class CollectionLens with ChangeNotifier {
|
||||||
List<CollectionFilter> filters,
|
List<CollectionFilter> filters,
|
||||||
GroupFactor groupFactor,
|
GroupFactor groupFactor,
|
||||||
SortFactor sortFactor,
|
SortFactor sortFactor,
|
||||||
}) : this.filters = filters ?? [],
|
}) : this.filters = [if (filters != null) ...filters.where((f) => f != null)],
|
||||||
this.groupFactor = groupFactor ?? GroupFactor.month,
|
this.groupFactor = groupFactor ?? GroupFactor.month,
|
||||||
this.sortFactor = sortFactor ?? SortFactor.date {
|
this.sortFactor = sortFactor ?? SortFactor.date {
|
||||||
_subscriptions.add(source.eventBus.on<EntryAddedEvent>().listen((e) => onEntryAdded()));
|
_subscriptions.add(source.eventBus.on<EntryAddedEvent>().listen((e) => onEntryAdded()));
|
||||||
|
|
|
@ -1,29 +1,15 @@
|
||||||
import 'package:aves/model/collection_lens.dart';
|
import 'package:aves/model/collection_lens.dart';
|
||||||
import 'package:aves/model/settings.dart';
|
import 'package:aves/model/settings.dart';
|
||||||
import 'package:aves/widgets/album/search_delegate.dart';
|
import 'package:aves/widgets/album/search_delegate.dart';
|
||||||
import 'package:aves/widgets/album/thumbnail_collection.dart';
|
|
||||||
import 'package:aves/widgets/common/menu_row.dart';
|
import 'package:aves/widgets/common/menu_row.dart';
|
||||||
import 'package:aves/widgets/debug_page.dart';
|
|
||||||
import 'package:aves/widgets/stats.dart';
|
import 'package:aves/widgets/stats.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:outline_material_icons/outline_material_icons.dart';
|
import 'package:outline_material_icons/outline_material_icons.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
import 'package:pedantic/pedantic.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class AllCollectionPage extends StatelessWidget {
|
class AllCollectionAppBar extends SliverAppBar {
|
||||||
const AllCollectionPage();
|
AllCollectionAppBar()
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
debugPrint('$runtimeType build');
|
|
||||||
return ThumbnailCollection(
|
|
||||||
appBar: _AllCollectionAppBar(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AllCollectionAppBar extends SliverAppBar {
|
|
||||||
_AllCollectionAppBar()
|
|
||||||
: super(
|
: super(
|
||||||
title: const Text('All'),
|
title: const Text('All'),
|
||||||
actions: _buildActions(),
|
actions: _buildActions(),
|
||||||
|
@ -45,44 +31,40 @@ class _AllCollectionAppBar extends SliverAppBar {
|
||||||
),
|
),
|
||||||
Builder(
|
Builder(
|
||||||
builder: (context) => Consumer<CollectionLens>(
|
builder: (context) => Consumer<CollectionLens>(
|
||||||
builder: (context, collection, child) => PopupMenuButton<AlbumAction>(
|
builder: (context, collection, child) => PopupMenuButton<CollectionAction>(
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.sortByDate,
|
value: CollectionAction.sortByDate,
|
||||||
child: MenuRow(text: 'Sort by date', checked: collection.sortFactor == SortFactor.date),
|
child: MenuRow(text: 'Sort by date', checked: collection.sortFactor == SortFactor.date),
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.sortBySize,
|
value: CollectionAction.sortBySize,
|
||||||
child: MenuRow(text: 'Sort by size', checked: collection.sortFactor == SortFactor.size),
|
child: MenuRow(text: 'Sort by size', checked: collection.sortFactor == SortFactor.size),
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.sortByName,
|
value: CollectionAction.sortByName,
|
||||||
child: MenuRow(text: 'Sort by name', checked: collection.sortFactor == SortFactor.name),
|
child: MenuRow(text: 'Sort by name', checked: collection.sortFactor == SortFactor.name),
|
||||||
),
|
),
|
||||||
const PopupMenuDivider(),
|
const PopupMenuDivider(),
|
||||||
if (collection.sortFactor == SortFactor.date) ...[
|
if (collection.sortFactor == SortFactor.date) ...[
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.groupByAlbum,
|
value: CollectionAction.groupByAlbum,
|
||||||
child: MenuRow(text: 'Group by album', checked: collection.groupFactor == GroupFactor.album),
|
child: MenuRow(text: 'Group by album', checked: collection.groupFactor == GroupFactor.album),
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.groupByMonth,
|
value: CollectionAction.groupByMonth,
|
||||||
child: MenuRow(text: 'Group by month', checked: collection.groupFactor == GroupFactor.month),
|
child: MenuRow(text: 'Group by month', checked: collection.groupFactor == GroupFactor.month),
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.groupByDay,
|
value: CollectionAction.groupByDay,
|
||||||
child: MenuRow(text: 'Group by day', checked: collection.groupFactor == GroupFactor.day),
|
child: MenuRow(text: 'Group by day', checked: collection.groupFactor == GroupFactor.day),
|
||||||
),
|
),
|
||||||
const PopupMenuDivider(),
|
const PopupMenuDivider(),
|
||||||
],
|
],
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.stats,
|
value: CollectionAction.stats,
|
||||||
child: MenuRow(text: 'Stats', icon: OMIcons.pieChart),
|
child: MenuRow(text: 'Stats', icon: OMIcons.pieChart),
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
|
||||||
value: AlbumAction.debug,
|
|
||||||
child: MenuRow(text: 'Debug', icon: OMIcons.whatshot),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
onSelected: (action) => _onActionSelected(context, collection, action),
|
onSelected: (action) => _onActionSelected(context, collection, action),
|
||||||
),
|
),
|
||||||
|
@ -91,54 +73,40 @@ class _AllCollectionAppBar extends SliverAppBar {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _onActionSelected(BuildContext context, CollectionLens collection, AlbumAction action) async {
|
static void _onActionSelected(BuildContext context, CollectionLens collection, CollectionAction action) async {
|
||||||
// wait for the popup menu to hide before proceeding with the action
|
// wait for the popup menu to hide before proceeding with the action
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case AlbumAction.debug:
|
case CollectionAction.stats:
|
||||||
unawaited(_goToDebug(context, collection));
|
|
||||||
break;
|
|
||||||
case AlbumAction.stats:
|
|
||||||
unawaited(_goToStats(context, collection));
|
unawaited(_goToStats(context, collection));
|
||||||
break;
|
break;
|
||||||
case AlbumAction.groupByAlbum:
|
case CollectionAction.groupByAlbum:
|
||||||
settings.collectionGroupFactor = GroupFactor.album;
|
settings.collectionGroupFactor = GroupFactor.album;
|
||||||
collection.group(GroupFactor.album);
|
collection.group(GroupFactor.album);
|
||||||
break;
|
break;
|
||||||
case AlbumAction.groupByMonth:
|
case CollectionAction.groupByMonth:
|
||||||
settings.collectionGroupFactor = GroupFactor.month;
|
settings.collectionGroupFactor = GroupFactor.month;
|
||||||
collection.group(GroupFactor.month);
|
collection.group(GroupFactor.month);
|
||||||
break;
|
break;
|
||||||
case AlbumAction.groupByDay:
|
case CollectionAction.groupByDay:
|
||||||
settings.collectionGroupFactor = GroupFactor.day;
|
settings.collectionGroupFactor = GroupFactor.day;
|
||||||
collection.group(GroupFactor.day);
|
collection.group(GroupFactor.day);
|
||||||
break;
|
break;
|
||||||
case AlbumAction.sortByDate:
|
case CollectionAction.sortByDate:
|
||||||
settings.collectionSortFactor = SortFactor.date;
|
settings.collectionSortFactor = SortFactor.date;
|
||||||
collection.sort(SortFactor.date);
|
collection.sort(SortFactor.date);
|
||||||
break;
|
break;
|
||||||
case AlbumAction.sortBySize:
|
case CollectionAction.sortBySize:
|
||||||
settings.collectionSortFactor = SortFactor.size;
|
settings.collectionSortFactor = SortFactor.size;
|
||||||
collection.sort(SortFactor.size);
|
collection.sort(SortFactor.size);
|
||||||
break;
|
break;
|
||||||
case AlbumAction.sortByName:
|
case CollectionAction.sortByName:
|
||||||
settings.collectionSortFactor = SortFactor.name;
|
settings.collectionSortFactor = SortFactor.name;
|
||||||
collection.sort(SortFactor.name);
|
collection.sort(SortFactor.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future _goToDebug(BuildContext context, CollectionLens collection) {
|
|
||||||
return Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => DebugPage(
|
|
||||||
entries: collection.sortedEntries,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future _goToStats(BuildContext context, CollectionLens collection) {
|
static Future _goToStats(BuildContext context, CollectionLens collection) {
|
||||||
return Navigator.push(
|
return Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
@ -151,4 +119,4 @@ class _AllCollectionAppBar extends SliverAppBar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AlbumAction { debug, stats, groupByAlbum, groupByMonth, groupByDay, sortByDate, sortBySize, sortByName }
|
enum CollectionAction { stats, groupByAlbum, groupByMonth, groupByDay, sortByDate, sortBySize, sortByName }
|
|
@ -5,108 +5,92 @@ import 'package:aves/model/collection_lens.dart';
|
||||||
import 'package:aves/model/collection_source.dart';
|
import 'package:aves/model/collection_source.dart';
|
||||||
import 'package:aves/utils/android_file_utils.dart';
|
import 'package:aves/utils/android_file_utils.dart';
|
||||||
import 'package:aves/utils/color_utils.dart';
|
import 'package:aves/utils/color_utils.dart';
|
||||||
import 'package:aves/widgets/album/filtered_collection_page.dart';
|
import 'package:aves/widgets/album/collection_page.dart';
|
||||||
|
import 'package:aves/widgets/common/aves_logo.dart';
|
||||||
import 'package:aves/widgets/common/icons.dart';
|
import 'package:aves/widgets/common/icons.dart';
|
||||||
|
import 'package:aves/widgets/debug_page.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:outline_material_icons/outline_material_icons.dart';
|
import 'package:outline_material_icons/outline_material_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class AllCollectionDrawer extends StatefulWidget {
|
class CollectionDrawer extends StatefulWidget {
|
||||||
const AllCollectionDrawer();
|
final CollectionSource source;
|
||||||
|
|
||||||
|
const CollectionDrawer({@required this.source});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_AllCollectionDrawerState createState() => _AllCollectionDrawerState();
|
_CollectionDrawerState createState() => _CollectionDrawerState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
class _CollectionDrawerState extends State<CollectionDrawer> {
|
||||||
bool _albumsExpanded = false, _tagsExpanded = false, _countriesExpanded = false;
|
bool _albumsExpanded = false, _tagsExpanded = false, _countriesExpanded = false;
|
||||||
|
|
||||||
|
CollectionSource get source => widget.source;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final collection = Provider.of<CollectionLens>(context);
|
final header = Container(
|
||||||
final source = collection.source;
|
|
||||||
|
|
||||||
final header = DrawerHeader(
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).accentColor,
|
border: Border(
|
||||||
|
bottom: Divider.createBorderSide(context),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
child: Container(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(16),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
color: Theme.of(context).accentColor,
|
||||||
children: [
|
child: SafeArea(
|
||||||
Row(
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
CircleAvatar(
|
children: [
|
||||||
backgroundColor: Colors.white,
|
Row(
|
||||||
radius: 44,
|
children: [
|
||||||
child: Padding(
|
const AvesLogo(size: 64),
|
||||||
padding: const EdgeInsets.only(top: 6.0),
|
const SizedBox(width: 16),
|
||||||
child: SvgPicture.asset(
|
const Text(
|
||||||
'assets/aves_logo.svg',
|
'Aves',
|
||||||
width: 64,
|
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: [
|
|
||||||
const Icon(OMIcons.photoLibrary),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text('${collection.imageCount}'),
|
|
||||||
]),
|
|
||||||
Row(children: [
|
|
||||||
const Icon(OMIcons.videoLibrary),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text('${collection.videoCount}'),
|
|
||||||
]),
|
|
||||||
Row(children: [
|
|
||||||
const Icon(OMIcons.photoAlbum),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text('${source.albumCount}'),
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final allMediaEntry = _FilteredCollectionNavTile(
|
||||||
|
source: source,
|
||||||
|
leading: const Icon(OMIcons.photo),
|
||||||
|
title: 'All media',
|
||||||
|
filter: null,
|
||||||
|
);
|
||||||
|
final videoEntry = _FilteredCollectionNavTile(
|
||||||
|
source: source,
|
||||||
|
leading: const Icon(OMIcons.movie),
|
||||||
|
title: 'Videos',
|
||||||
|
filter: VideoFilter(),
|
||||||
|
);
|
||||||
final gifEntry = _FilteredCollectionNavTile(
|
final gifEntry = _FilteredCollectionNavTile(
|
||||||
collection: collection,
|
source: source,
|
||||||
leading: const Icon(OMIcons.gif),
|
leading: const Icon(OMIcons.gif),
|
||||||
title: 'GIFs',
|
title: 'GIFs',
|
||||||
filter: GifFilter(),
|
filter: GifFilter(),
|
||||||
);
|
);
|
||||||
final videoEntry = _FilteredCollectionNavTile(
|
|
||||||
collection: collection,
|
|
||||||
leading: const Icon(OMIcons.videoLibrary),
|
|
||||||
title: 'Videos',
|
|
||||||
filter: VideoFilter(),
|
|
||||||
);
|
|
||||||
final buildAlbumEntry = (album) => _FilteredCollectionNavTile(
|
final buildAlbumEntry = (album) => _FilteredCollectionNavTile(
|
||||||
collection: collection,
|
source: source,
|
||||||
leading: IconUtils.getAlbumIcon(context, album),
|
leading: IconUtils.getAlbumIcon(context, album),
|
||||||
title: CollectionSource.getUniqueAlbumName(album, source.sortedAlbums),
|
title: CollectionSource.getUniqueAlbumName(album, source.sortedAlbums),
|
||||||
dense: true,
|
dense: true,
|
||||||
filter: AlbumFilter(album),
|
filter: AlbumFilter(album),
|
||||||
);
|
);
|
||||||
final buildTagEntry = (tag) => _FilteredCollectionNavTile(
|
final buildTagEntry = (tag) => _FilteredCollectionNavTile(
|
||||||
collection: collection,
|
source: source,
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
OMIcons.label,
|
OMIcons.localOffer,
|
||||||
color: stringToColor(tag),
|
color: stringToColor(tag),
|
||||||
),
|
),
|
||||||
title: tag,
|
title: tag,
|
||||||
|
@ -114,7 +98,7 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
filter: TagFilter(tag),
|
filter: TagFilter(tag),
|
||||||
);
|
);
|
||||||
final buildCountryEntry = (country) => _FilteredCollectionNavTile(
|
final buildCountryEntry = (country) => _FilteredCollectionNavTile(
|
||||||
collection: collection,
|
source: source,
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
OMIcons.place,
|
OMIcons.place,
|
||||||
color: stringToColor(country),
|
color: stringToColor(country),
|
||||||
|
@ -141,10 +125,11 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
final countries = source.sortedCountries;
|
final countries = source.sortedCountries;
|
||||||
final tags = source.sortedTags;
|
final tags = source.sortedTags;
|
||||||
|
|
||||||
final drawerItems = [
|
final drawerItems = <Widget>[
|
||||||
header,
|
header,
|
||||||
gifEntry,
|
allMediaEntry,
|
||||||
videoEntry,
|
videoEntry,
|
||||||
|
gifEntry,
|
||||||
if (specialAlbums.isNotEmpty) ...[
|
if (specialAlbums.isNotEmpty) ...[
|
||||||
const Divider(),
|
const Divider(),
|
||||||
...specialAlbums.map(buildAlbumEntry),
|
...specialAlbums.map(buildAlbumEntry),
|
||||||
|
@ -202,7 +187,7 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
top: false,
|
top: false,
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: ExpansionTile(
|
child: ExpansionTile(
|
||||||
leading: const Icon(OMIcons.label),
|
leading: const Icon(OMIcons.localOffer),
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
const Text('Tags'),
|
const Text('Tags'),
|
||||||
|
@ -219,6 +204,28 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
children: tags.map(buildTagEntry).toList(),
|
children: tags.map(buildTagEntry).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (kDebugMode) ...[
|
||||||
|
const Divider(),
|
||||||
|
SafeArea(
|
||||||
|
top: false,
|
||||||
|
bottom: false,
|
||||||
|
child: ListTile(
|
||||||
|
leading: const Icon(OMIcons.whatshot),
|
||||||
|
title: const Text('Debug'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => DebugPage(
|
||||||
|
source: source,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return Drawer(
|
return Drawer(
|
||||||
|
@ -244,14 +251,14 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FilteredCollectionNavTile extends StatelessWidget {
|
class _FilteredCollectionNavTile extends StatelessWidget {
|
||||||
final CollectionLens collection;
|
final CollectionSource source;
|
||||||
final Widget leading;
|
final Widget leading;
|
||||||
final String title;
|
final String title;
|
||||||
final bool dense;
|
final bool dense;
|
||||||
final CollectionFilter filter;
|
final CollectionFilter filter;
|
||||||
|
|
||||||
const _FilteredCollectionNavTile({
|
const _FilteredCollectionNavTile({
|
||||||
@required this.collection,
|
@required this.source,
|
||||||
@required this.leading,
|
@required this.leading,
|
||||||
@required this.title,
|
@required this.title,
|
||||||
bool dense,
|
bool dense,
|
||||||
|
@ -268,16 +275,18 @@ class _FilteredCollectionNavTile extends StatelessWidget {
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
dense: dense,
|
dense: dense,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pushAndRemoveUntil(
|
||||||
Navigator.push(
|
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => FilteredCollectionPage(
|
builder: (context) => CollectionPage(
|
||||||
collection: collection,
|
collection: CollectionLens(
|
||||||
filter: filter,
|
source: source,
|
||||||
|
filters: [filter],
|
||||||
|
),
|
||||||
title: title,
|
title: title,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
(route) => false,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:aves/model/collection_filters.dart';
|
|
||||||
import 'package:aves/model/collection_lens.dart';
|
import 'package:aves/model/collection_lens.dart';
|
||||||
import 'package:aves/widgets/album/all_collection_page.dart';
|
import 'package:aves/widgets/album/all_collection_app_bar.dart';
|
||||||
|
import 'package:aves/widgets/album/collection_drawer.dart';
|
||||||
import 'package:aves/widgets/album/thumbnail_collection.dart';
|
import 'package:aves/widgets/album/thumbnail_collection.dart';
|
||||||
import 'package:aves/widgets/common/menu_row.dart';
|
import 'package:aves/widgets/common/menu_row.dart';
|
||||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||||
|
@ -9,30 +9,36 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:outline_material_icons/outline_material_icons.dart';
|
import 'package:outline_material_icons/outline_material_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class FilteredCollectionPage extends StatelessWidget {
|
class CollectionPage extends StatelessWidget {
|
||||||
final CollectionLens collection;
|
final CollectionLens collection;
|
||||||
final CollectionFilter filter;
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
FilteredCollectionPage({Key key, CollectionLens collection, this.filter, this.title})
|
const CollectionPage({
|
||||||
: this.collection = CollectionLens.from(collection, filter),
|
Key key,
|
||||||
super(key: key);
|
@required this.collection,
|
||||||
|
this.title,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MediaQueryDataProvider(
|
return MediaQueryDataProvider(
|
||||||
child: Scaffold(
|
child: ChangeNotifierProvider<CollectionLens>.value(
|
||||||
body: ChangeNotifierProvider<CollectionLens>.value(
|
value: collection,
|
||||||
value: collection,
|
child: Scaffold(
|
||||||
child: ThumbnailCollection(
|
body: ThumbnailCollection(
|
||||||
appBar: SliverAppBar(
|
appBar: collection.filters.isEmpty
|
||||||
title: Text(title),
|
? AllCollectionAppBar()
|
||||||
actions: _buildActions(),
|
: SliverAppBar(
|
||||||
floating: true,
|
title: Text(title),
|
||||||
),
|
actions: _buildActions(),
|
||||||
|
floating: true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
drawer: CollectionDrawer(
|
||||||
|
source: collection.source,
|
||||||
|
),
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
),
|
),
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -41,10 +47,10 @@ class FilteredCollectionPage extends StatelessWidget {
|
||||||
return [
|
return [
|
||||||
Builder(
|
Builder(
|
||||||
builder: (context) => Consumer<CollectionLens>(
|
builder: (context) => Consumer<CollectionLens>(
|
||||||
builder: (context, collection, child) => PopupMenuButton<AlbumAction>(
|
builder: (context, collection, child) => PopupMenuButton<CollectionAction>(
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: AlbumAction.stats,
|
value: CollectionAction.stats,
|
||||||
child: MenuRow(text: 'Stats', icon: OMIcons.pieChart),
|
child: MenuRow(text: 'Stats', icon: OMIcons.pieChart),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -55,9 +61,9 @@ class FilteredCollectionPage extends StatelessWidget {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _onActionSelected(BuildContext context, CollectionLens collection, AlbumAction action) {
|
static void _onActionSelected(BuildContext context, CollectionLens collection, CollectionAction action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case AlbumAction.stats:
|
case CollectionAction.stats:
|
||||||
_goToStats(context, collection);
|
_goToStats(context, collection);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
23
lib/widgets/common/aves_logo.dart
Normal file
23
lib/widgets/common/aves_logo.dart
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
|
class AvesLogo extends StatelessWidget {
|
||||||
|
final double size;
|
||||||
|
|
||||||
|
const AvesLogo({@required this.size});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CircleAvatar(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
radius: size / 2,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(top: size / 15),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
'assets/aves_logo.svg',
|
||||||
|
width: size / 1.4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:aves/model/collection_source.dart';
|
||||||
import 'package:aves/model/image_entry.dart';
|
import 'package:aves/model/image_entry.dart';
|
||||||
import 'package:aves/model/image_metadata.dart';
|
import 'package:aves/model/image_metadata.dart';
|
||||||
import 'package:aves/model/metadata_db.dart';
|
import 'package:aves/model/metadata_db.dart';
|
||||||
|
@ -8,9 +9,9 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
|
|
||||||
class DebugPage extends StatefulWidget {
|
class DebugPage extends StatefulWidget {
|
||||||
final List<ImageEntry> entries;
|
final CollectionSource source;
|
||||||
|
|
||||||
const DebugPage({this.entries});
|
const DebugPage({this.source});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => DebugPageState();
|
State<StatefulWidget> createState() => DebugPageState();
|
||||||
|
@ -21,7 +22,7 @@ class DebugPageState extends State<DebugPage> {
|
||||||
Future<List<CatalogMetadata>> _dbMetadataLoader;
|
Future<List<CatalogMetadata>> _dbMetadataLoader;
|
||||||
Future<List<AddressDetails>> _dbAddressLoader;
|
Future<List<AddressDetails>> _dbAddressLoader;
|
||||||
|
|
||||||
List<ImageEntry> get entries => widget.entries;
|
List<ImageEntry> get entries => widget.source.entries;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import 'package:aves/model/image_entry.dart';
|
||||||
import 'package:aves/model/settings.dart';
|
import 'package:aves/model/settings.dart';
|
||||||
import 'package:aves/utils/android_app_service.dart';
|
import 'package:aves/utils/android_app_service.dart';
|
||||||
import 'package:aves/utils/geo_utils.dart';
|
import 'package:aves/utils/geo_utils.dart';
|
||||||
import 'package:aves/widgets/album/filtered_collection_page.dart';
|
import 'package:aves/widgets/album/collection_page.dart';
|
||||||
import 'package:aves/widgets/fullscreen/info/info_page.dart';
|
import 'package:aves/widgets/fullscreen/info/info_page.dart';
|
||||||
import 'package:aves/widgets/fullscreen/info/navigation_button.dart';
|
import 'package:aves/widgets/fullscreen/info/navigation_button.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -130,9 +130,8 @@ class _LocationSectionState extends State<LocationSection> {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => FilteredCollectionPage(
|
builder: (context) => CollectionPage(
|
||||||
collection: collection,
|
collection: CollectionLens.from(collection, CountryFilter(country)),
|
||||||
filter: CountryFilter(country),
|
|
||||||
title: country,
|
title: country,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:aves/model/collection_filters.dart';
|
import 'package:aves/model/collection_filters.dart';
|
||||||
import 'package:aves/model/collection_lens.dart';
|
import 'package:aves/model/collection_lens.dart';
|
||||||
import 'package:aves/model/image_entry.dart';
|
import 'package:aves/model/image_entry.dart';
|
||||||
import 'package:aves/widgets/album/filtered_collection_page.dart';
|
import 'package:aves/widgets/album/collection_page.dart';
|
||||||
import 'package:aves/widgets/fullscreen/info/info_page.dart';
|
import 'package:aves/widgets/fullscreen/info/info_page.dart';
|
||||||
import 'package:aves/widgets/fullscreen/info/navigation_button.dart';
|
import 'package:aves/widgets/fullscreen/info/navigation_button.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
@ -26,7 +26,7 @@ class XmpTagSectionSliver extends AnimatedWidget {
|
||||||
tags.isEmpty
|
tags.isEmpty
|
||||||
? []
|
? []
|
||||||
: [
|
: [
|
||||||
const SectionRow(OMIcons.label),
|
const SectionRow(OMIcons.localOffer),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: NavigationButton.buttonBorderWidth / 2),
|
padding: const EdgeInsets.symmetric(horizontal: NavigationButton.buttonBorderWidth / 2),
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
|
@ -49,9 +49,8 @@ class XmpTagSectionSliver extends AnimatedWidget {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => FilteredCollectionPage(
|
builder: (context) => CollectionPage(
|
||||||
collection: collection,
|
collection: CollectionLens.from(collection, TagFilter(tag)),
|
||||||
filter: TagFilter(tag),
|
|
||||||
title: tag,
|
title: tag,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue