Skip to content

In second Scaffold in an Overlay, the AppBar does not response to gesture #175062

@PurplePolyhedron

Description

@PurplePolyhedron

Steps to reproduce

This bug only appears on iOS, or on Android with ThemeData(platform: TargetPlatform.iOS).

If we push a second Scaffold of a smaller size to the overlay, with primary set to false.
The visual is correct, but the AppBar does not response to any gesture, buttons cannot be used.

Expected results

Second Scaffold should work as normal.

Actual results

The AppBar of the scaffold does not accept touch.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(OverlayApp());
}

class OverlayApp extends StatelessWidget {
  const OverlayApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(platform: TargetPlatform.macOS),
      home: Scaffold(
        appBar: AppBar(title: const Text('Example')),
        body: SizedBox.expand(),
        floatingActionButton: Builder(
          builder: (context) {
            return FloatingActionButton(
              onPressed: () {
                OverlayEntry? entry = OverlayEntry(
                  builder: (BuildContext context) {
                    return Center(
                      child: SizedBox(
                        width: 300,
                        height: 500,
                        child: DecoratedBox(
                          position: DecorationPosition.foreground,
                          decoration: BoxDecoration(
                            border: Border.all(color: Colors.black, width: 2),
                            borderRadius: BorderRadius.circular(8),
                          ),
                          child: Scaffold2(),
                        ),
                      ),
                    );
                  },
                );
                Overlay.of(context).insert(entry);
              },
              child: const Icon(Icons.add),
            );
          },
        ),
      ),
    );
  }
}

class Scaffold2 extends StatelessWidget {
  const Scaffold2({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      primary: false,
      appBar: AppBar(
        title: const Text('Title'),
        backgroundColor: Colors.green.withValues(alpha: 0.5),
        primary: false,
        actions: <Widget>[
          IconButton(
            onPressed: () {
              ScaffoldMessenger.of(context).showSnackBar(
                const SnackBar(content: Text('This is a snackbar')),
              );
            },
            icon: Icon(Icons.info),
          ),
        ],
      ),
      body: SizedBox.expand(),
    );
  }
}

Flutter Doctor output

Doctor output
 Flutter (Channel main, 3.36.0-1.0.pre-450, on macOS 15.6.1 24G90 darwin-arm64, locale en-AU)
 [✓] Flutter (Channel stable, 3.35.1, on macOS 15.6.1 24G90 darwin-arm64, locale en-AU)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: parityWorks on one platform but not anotherf: gesturesflutter/packages/flutter/gestures repository.f: material designflutter/packages/flutter/material repository.found in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions