Unverified Commit 0db47bdd authored by Casey Hillers's avatar Casey Hillers Committed by GitHub

Revert "Fix BottomAppBar & BottomSheet M3 shadow (#119819)" (#120492)

This reverts commit 0a97ef85.
parent 0346f4b1
......@@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'bottom_app_bar_theme.dart';
import 'colors.dart';
import 'elevation_overlay.dart';
import 'material.dart';
import 'scaffold.dart';
......@@ -178,7 +177,6 @@ class _BottomAppBarState extends State<BottomAppBar> {
final Color color = widget.color ?? babTheme.color ?? defaults.color!;
final Color surfaceTintColor = widget.surfaceTintColor ?? babTheme.surfaceTintColor ?? defaults.surfaceTintColor!;
final Color effectiveColor = isMaterial3 ? color : ElevationOverlay.applyOverlay(context, color, elevation);
final Color? shadowColor = isMaterial3 ? Colors.transparent : null;
final Widget child = Padding(
padding: widget.padding ?? babTheme.padding ?? (isMaterial3 ? const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0) : EdgeInsets.zero),
......@@ -189,16 +187,15 @@ class _BottomAppBarState extends State<BottomAppBar> {
height: height,
child: PhysicalShape(
clipper: clipper,
elevation: elevation,
color: effectiveColor,
clipBehavior: widget.clipBehavior,
elevation: isMaterial3 ? 0 : elevation,
child: Material(
key: materialKey,
type: isMaterial3 ? MaterialType.canvas : MaterialType.transparency,
elevation: elevation,
color: isMaterial3 ? effectiveColor : null,
surfaceTintColor: surfaceTintColor,
shadowColor: shadowColor,
child: SafeArea(child: child),
),
),
......
......@@ -270,16 +270,14 @@ class _BottomSheetState extends State<BottomSheet> {
@override
Widget build(BuildContext context) {
final bool useMaterial3 = Theme.of(context).useMaterial3;
final BottomSheetThemeData bottomSheetTheme = Theme.of(context).bottomSheetTheme;
final BottomSheetThemeData defaults = useMaterial3 ? _BottomSheetDefaultsM3(context) : const BottomSheetThemeData();
final BottomSheetThemeData defaults = Theme.of(context).useMaterial3 ? _BottomSheetDefaultsM3(context) : const BottomSheetThemeData();
final BoxConstraints? constraints = widget.constraints ?? bottomSheetTheme.constraints;
final Color? color = widget.backgroundColor ?? bottomSheetTheme.backgroundColor ?? defaults.backgroundColor;
final Color? surfaceTintColor = bottomSheetTheme.surfaceTintColor ?? defaults.surfaceTintColor;
final double elevation = widget.elevation ?? bottomSheetTheme.elevation ?? defaults.elevation ?? 0;
final ShapeBorder? shape = widget.shape ?? bottomSheetTheme.shape ?? defaults.shape;
final Clip clipBehavior = widget.clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none;
final Color? shadowColor = useMaterial3 ? Colors.transparent : null;
Widget bottomSheet = Material(
key: _childKey,
......@@ -288,7 +286,6 @@ class _BottomSheetState extends State<BottomSheet> {
surfaceTintColor: surfaceTintColor,
shape: shape,
clipBehavior: clipBehavior,
shadowColor: shadowColor,
child: NotificationListener<DraggableScrollableNotification>(
onNotification: extentChanged,
child: widget.builder(context),
......
......@@ -233,27 +233,6 @@ void main() {
expect(material.color, const Color(0xff0000ff));
});
testWidgets('Shadow color is transparent in Material 3', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(useMaterial3: true,
),
home: const Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: null,
),
bottomNavigationBar: BottomAppBar(
color: Color(0xff0000ff),
),
),
)
);
final Material material = tester.widget(find.byType(Material).at(1));
expect(material.shadowColor, Colors.transparent); /* no value in Material 2. */
});
testWidgets('dark theme applies an elevation overlay color', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
......
......@@ -173,10 +173,10 @@ void main() {
home: const Scaffold(body: BottomAppBar()),
));
final Material material = tester.widget(find.byType(Material).at(1));
final PhysicalShape widget = _getBabRenderObject(tester);
expect(material.color, theme.colorScheme.surface);
expect(material.elevation, equals(3.0));
expect(widget.color, theme.colorScheme.surface);
expect(widget.elevation, equals(3.0));
});
testWidgets('BAB theme overrides surfaceTintColor - M3', (WidgetTester tester) async {
......
......@@ -841,7 +841,7 @@ void main() {
expect(modalBarrier.color, barrierColor);
});
testWidgets('BottomSheet uses fallback values in material 3',
testWidgets('BottomSheet uses fallback values in maretial3',
(WidgetTester tester) async {
const Color surfaceColor = Colors.pink;
const Color surfaceTintColor = Colors.blue;
......@@ -880,30 +880,6 @@ void main() {
expect(material.shape, defaultShape);
});
testWidgets('BottomSheet has transparent shadow in material3', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
theme: ThemeData(
useMaterial3: true,
),
home: Scaffold(
body: BottomSheet(
onClosing: () {},
builder: (BuildContext context) {
return Container();
},
),
),
));
final Material material = tester.widget<Material>(
find.descendant(
of: find.byType(BottomSheet),
matching: find.byType(Material),
),
);
expect(material.shadowColor, Colors.transparent);
});
testWidgets('modal BottomSheet with scrollController has semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment