diff --git a/assets/aves_logo.svg b/assets/aves_logo.svg
new file mode 100644
index 000000000..685a245e0
--- /dev/null
+++ b/assets/aves_logo.svg
@@ -0,0 +1,87 @@
+
+
diff --git a/lib/main.dart b/lib/main.dart
index 208f53f77..febbf0047 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -3,6 +3,7 @@ import 'package:aves/model/image_entry.dart';
import 'package:aves/model/image_file_service.dart';
import 'package:aves/model/metadata_db.dart';
import 'package:aves/model/settings.dart';
+import 'package:aves/widgets/album/all_collection_drawer.dart';
import 'package:aves/widgets/album/all_collection_page.dart';
import 'package:aves/widgets/common/fake_app_bar.dart';
import 'package:flutter/material.dart';
@@ -81,6 +82,7 @@ class _HomePageState extends State {
// fake app bar so that content is safe from status bar, even though we use a SliverAppBar
appBar: FakeAppBar(),
body: AllCollectionPage(collection: localMediaCollection),
+ drawer: AllCollectionDrawer(collection: localMediaCollection),
resizeToAvoidBottomInset: false,
);
}
diff --git a/lib/model/image_collection.dart b/lib/model/image_collection.dart
index 3e2bad9ff..4be52b990 100644
--- a/lib/model/image_collection.dart
+++ b/lib/model/image_collection.dart
@@ -16,6 +16,14 @@ class ImageCollection with ChangeNotifier {
@required this.sortFactor,
}) : _rawEntries = entries;
+ int get imageCount => _rawEntries.where((entry) => !entry.isVideo).length;
+
+ int get videoCount => _rawEntries.where((entry) => entry.isVideo).length;
+
+ int get albumCount => 42;
+
+ int get tagCount => 42;
+
Map> get sections {
switch (sortFactor) {
case SortFactor.date:
@@ -125,6 +133,14 @@ class ImageCollection with ChangeNotifier {
metadataDb.saveAddresses(List.unmodifiable(newAddresses));
debugPrint('$runtimeType locateEntries complete in ${DateTime.now().difference(start).inSeconds}s');
}
+
+ ImageCollection filter(bool Function(ImageEntry) filter) {
+ return ImageCollection(
+ entries: _rawEntries.where(filter).toList(),
+ groupFactor: groupFactor,
+ sortFactor: sortFactor,
+ );
+ }
}
enum SortFactor { date, size }
diff --git a/lib/widgets/album/all_collection_drawer.dart b/lib/widgets/album/all_collection_drawer.dart
new file mode 100644
index 000000000..10d9c0ea6
--- /dev/null
+++ b/lib/widgets/album/all_collection_drawer.dart
@@ -0,0 +1,103 @@
+import 'package:aves/model/image_collection.dart';
+import 'package:aves/model/image_entry.dart';
+import 'package:aves/widgets/album/filtered_collection_page.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+
+class AllCollectionDrawer extends StatelessWidget {
+ final ImageCollection collection;
+
+ const AllCollectionDrawer({Key key, this.collection}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return Drawer(
+ child: ListView(
+ padding: EdgeInsets.zero,
+ children: [
+ DrawerHeader(
+ child: DefaultTextStyle(
+ style: TextStyle(
+ color: Colors.white,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ CircleAvatar(
+ child: Padding(
+ padding: EdgeInsets.only(top: 6.0),
+ child: SvgPicture.asset(
+ 'assets/aves_logo.svg',
+ width: 50,
+ ),
+ ),
+ backgroundColor: Colors.white,
+ radius: 32,
+ ),
+ SizedBox(width: 16),
+ Text('Aves',
+ style: TextStyle(
+ fontSize: 42,
+ )),
+ ],
+ ),
+ SizedBox(height: 8),
+ Row(
+ children: [
+ Container(
+ width: 72,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text('${collection.imageCount}'),
+ Text('${collection.videoCount}'),
+ Text('${collection.albumCount}'),
+ Text('${collection.tagCount}'),
+ ],
+ ),
+ ),
+ SizedBox(width: 8),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('images'),
+ Text('videos'),
+ Text('albums'),
+ Text('tags'),
+ ],
+ ),
+ ],
+ ),
+ ],
+ )),
+ decoration: BoxDecoration(
+ color: Theme.of(context).accentColor,
+ ),
+ ),
+ _buildFilteredCollectionNavTile(context, 'Videos', (entry) => entry.isVideo),
+ ],
+ ),
+ );
+ }
+
+ _buildFilteredCollectionNavTile(BuildContext context, String title, bool Function(ImageEntry) filter) {
+ return ListTile(
+ title: Text(title),
+ onTap: () {
+ Navigator.pop(context);
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => FilteredCollectionPage(
+ collection: collection,
+ filter: filter,
+ title: title,
+ ),
+ ),
+ );
+ },
+ );
+ }
+}
diff --git a/lib/widgets/album/all_collection_page.dart b/lib/widgets/album/all_collection_page.dart
index ad03677c9..03ac3b30c 100644
--- a/lib/widgets/album/all_collection_page.dart
+++ b/lib/widgets/album/all_collection_page.dart
@@ -16,7 +16,7 @@ class AllCollectionPage extends StatelessWidget {
return ThumbnailCollection(
collection: collection,
appBar: SliverAppBar(
- title: Text('Aves - All'),
+ title: Text('All'),
actions: [
IconButton(
icon: Icon(Icons.search),
diff --git a/lib/widgets/album/filtered_collection_page.dart b/lib/widgets/album/filtered_collection_page.dart
new file mode 100644
index 000000000..6b5d3b6e9
--- /dev/null
+++ b/lib/widgets/album/filtered_collection_page.dart
@@ -0,0 +1,27 @@
+import 'package:aves/model/image_collection.dart';
+import 'package:aves/model/image_entry.dart';
+import 'package:aves/widgets/album/thumbnail_collection.dart';
+import 'package:flutter/material.dart';
+
+class FilteredCollectionPage extends StatelessWidget {
+ final ImageCollection collection;
+ final bool Function(ImageEntry) filter;
+ final String title;
+
+ FilteredCollectionPage({Key key, ImageCollection collection, this.filter, this.title})
+ : this.collection = collection.filter(filter),
+ super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ body: ThumbnailCollection(
+ collection: collection,
+ appBar: SliverAppBar(
+ title: Text(title),
+ floating: true,
+ ),
+ ),
+ );
+ }
+}
diff --git a/pubspec.lock b/pubspec.lock
index 01168ac4e..44a23ebf5 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -43,6 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
+ convert:
+ dependency: transitive
+ description:
+ name: convert
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.1"
flushbar:
dependency: "direct main"
description:
@@ -62,6 +69,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
+ flutter_svg:
+ dependency: "direct main"
+ description:
+ name: flutter_svg
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.14.0"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -116,6 +130,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
+ path_drawing:
+ dependency: transitive
+ description:
+ name: path_drawing
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.4.1"
+ path_parsing:
+ dependency: transitive
+ description:
+ name: path_parsing
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.4"
pedantic:
dependency: transitive
description:
@@ -130,6 +158,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.2"
+ petitparser:
+ dependency: transitive
+ description:
+ name: petitparser
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.4.0"
photo_view:
dependency: "direct main"
description:
@@ -254,6 +289,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.2"
+ xml:
+ dependency: transitive
+ description:
+ name: xml
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.5.0"
sdks:
- dart: ">=2.2.2 <3.0.0"
+ dart: ">=2.4.0 <3.0.0"
flutter: ">=1.5.9-pre.94 <2.0.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 9e73e5e8c..ba7376fa4 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -23,6 +23,7 @@ dependencies:
collection:
flushbar:
flutter_sticky_header:
+ flutter_svg:
geocoder:
google_maps_flutter:
intl:
@@ -42,3 +43,6 @@ dev_dependencies:
flutter:
uses-material-design: true
+
+ assets:
+ - assets/