mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
Material.border type is now BorderRadiusGeometry (#27376)
This commit is contained in:
parent
cdddec7418
commit
d5b6480648
|
@ -257,14 +257,16 @@ class Material extends StatefulWidget {
|
|||
/// The default value is [kThemeChangeDuration].
|
||||
final Duration animationDuration;
|
||||
|
||||
/// If non-null, the corners of this box are rounded by this [BorderRadius].
|
||||
/// If non-null, the corners of this box are rounded by this
|
||||
/// [BorderRadiusGeometry] value.
|
||||
///
|
||||
/// Otherwise, the corners specified for the current [type] of material are
|
||||
/// used.
|
||||
///
|
||||
/// If [shape] is non null then the border radius is ignored.
|
||||
///
|
||||
/// Must be null if [type] is [MaterialType.circle].
|
||||
final BorderRadius borderRadius;
|
||||
final BorderRadiusGeometry borderRadius;
|
||||
|
||||
/// The ink controller from the closest instance of this class that
|
||||
/// encloses the given context.
|
||||
|
@ -292,7 +294,7 @@ class Material extends StatefulWidget {
|
|||
textStyle?.debugFillProperties(properties, prefix: 'textStyle.');
|
||||
properties.add(DiagnosticsProperty<ShapeBorder>('shape', shape, defaultValue: null));
|
||||
properties.add(DiagnosticsProperty<bool>('borderOnForeground', borderOnForeground, defaultValue: true));
|
||||
properties.add(EnumProperty<BorderRadius>('borderRadius', borderRadius, defaultValue: null));
|
||||
properties.add(DiagnosticsProperty<BorderRadiusGeometry>('borderRadius', borderRadius, defaultValue: null));
|
||||
}
|
||||
|
||||
/// The default radius of an ink splash in logical pixels.
|
||||
|
|
|
@ -56,6 +56,41 @@ class PaintRecorder extends CustomPainter {
|
|||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('default Material debugFillProperties', (WidgetTester tester) async {
|
||||
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
||||
const Material().debugFillProperties(builder);
|
||||
|
||||
final List<String> description = builder.properties
|
||||
.where((DiagnosticsNode node) => !node.isFiltered(DiagnosticLevel.info))
|
||||
.map((DiagnosticsNode node) => node.toString())
|
||||
.toList();
|
||||
|
||||
expect(description, <String>['type: canvas']);
|
||||
});
|
||||
|
||||
testWidgets('Material implements debugFillProperties', (WidgetTester tester) async {
|
||||
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
|
||||
const Material(
|
||||
type: MaterialType.canvas,
|
||||
color: Color(0xFFFFFFFF),
|
||||
textStyle: TextStyle(color: Color(0xff00ff00)),
|
||||
borderRadius: BorderRadiusDirectional.all(Radius.circular(10)),
|
||||
).debugFillProperties(builder);
|
||||
|
||||
final List<String> description = builder.properties
|
||||
.where((DiagnosticsNode node) => !node.isFiltered(DiagnosticLevel.info))
|
||||
.map((DiagnosticsNode node) => node.toString())
|
||||
.toList();
|
||||
|
||||
expect(description, <String>[
|
||||
'type: canvas',
|
||||
'color: Color(0xffffffff)',
|
||||
'textStyle.inherit: true',
|
||||
'textStyle.color: Color(0xff00ff00)',
|
||||
'borderRadius: BorderRadiusDirectional.circular(10.0)'
|
||||
]);
|
||||
});
|
||||
|
||||
testWidgets('LayoutChangedNotification test', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
Material(
|
||||
|
|
Loading…
Reference in a new issue