Commit 6cc6e7e1 authored by lsaudon's avatar lsaudon Committed by Hans Muller

Add shapeBorder option on App Bar (#21834)

parent ec00e974
......@@ -150,6 +150,7 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
this.flexibleSpace,
this.bottom,
this.elevation,
this.shape,
this.backgroundColor,
this.brightness,
this.iconTheme,
......@@ -286,6 +287,12 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
/// for app bars.
final double elevation;
/// The material's shape as well its shadow.
///
/// A shadow is only displayed if the [elevation] is greater than
/// zero.
final ShapeBorder shape;
/// The color to use for the app bar's material. Typically this should be set
/// along with [brightness], [iconTheme], [textTheme].
///
......@@ -583,6 +590,7 @@ class _AppBarState extends State<AppBar> {
elevation: widget.elevation
?? appBarTheme.elevation
?? _defaultElevation,
shape: widget.shape,
child: Semantics(
explicitChildNodes: true,
child: appBar,
......
......@@ -1485,4 +1485,33 @@ void main() {
await gesture.up();
await tester.pump();
});
testWidgets('AppBar with shape', (WidgetTester tester) async {
const RoundedRectangleBorder roundedRectangleBorder = RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15.0)));
await tester.pumpWidget(
MaterialApp(
home: AppBar(
leading: const Text('L'),
title: const Text('No Scaffold'),
shape: roundedRectangleBorder,
actions: const <Widget>[Text('A1'), Text('A2')],
),
),
);
final Finder appBarFinder = find.byType(AppBar);
AppBar getAppBarWidget() {
return tester.widget<AppBar>(appBarFinder);
}
expect(getAppBarWidget().shape, roundedRectangleBorder);
final Finder materialFinder = find.byType(Material);
Material getMaterialWidget() {
return tester.widget<Material>(materialFinder);
}
expect(getMaterialWidget().shape, roundedRectangleBorder);
});
}
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