drawer: changed layout
This commit is contained in:
parent
8c756182b7
commit
7f11d3702a
1 changed files with 59 additions and 58 deletions
|
@ -20,7 +20,7 @@ class AllCollectionDrawer extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
bool _regularAlbumsExpanded = false, _tagsExpanded = false;
|
bool _albumsExpanded = false, _tagsExpanded = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -130,20 +130,7 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final tags = source.sortedTags;
|
final tags = source.sortedTags;
|
||||||
|
final drawerItems = [
|
||||||
return Drawer(
|
|
||||||
child: Selector<MediaQueryData, double>(
|
|
||||||
selector: (c, mq) => mq.viewInsets.bottom,
|
|
||||||
builder: (c, mqViewInsetsBottom, child) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
padding: EdgeInsets.only(bottom: mqViewInsetsBottom),
|
|
||||||
child: Theme(
|
|
||||||
data: Theme.of(context).copyWith(
|
|
||||||
// color used by `ExpansionTile` for leading icon
|
|
||||||
unselectedWidgetColor: Colors.white,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
header,
|
header,
|
||||||
gifEntry,
|
gifEntry,
|
||||||
videoEntry,
|
videoEntry,
|
||||||
|
@ -151,11 +138,7 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
const Divider(),
|
const Divider(),
|
||||||
...specialAlbums.map(buildAlbumEntry),
|
...specialAlbums.map(buildAlbumEntry),
|
||||||
],
|
],
|
||||||
if (appAlbums.isNotEmpty) ...[
|
if (appAlbums.isNotEmpty || regularAlbums.isNotEmpty)
|
||||||
const Divider(),
|
|
||||||
...appAlbums.map(buildAlbumEntry),
|
|
||||||
],
|
|
||||||
if (regularAlbums.isNotEmpty)
|
|
||||||
SafeArea(
|
SafeArea(
|
||||||
top: false,
|
top: false,
|
||||||
bottom: false,
|
bottom: false,
|
||||||
|
@ -166,15 +149,19 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
const Text('Albums'),
|
const Text('Albums'),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Text(
|
Text(
|
||||||
'${regularAlbums.length}',
|
'${appAlbums.length + regularAlbums.length}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: (_regularAlbumsExpanded ? Theme.of(context).accentColor : Colors.white).withOpacity(.6),
|
color: (_albumsExpanded ? Theme.of(context).accentColor : Colors.white).withOpacity(.6),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onExpansionChanged: (expanded) => setState(() => _regularAlbumsExpanded = expanded),
|
onExpansionChanged: (expanded) => setState(() => _albumsExpanded = expanded),
|
||||||
children: regularAlbums.map(buildAlbumEntry).toList(),
|
children: [
|
||||||
|
...appAlbums.map(buildAlbumEntry),
|
||||||
|
if (appAlbums.isNotEmpty && regularAlbums.isNotEmpty) const Divider(),
|
||||||
|
...regularAlbums.map(buildAlbumEntry),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (tags.isNotEmpty)
|
if (tags.isNotEmpty)
|
||||||
|
@ -199,7 +186,21 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
||||||
children: tags.map(buildTagEntry).toList(),
|
children: tags.map(buildTagEntry).toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
];
|
||||||
|
|
||||||
|
return Drawer(
|
||||||
|
child: Selector<MediaQueryData, double>(
|
||||||
|
selector: (c, mq) => mq.viewInsets.bottom,
|
||||||
|
builder: (c, mqViewInsetsBottom, child) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
padding: EdgeInsets.only(bottom: mqViewInsetsBottom),
|
||||||
|
child: Theme(
|
||||||
|
data: Theme.of(context).copyWith(
|
||||||
|
// color used by `ExpansionTile` for leading icon
|
||||||
|
unselectedWidgetColor: Colors.white,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: drawerItems,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue