♿ Adjust explore categorized mode
This commit is contained in:
parent
857f3cc832
commit
d62ed4c375
@ -91,8 +91,12 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
_showCategories = !_showCategories;
|
_showCategories = !_showCategories;
|
||||||
if (_showCategories) {
|
if (_showCategories) {
|
||||||
_tabController = TabController(length: _categories.length, vsync: this);
|
_tabController = TabController(length: _categories.length, vsync: this);
|
||||||
|
_listKey.currentState?.setCategory(_categories[_tabController.index]);
|
||||||
|
_listKey.currentState?.refreshPosts();
|
||||||
} else {
|
} else {
|
||||||
_tabController = TabController(length: kPostChannels.length, vsync: this);
|
_tabController = TabController(length: kPostChannels.length, vsync: this);
|
||||||
|
_listKey.currentState?.setCategory(null);
|
||||||
|
_listKey.currentState?.refreshPosts();
|
||||||
}
|
}
|
||||||
_tabListen();
|
_tabListen();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -226,7 +230,7 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
icon: _listKey.currentState?.realm != null
|
icon: _listKey.currentState?.realm != null
|
||||||
? AccountImage(
|
? AccountImage(
|
||||||
content: _listKey.currentState!.realm!.avatar,
|
content: _listKey.currentState!.realm!.avatar,
|
||||||
radius: 14,
|
radius: 18,
|
||||||
)
|
)
|
||||||
: const Icon(Symbols.group),
|
: const Icon(Symbols.group),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -248,6 +252,24 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Symbols.category),
|
||||||
|
style: _showCategories
|
||||||
|
? ButtonStyle(
|
||||||
|
foregroundColor: WidgetStateProperty.all(
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
backgroundColor: MaterialStateProperty.all(
|
||||||
|
Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.secondaryContainer,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
onPressed: () {
|
||||||
|
_toggleShowCategories();
|
||||||
|
},
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text('screenExplore').tr(),
|
child: Text('screenExplore').tr(),
|
||||||
@ -258,22 +280,6 @@ class _ExploreScreenState extends State<ExploreScreen>
|
|||||||
floating: true,
|
floating: true,
|
||||||
snap: true,
|
snap: true,
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Symbols.category),
|
|
||||||
style: _showCategories
|
|
||||||
? ButtonStyle(
|
|
||||||
foregroundColor: WidgetStateProperty.all(
|
|
||||||
Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
backgroundColor: MaterialStateProperty.all(
|
|
||||||
Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
onPressed: () {
|
|
||||||
_toggleShowCategories();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Symbols.search),
|
icon: const Icon(Symbols.search),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user