robert-luoqing/flutter_list_view

how to know current index visible in viewport(header)

Closed this issue · 1 comments

how to know current index visible in viewport(header)

You can get it by

  _stickyHeaderChanged() {
    print(
        "Sticky Header Change To: ${controller.sliverController.stickyIndex.value}");
  }

  _fetchStickHeader() async {
    await Future.delayed(const Duration(milliseconds: 100));
    print(
        "Sticky Header Change To: ${controller.sliverController.stickyIndex.value}");
  }

  @override
  void initState() {
    _loadCountry();
    controller.sliverController.stickyIndex.addListener(_stickyHeaderChanged);
    _fetchStickHeader();
    super.initState();
  }