flutter 2 listview on one page,

28 views Asked by At

I have two listviews on the screen, but they do not move together. My timeline post widget slides from half of the screen, but I want it to slide as a single screen like Instagram, how can I do it?

Scaffold(
  appBar: const CustomHomeAppBar(),
  body: RefreshIndicator(
    onRefresh: () async {
      // await _refreshTimeline();
    },
    child: Column(
      children: [
        SizedBox(
          height: 150,
          child: Consumer<TimelineProvider>(
            builder: (context, value, child) {
              var self = value.storyModel.selfStories;
              var other = value.storyModel.otherStories;

              return isLoading
                  ? ListView.builder(
                      scrollDirection: Axis.horizontal,
                      itemCount: 10,
                      itemBuilder: (context, index) =>
                          const ShimmerBubbleStories(),
                    )
                  : other?.length == 0
                      ? Text(
                          'There is no story',
                          style: bodyMidWhiteBold,
                        )
                      : ListView.builder(
                          controller: scrollController,
                          scrollDirection: Axis.horizontal,
                          itemCount: other?.length,
                          itemBuilder: (context, index) {
                            print(other?.length);
                            var otherUser = other![index];
                            var profileImageKey = value.storyModel
                                .otherStories![index].profileImageKey;
                            // print(otherUser.stories?[index].content?.video
                            //     ?.thumbnailKey);
                            return BubbleStories(
                              thumbnailKey: (otherUser.stories![0].content
                                      ?.video?.thumbnailKey ??
                                  otherUser.stories![0].content?.image
                                      ?.thumbnailKey ??
                                  ""),
                              index: index,
                              story: otherUser,
                              profilePhotoUrl: profileImageKey ?? "",
                              text: other[index].username ?? "",
                              // borderColor: borderColorList[index % 3],
                            );
                          },
                        );
            },
          ),
        ),
        Divider(
          color: ColorConstant.whiteColor.withOpacity(0.1),
          thickness: 1,
        ),
        const SizedBox(
          height: 10,
        ),
        Expanded(
          child: Consumer<PostProvider>(
            builder: (context, value, child) {
              return PagedListView<int, Datum>(
                  scrollController: scrollController,
                  pagingController: _pagingController,
                  builderDelegate: PagedChildBuilderDelegate<Datum>(
                    newPageErrorIndicatorBuilder: (conwtext) =>
                        const CircularProgressIndicator(),
                    newPageProgressIndicatorBuilder: (context) =>
                        const CircularProgressIndicator(),
                    firstPageProgressIndicatorBuilder: (context) =>
                        const ShimmerUserPost(
                      isCurrentUser: true,
                    ),
                    itemBuilder: (context, item, index) {
                      // List<String> itemList = [];
                      var itemCount = item.images?.length ?? 0;
                      List<String> itemList = List.generate(
                        itemCount,
                        (index) => item.images != null
                            ? item.images![index].key ?? ""
                            : "",
                      );

                      return TimelinePost(
                        index: index,
                        postLikeId: item.postLikeId,
                        isLikedByYou: item.is_liked_by_you,
                        onTap: () {
                          value.setSelectedPostId(
                              postId: item.id ?? "123123123");
                        },
                        commentCount: item.comment_count,
                        hasComment: true,
                        username: item.postOwner ?? "",
                        isCurrentUser: false,
                        postUrl: itemList,
                        profilePhotoUrl: item.postOwner ?? "",
                        postDescription: item.description ?? "",
                        likeCount: item.post_like_count,
                        postId: item.id,
                      );
                    },
                  ));
            },
          ),
        )
      ],
    ),
  ),
);
0

There are 0 answers