same app bar for all pages, keep sort/group settings
This commit is contained in:
parent
fe0440f265
commit
5df815e5c1
6 changed files with 15 additions and 57 deletions
|
@ -4,6 +4,7 @@ import 'dart:collection';
|
||||||
import 'package:aves/model/collection_filters.dart';
|
import 'package:aves/model/collection_filters.dart';
|
||||||
import 'package:aves/model/collection_source.dart';
|
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/settings.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
@ -21,8 +22,8 @@ class CollectionLens with ChangeNotifier {
|
||||||
CollectionLens({
|
CollectionLens({
|
||||||
@required this.source,
|
@required this.source,
|
||||||
List<CollectionFilter> filters,
|
List<CollectionFilter> filters,
|
||||||
GroupFactor groupFactor,
|
@required GroupFactor groupFactor,
|
||||||
SortFactor sortFactor,
|
@required SortFactor sortFactor,
|
||||||
}) : this.filters = [if (filters != null) ...filters.where((f) => f != null)].toSet(),
|
}) : this.filters = [if (filters != null) ...filters.where((f) => f != null)].toSet(),
|
||||||
this.groupFactor = groupFactor ?? GroupFactor.month,
|
this.groupFactor = groupFactor ?? GroupFactor.month,
|
||||||
this.sortFactor = sortFactor ?? SortFactor.date {
|
this.sortFactor = sortFactor ?? SortFactor.date {
|
||||||
|
@ -44,6 +45,8 @@ class CollectionLens with ChangeNotifier {
|
||||||
factory CollectionLens.empty() {
|
factory CollectionLens.empty() {
|
||||||
return CollectionLens(
|
return CollectionLens(
|
||||||
source: CollectionSource(),
|
source: CollectionSource(),
|
||||||
|
groupFactor: settings.collectionGroupFactor,
|
||||||
|
sortFactor: settings.collectionSortFactor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
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/filter_bar.dart';
|
||||||
import 'package:aves/widgets/album/search_delegate.dart';
|
import 'package:aves/widgets/album/search_delegate.dart';
|
||||||
import 'package:aves/widgets/common/menu_row.dart';
|
import 'package:aves/widgets/common/menu_row.dart';
|
||||||
import 'package:aves/widgets/stats.dart';
|
import 'package:aves/widgets/stats.dart';
|
||||||
|
@ -11,8 +12,9 @@ import 'package:provider/provider.dart';
|
||||||
class AllCollectionAppBar extends SliverAppBar {
|
class AllCollectionAppBar extends SliverAppBar {
|
||||||
AllCollectionAppBar()
|
AllCollectionAppBar()
|
||||||
: super(
|
: super(
|
||||||
title: const Text('All'),
|
title: const Text('Aves'),
|
||||||
actions: _buildActions(),
|
actions: _buildActions(),
|
||||||
|
bottom: FilterBar(),
|
||||||
floating: true,
|
floating: true,
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:ui';
|
||||||
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/collection_source.dart';
|
import 'package:aves/model/collection_source.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/color_utils.dart';
|
import 'package:aves/utils/color_utils.dart';
|
||||||
import 'package:aves/widgets/album/collection_page.dart';
|
import 'package:aves/widgets/album/collection_page.dart';
|
||||||
|
@ -281,6 +282,8 @@ class _FilteredCollectionNavTile extends StatelessWidget {
|
||||||
builder: (context) => CollectionPage(CollectionLens(
|
builder: (context) => CollectionPage(CollectionLens(
|
||||||
source: source,
|
source: source,
|
||||||
filters: [filter],
|
filters: [filter],
|
||||||
|
groupFactor: settings.collectionGroupFactor,
|
||||||
|
sortFactor: settings.collectionSortFactor,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
(route) => false,
|
(route) => false,
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import 'package:aves/model/collection_lens.dart';
|
import 'package:aves/model/collection_lens.dart';
|
||||||
import 'package:aves/widgets/album/all_collection_app_bar.dart';
|
import 'package:aves/widgets/album/collection_app_bar.dart';
|
||||||
import 'package:aves/widgets/album/collection_drawer.dart';
|
import 'package:aves/widgets/album/collection_drawer.dart';
|
||||||
import 'package:aves/widgets/album/filter_bar.dart';
|
|
||||||
import 'package:aves/widgets/album/thumbnail_collection.dart';
|
import 'package:aves/widgets/album/thumbnail_collection.dart';
|
||||||
import 'package:aves/widgets/common/data_providers/media_query_data_provider.dart';
|
import 'package:aves/widgets/common/data_providers/media_query_data_provider.dart';
|
||||||
import 'package:aves/widgets/common/menu_row.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:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class CollectionPage extends StatelessWidget {
|
class CollectionPage extends StatelessWidget {
|
||||||
|
@ -22,14 +18,7 @@ class CollectionPage extends StatelessWidget {
|
||||||
value: collection,
|
value: collection,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: ThumbnailCollection(
|
body: ThumbnailCollection(
|
||||||
appBar: collection.filters.isEmpty
|
appBar: AllCollectionAppBar(),
|
||||||
? AllCollectionAppBar()
|
|
||||||
: SliverAppBar(
|
|
||||||
title: const Text('Aves'),
|
|
||||||
actions: _buildActions(),
|
|
||||||
bottom: FilterBar(),
|
|
||||||
floating: true,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
drawer: CollectionDrawer(
|
drawer: CollectionDrawer(
|
||||||
source: collection.source,
|
source: collection.source,
|
||||||
|
@ -39,43 +28,4 @@ class CollectionPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Widget> _buildActions() {
|
|
||||||
return [
|
|
||||||
Builder(
|
|
||||||
builder: (context) => Consumer<CollectionLens>(
|
|
||||||
builder: (context, collection, child) => PopupMenuButton<CollectionAction>(
|
|
||||||
itemBuilder: (context) => [
|
|
||||||
PopupMenuItem(
|
|
||||||
value: CollectionAction.stats,
|
|
||||||
child: MenuRow(text: 'Stats', icon: OMIcons.pieChart),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onSelected: (action) => _onActionSelected(context, collection, action),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _onActionSelected(BuildContext context, CollectionLens collection, CollectionAction action) {
|
|
||||||
switch (action) {
|
|
||||||
case CollectionAction.stats:
|
|
||||||
_goToStats(context, collection);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future _goToStats(BuildContext context, CollectionLens collection) {
|
|
||||||
return Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => StatsPage(
|
|
||||||
collection: collection,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class FullscreenTopOverlay extends StatelessWidget {
|
||||||
scale: scale,
|
scale: scale,
|
||||||
child: PopupMenuButton<FullscreenAction>(
|
child: PopupMenuButton<FullscreenAction>(
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
PopupMenuItem(
|
const PopupMenuItem(
|
||||||
value: FullscreenAction.info,
|
value: FullscreenAction.info,
|
||||||
child: MenuRow(text: 'Info', icon: OMIcons.info),
|
child: MenuRow(text: 'Info', icon: OMIcons.info),
|
||||||
),
|
),
|
||||||
|
|
|
@ -49,7 +49,7 @@ class StatsPage extends StatelessWidget {
|
||||||
backgroundColor: Colors.white24,
|
backgroundColor: Colors.white24,
|
||||||
progressColor: Theme.of(context).accentColor,
|
progressColor: Theme.of(context).accentColor,
|
||||||
animation: true,
|
animation: true,
|
||||||
leading: Icon(OMIcons.place),
|
leading: const Icon(OMIcons.place),
|
||||||
// right padding to match leading, so that inside label is aligned with outside label below
|
// right padding to match leading, so that inside label is aligned with outside label below
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16) + const EdgeInsets.only(right: 24),
|
padding: const EdgeInsets.symmetric(horizontal: 16) + const EdgeInsets.only(right: 24),
|
||||||
center: Text(NumberFormat.percentPattern().format(withGpsPercent)),
|
center: Text(NumberFormat.percentPattern().format(withGpsPercent)),
|
||||||
|
|
Loading…
Reference in a new issue