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> {
|
||||
bool _regularAlbumsExpanded = false, _tagsExpanded = false;
|
||||
bool _albumsExpanded = false, _tagsExpanded = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -130,20 +130,7 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
|||
}
|
||||
|
||||
final tags = source.sortedTags;
|
||||
|
||||
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: [
|
||||
final drawerItems = [
|
||||
header,
|
||||
gifEntry,
|
||||
videoEntry,
|
||||
|
@ -151,11 +138,7 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
|||
const Divider(),
|
||||
...specialAlbums.map(buildAlbumEntry),
|
||||
],
|
||||
if (appAlbums.isNotEmpty) ...[
|
||||
const Divider(),
|
||||
...appAlbums.map(buildAlbumEntry),
|
||||
],
|
||||
if (regularAlbums.isNotEmpty)
|
||||
if (appAlbums.isNotEmpty || regularAlbums.isNotEmpty)
|
||||
SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
|
@ -166,15 +149,19 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
|||
const Text('Albums'),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'${regularAlbums.length}',
|
||||
'${appAlbums.length + regularAlbums.length}',
|
||||
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),
|
||||
children: regularAlbums.map(buildAlbumEntry).toList(),
|
||||
onExpansionChanged: (expanded) => setState(() => _albumsExpanded = expanded),
|
||||
children: [
|
||||
...appAlbums.map(buildAlbumEntry),
|
||||
if (appAlbums.isNotEmpty && regularAlbums.isNotEmpty) const Divider(),
|
||||
...regularAlbums.map(buildAlbumEntry),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (tags.isNotEmpty)
|
||||
|
@ -199,7 +186,21 @@ class _AllCollectionDrawerState extends State<AllCollectionDrawer> {
|
|||
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