Skip to content

AppBar with reversed scrollable doesn't properly indicate scrolledUnder state #101416

@guidezpl

Description

@guidezpl

When AppBar overlaps a reversed scrollable, it incorrectly reports the initial state as not being scrolled under.

Repro:

import 'dart:math';

import 'package:flutter/material.dart';

void main() => runApp(const ScrolledUnder());

class ScrolledUnder extends StatelessWidget {
  const ScrolledUnder({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: MaterialStateColor.resolveWith((states) {
            if (states.contains(MaterialState.scrolledUnder)) {
              return Colors.red;
            }
            return Colors.blue;
          }),
          title: Text('reverse scrolled under'),
        ),
        body: ListView.builder(
          itemBuilder: (context, index) => Container(
            height: 200,
            color: Color((Random().nextDouble() * 0xFFFFFF).toInt())
                .withOpacity(1.0),
          ),
          reverse: true,
        ),
      ),
    );
  }
}

@Piinks would love your input, clues for how to fix this

Internal issue: b/226060628

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listcustomer: money (g3)f: material designflutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions