Skip to content

Software Development at Program Tom LTD

Place for coding, programming, development and software in general.

Menu
  • Blog
  • PDF Booklets
  • Dev Utils & Content
  • Java Spring Boot Or Web Apps
  • English
    • български
    • English
    • Español
    • Português
    • हिन्दी
    • Русский
    • Deutsch
    • Français
    • Italiano
    • العربية
  • About Us
Menu
Flutter list item does not get scroll events in the parent list view

Flutter ScrollView – Action – when scrolls to the Bottom

Posted on November 21, 2025 by Toma Velev

In Flutter, the most common and reliable way to detect when the user has scrolled to the Bottom of a ScrollView (like ListView, GridView, or SingleChildScrollView) is by using a ScrollController and listening to its positions and attach your Action.

Here are the best approaches, from simplest to most recommended:

Method 1: Using ScrollController (Recommended)

import 'package:flutter/material.dart';

class ScrollToBottomExample extends StatefulWidget {
  @override
  _ScrollToBottomExampleState createState() => _ScrollToBottomExampleState();
}

class _ScrollToBottomExampleState extends State<ScrollToBottomExample> {
  final ScrollController _scrollController = ScrollController();
  bool _isAtBottom = false;

  @override
  void initState() {
    super.initState();

    _scrollController.addListener(() {
      // Check if we've reached the bottom
      if (_scrollController.position.pixels >=
          _scrollController.position.maxScrollExtent - 50) { // 50px tolerance
        if (!_isAtBottom) {
          setState(() {
            _isAtBottom = true;
          });
          _onReachedBottom();
        }
      } else {
        if (_isAtBottom) {
          setState(() {
            _isAtBottom = false;
          });
        }
      }
    });
  }

  void _onReachedBottom() {
    print("User scrolled to the bottom!");
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(content: Text("You've reached the bottom!")),
    );
    // Load more data, trigger animation, etc.
  }

  @override
  void dispose() {
    _scrollController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Scroll to Bottom Detection")),
      body: ListView.builder(
        controller: _scrollController,
        itemCount: 100,
        itemBuilder: (context, index) {
          return ListTile(title: Text("Item $index"));
        },
      ),
    );
  }
}

Method 2: For Pagination / “Load More” (Most Common Use Case)

_scrollController.addListener(() {
  if (_scrollController.position.pixels >=
      _scrollController.position.maxScrollExtent * 0.95) { // Trigger when 95% down
    if (!isLoading) {
      loadMoreData(); // Your pagination function
    }
  }
});

Method 3: Using NotificationListener (Alternative)

NotificationListener<ScrollNotification>(
  onNotification: (ScrollNotification notification) {
    if (notification is ScrollUpdateNotification) {
      if (notification.metrics.pixels >=
          notification.metrics.maxScrollExtent - 100) {
        print("Near bottom!");
      }
    }
    return false;
  },
  child: ListView.builder(...),
)

Bonus: Reverse ListView (Chat-style, newest at bottom)

If you’re building a chat where new messages appear at the bottom:

ListView.builder(
  controller: _scrollController,
  reverse: true, // Important!
  itemCount: messages.length,
  itemBuilder: ...,
)

// To detect when user scrolls up (away from bottom)
if (_scrollController.position.pixels < 
    _scrollController.position.maxScrollExtent - 200) {
  // User scrolled up
}

Summary – Best Practices

  • Always use ScrollController for reliable detection
  • Use a small threshold (e.g., -50 or -100) to trigger slightly before actual bottom
  • For pagination: trigger at ~90-95% scroll
  • Always dispose the controller
  • Works with ListView, GridView, CustomScrollView, etc.

This method works perfectly on both iOS and Android in Flutter as of 2025.

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)

Tags

Algorithms (9) crypto (29) flutterdev (39) General (86) Java (7) QR & Bar Codes (3) Software Dev Choices (33) Spring Boot (1) standards (1) Theme (3) User Authentication & Authorization (9) User Experience (10) Utilities (19) WordPress (11)

Product categories

  • All Technologies (87)
    • Flutter Apps (26)
    • GPT (4)
    • Java (39)
    • Native Android (3)
    • PHP (9)
    • Spring (Boot) / Quarkus (36)
    • Utils (15)
    • Vaadin 24+ (28)
    • Vaadin 8 (1)
  • Apps (18)
    • Employees DB (1)
    • Notes (6)
    • Personal Budget (1)
    • Recipes Book (1)
    • Stuff Organizer (1)
    • To-Do (2)
  • PDF Books (3)
  • Source Code Generators (8)

Recent Posts

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Post Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)