-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
customer: junecustomer: money (g3)f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 2.10Found to occur in 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13Found to occur in 2.13frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Internal: b/261125917
Steps to Reproduce
- Execute
flutter runon the code sample - Attempt to tap the button which is behind the transparent & unelevated AppBar
Expected results:
Button accepts tap
Actual results:
Button does not accept tap
Reason:
AppBar uses a Material widget (app_bar.dart line 1060) with an unspecified MaterialType, which defaults to MaterialType.canvas. Material widgets absorb touches unless the type is MaterialType.transparency.
Suggestion:
If the AppBar's elevation is zero and background color is transparent, then set the Material within the AppBar to type = MaterialType.transparency. This allows touches to pass through instead of being absorbed.
I will create a PR for this, but am open to any other strategies (e.g. an explicit parameter on AppBar).
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark(),
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
title: Text('I am an app bar'),
backgroundColor: Color(0x00000000),
elevation: 0,
),
body: Align(
alignment: Alignment.topCenter,
child: ElevatedButton(
onPressed: () => print('tap!'), child: Text('tap me'))),
),
);
}
}jithware
Metadata
Metadata
Assignees
Labels
customer: junecustomer: money (g3)f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 2.10Found to occur in 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13Found to occur in 2.13frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version