|
@@ -90,7 +90,11 @@ class CommunityPage extends HookConsumerWidget with WidgetsBindingObserver {
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
final vm = ref.read(communityVmProvider.notifier);
|
|
|
final state = ref.watch(communityVmProvider);
|
|
|
-
|
|
|
+ final newsIsCollection = useState<int?>(null);
|
|
|
+ final followIsCollection = useState<int?>(null);
|
|
|
+ final foryouIsCollection = useState<int?>(null);
|
|
|
+ final saleIsCollection = useState<int?>(null);
|
|
|
+ final rentIsCollection = useState<int?>(null);
|
|
|
useEffect(() {
|
|
|
// 监听窗口
|
|
|
WidgetsBinding.instance.addObserver(this);
|
|
@@ -117,33 +121,74 @@ class CommunityPage extends HookConsumerWidget with WidgetsBindingObserver {
|
|
|
},[]);
|
|
|
|
|
|
return Scaffold(
|
|
|
- appBar: MyAppBar.searchAppBar(
|
|
|
- context,
|
|
|
- value: vm.getCurrentQueryParams('keyword'),
|
|
|
- actions: [
|
|
|
- const MyAssetImage(
|
|
|
- Assets.communityLikeActive,
|
|
|
+ appBar: state.currentCategoryIdx == 0 ?MyAppBar.appBar(
|
|
|
+ context,
|
|
|
+ S.current.community,
|
|
|
+ backgroundColor: context.appColors.backgroundWhite,
|
|
|
+ actions: [
|
|
|
+ if(state.currentPageViewIdx == 0)
|
|
|
+ MyAssetImage(
|
|
|
+ newsIsCollection.value ==1? Assets.communityLikeActive : Assets.communityLike,
|
|
|
width: 21.5,
|
|
|
height: 21.5,
|
|
|
).onTap((){
|
|
|
- vm.handlerClickNavbarLikeBtn(context);
|
|
|
- }),
|
|
|
- SizedBox(width: state.currentCategoryIdx ==0 ? 15:20),
|
|
|
- state.currentCategoryIdx ==1 ?
|
|
|
- const MyAssetImage(
|
|
|
- Assets.communityFillterIcon,
|
|
|
- width: 21,
|
|
|
- height: 21,
|
|
|
- ).onTap((){
|
|
|
- vm.handlerClickNavbarFilterBtn(context);
|
|
|
- }) : const SizedBox.shrink(),
|
|
|
- const SizedBox(width: 15),
|
|
|
- ],
|
|
|
- backgroundColor: context.appColors.backgroundWhite,
|
|
|
- onSearch: (value) {
|
|
|
- vm.handlerSearch(value);
|
|
|
- }
|
|
|
- ),
|
|
|
+ newsIsCollection.value = newsIsCollection.value == 1 ? null:1;
|
|
|
+ vm.handlerClickNavbarLikeBtn(context, newsIsCollection.value);
|
|
|
+ }),
|
|
|
+ if(state.currentPageViewIdx == 1)
|
|
|
+ MyAssetImage(
|
|
|
+ followIsCollection.value ==1? Assets.communityLikeActive : Assets.communityLike,
|
|
|
+ width: 21.5,
|
|
|
+ height: 21.5,
|
|
|
+ ).onTap((){
|
|
|
+ followIsCollection.value = followIsCollection.value == 1 ? null:1;
|
|
|
+ vm.handlerClickNavbarLikeBtn(context, followIsCollection.value);
|
|
|
+ }),
|
|
|
+ if(state.currentPageViewIdx == 2)
|
|
|
+ MyAssetImage(
|
|
|
+ foryouIsCollection.value ==1? Assets.communityLikeActive : Assets.communityLike,
|
|
|
+ width: 21.5,
|
|
|
+ height: 21.5,
|
|
|
+ ).onTap((){
|
|
|
+ foryouIsCollection.value = foryouIsCollection.value == 1 ? null:1;
|
|
|
+ vm.handlerClickNavbarLikeBtn(context, foryouIsCollection.value);
|
|
|
+ }),
|
|
|
+ const SizedBox(width:15),
|
|
|
+ ],
|
|
|
+ ):MyAppBar.searchAppBar(
|
|
|
+ context,
|
|
|
+ value: vm.getCurrentQueryParams('keyword'),
|
|
|
+ actions: [
|
|
|
+ state.currentPageViewIdx == 3 ? MyAssetImage(
|
|
|
+ saleIsCollection.value ==1? Assets.communityLikeActive : Assets.communityLike,
|
|
|
+ width: 21.5,
|
|
|
+ height: 21.5,
|
|
|
+ ).onTap((){
|
|
|
+ saleIsCollection.value = saleIsCollection.value == 1 ? null:1;
|
|
|
+ vm.handlerClickNavbarLikeBtn(context, saleIsCollection.value);
|
|
|
+ }): MyAssetImage(
|
|
|
+ rentIsCollection.value ==1? Assets.communityLikeActive : Assets.communityLike,
|
|
|
+ width: 21.5,
|
|
|
+ height: 21.5,
|
|
|
+ ).onTap((){
|
|
|
+ rentIsCollection.value = rentIsCollection.value == 1 ? null:1;
|
|
|
+ vm.handlerClickNavbarLikeBtn(context, rentIsCollection.value);
|
|
|
+ }),
|
|
|
+ const SizedBox(width:15),
|
|
|
+ const MyAssetImage(
|
|
|
+ Assets.communityFillterIcon,
|
|
|
+ width: 21,
|
|
|
+ height: 21,
|
|
|
+ ).onTap((){
|
|
|
+ vm.handlerClickNavbarFilterBtn(context);
|
|
|
+ }),
|
|
|
+ SizedBox(width:15),
|
|
|
+ ],
|
|
|
+ backgroundColor: context.appColors.backgroundWhite,
|
|
|
+ onSearch: (value) {
|
|
|
+ vm.handlerSearch(value);
|
|
|
+ }
|
|
|
+ ),
|
|
|
backgroundColor: context.appColors.backgroundDefault,
|
|
|
body: ExtendedNestedScrollView(
|
|
|
key: extendedNestedScrollViewKey,
|