Commit e1ebc41a authored by Dragoș Tiselice's avatar Dragoș Tiselice Committed by GitHub

Material fixes (#5293)

* Added return value to a onNotification callback.

The LayoutChangedNotification callback was missing a return value.
This commit changes it to return true and stop notification from
bubbling up the tree.

* Changed _RenderInkFeatures to use fresh clip box.

Since it wasn't using the most current value of the RenderBox's
size, _RenderInkFeatures was rendering splashes incorrectly when
the underlying Material size was animating. This commit changes
the clip reference to use the size of the Renderbox instead of
the size method in order to get the newest value.
parent 6cd90028
......@@ -246,6 +246,7 @@ class _MaterialState extends State<Material> {
contents = new NotificationListener<LayoutChangedNotification>(
onNotification: (LayoutChangedNotification notification) {
_inkFeatureRenderer.currentContext.findRenderObject().markNeedsPaint();
return true;
},
child: new _InkFeatures(
key: _inkFeatureRenderer,
......@@ -320,7 +321,7 @@ class _RenderInkFeatures extends RenderProxyBox implements MaterialInkController
clipCallback = rectCallback;
} else {
size = referenceBox.size;
clipCallback = () => Point.origin & size;
clipCallback = () => Point.origin & referenceBox.size;
}
radius = _getSplashTargetSize(size, position);
} else {
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
class NotifyMaterial extends StatelessWidget {
@override
Widget build(BuildContext context) {
new LayoutChangedNotification().dispatch(context);
return new Container();
}
}
void main() {
testWidgets('LayoutChangedNotificaion test', (WidgetTester tester) async {
await tester.pumpWidget(
new Material(
child: new NotifyMaterial()
)
);
});
}
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