home: added drawer with videos item
This commit is contained in:
parent
503c5732e0
commit
86e0c1b081
8 changed files with 283 additions and 2 deletions
87
assets/aves_logo.svg
Normal file
87
assets/aves_logo.svg
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="265.55396"
|
||||
height="244.35027"
|
||||
version="1.1"
|
||||
id="svg16"
|
||||
sodipodi:docname="aves_logo.svg"
|
||||
inkscape:export-filename="C:\Users\tibo\Downloads\aves0030.png"
|
||||
inkscape:export-xdpi="98.300003"
|
||||
inkscape:export-ydpi="98.300003"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
|
||||
<metadata
|
||||
id="metadata20">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1600"
|
||||
inkscape:window-height="837"
|
||||
id="namedview18"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:zoom="1.37"
|
||||
inkscape:cx="171.45337"
|
||||
inkscape:cy="140.60642"
|
||||
inkscape:window-x="1358"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg16">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid28"
|
||||
originx="-117.22302"
|
||||
originy="-117.82488" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs6" />
|
||||
<g
|
||||
id="g4567"
|
||||
transform="translate(-128.91211,-134.61749)">
|
||||
<path
|
||||
id="rect3756"
|
||||
d="M 128.91211,145.45703 295.47266,312.01758 339.25,268.24219 216.46484,145.45703 Z"
|
||||
style="fill:#3f51b5;fill-opacity:1;stroke-width:1.91993546"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="rect4589"
|
||||
d="m 228.52199,267.34358 v 111.62418 l 55.81209,-55.81209 z"
|
||||
style="fill:#4caf50;fill-opacity:1;stroke-width:1.2847122" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="rect4589-5"
|
||||
d="M 339.24927,246.24167 V 134.61749 l -55.81209,55.81209 z"
|
||||
style="fill:#ffc107;fill-opacity:1;stroke-width:1.2847122" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="rect4589-5-8"
|
||||
d="m 394.46607,174.08259 -39.46511,-39.4651 v 39.4651 z"
|
||||
style="fill:#ff5722;fill-opacity:1;stroke-width:0.6423561" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -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<HomePage> {
|
|||
// 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,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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<dynamic, List<ImageEntry>> 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 }
|
||||
|
|
103
lib/widgets/album/all_collection_drawer.dart
Normal file
103
lib/widgets/album/all_collection_drawer.dart
Normal file
|
@ -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,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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),
|
||||
|
|
27
lib/widgets/album/filtered_collection_page.dart
Normal file
27
lib/widgets/album/filtered_collection_page.dart
Normal file
|
@ -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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
44
pubspec.lock
44
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"
|
||||
|
|
|
@ -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/
|
||||
|
|
Loading…
Reference in a new issue