From 5feae5f546415c8fc1965aea498bab7d0fee4e84 Mon Sep 17 00:00:00 2001 From: Harsh Bhikadia Date: Sun, 31 May 2020 01:46:55 +0530 Subject: [PATCH 01/10] - subHeader, subHeaderAlwaysActive - added to BackdropScaffold - BackdropSubHeader - widget added --- example/lib/main.dart | 3 + lib/backdrop.dart | 137 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 125 insertions(+), 15 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 2fc7068..c80eab6 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -20,6 +20,9 @@ class MyApp extends StatelessWidget { backLayer: Center( child: Text("Back Layer"), ), + subHeader: BackdropSubHeader( + title: Text("Sub Header"), + ), frontLayer: Center( child: Text("Front Layer"), ), diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 9dc9a89..74f87c0 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -82,6 +82,12 @@ class BackdropScaffold extends StatefulWidget { /// The widget that is shown on the front layer . final Widget frontLayer; + /// The widget that is shown as sub-header in front layer + final Widget subHeader; + + /// This boolean flag keeps subHeader active when [backLayer] is visible + final bool subHeaderAlwaysActive; + /// Deprecated. Use [BackdropAppBar.actions]. /// /// Actions passed to [AppBar.actions]. @@ -98,7 +104,8 @@ class BackdropScaffold extends StatefulWidget { /// part, when being opened. The back layer's height corresponds to /// [BoxConstraints.biggest.height]-[headerHeight]. /// - /// Defaults to 32.0. + /// + /// if [subHeader] is defined then height of subHeader otherwise defaults to 32.0. final double headerHeight; /// Defines the [BorderRadius] applied to the front layer. @@ -149,12 +156,12 @@ class BackdropScaffold extends StatefulWidget { final Widget floatingActionButton; /// [FloatingActionButtonLocation] for the [FloatingActionButton] in the [Scaffold] - /// + /// /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonLocation] final FloatingActionButtonLocation floatingActionButtonLocation; /// [FloatingActionButtonAnimator] for the [FloatingActionButton] in the [Scaffold] - /// + /// /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonAnimator] final FloatingActionButtonAnimator floatingActionButtonAnimator; @@ -173,10 +180,12 @@ class BackdropScaffold extends StatefulWidget { this.appBar, this.backLayer, this.frontLayer, + this.subHeader, + this.subHeaderAlwaysActive = true, @Deprecated("Replace by use of BackdropAppBar. See BackdropAppBar.actions." "This feature was deprecated after v0.2.17.") this.actions = const [], - this.headerHeight = 32.0, + this.headerHeight, this.frontLayerBorderRadius = const BorderRadius.only( topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0), @@ -192,7 +201,7 @@ class BackdropScaffold extends StatefulWidget { this.floatingActionButton, this.inactiveOverlayColor = const Color(0xFFEEEEEE), this.floatingActionButtonLocation, - this.floatingActionButtonAnimator + this.floatingActionButtonAnimator, }); @override @@ -204,8 +213,10 @@ class _BackdropScaffoldState extends State bool _shouldDisposeController = false; AnimationController _controller; final scaffoldKey = GlobalKey(); - GlobalKey _backLayerKey = GlobalKey(); + GlobalKey _backLayerKey = GlobalKey(debugLabel: "backdrop:backLayer"); double _backPanelHeight = 0; + GlobalKey _subHeaderKey = GlobalKey(debugLabel: "backdrop:subHeader"); + double _headerHeight = 0; AnimationController get controller => _controller; @@ -223,6 +234,7 @@ class _BackdropScaffoldState extends State WidgetsBinding.instance.addPostFrameCallback((_) { setState(() { _backPanelHeight = _getBackPanelHeight(); + _headerHeight = _getHeaderHeight(); }); }); } @@ -260,6 +272,20 @@ class _BackdropScaffoldState extends State if (isBackPanelVisible) controller.animateTo(1.0); } + double _getHeaderHeight() { + // if defined then use it + if (widget.headerHeight != null) return widget.headerHeight; + + // if no subHeader then 32.0 + if (widget.subHeader == null) return 32.0; + + // if subHeader then height of subHeader + return ((_subHeaderKey.currentContext?.findRenderObject() as RenderBox) + ?.size + ?.height) ?? + 32.0; + } + double _getBackPanelHeight() => ((_backLayerKey.currentContext?.findRenderObject() as RenderBox) ?.size @@ -271,14 +297,14 @@ class _BackdropScaffoldState extends State double backPanelHeight, frontPanelHeight; if (widget.stickyFrontLayer && - _backPanelHeight < constraints.biggest.height - widget.headerHeight) { + _backPanelHeight < constraints.biggest.height - _headerHeight) { // height is adapted to the height of the back panel backPanelHeight = _backPanelHeight; frontPanelHeight = -_backPanelHeight; } else { // height is set to fixed value defined in widget.headerHeight final height = constraints.biggest.height; - backPanelHeight = height - widget.headerHeight; + backPanelHeight = height - _headerHeight; frontPanelHeight = -backPanelHeight; } return RelativeRectTween( @@ -298,13 +324,20 @@ class _BackdropScaffoldState extends State child: GestureDetector( onTap: () => fling(), behavior: HitTestBehavior.opaque, - child: SizedBox.expand( - child: Container( - decoration: BoxDecoration( - borderRadius: widget.frontLayerBorderRadius, - color: widget.inactiveOverlayColor.withOpacity(0.7), + child: Column( + children: [ + widget.subHeader != null && widget.subHeaderAlwaysActive + ? Container(height: _headerHeight) + : Container(), + Expanded( + child: Container( + decoration: BoxDecoration( + borderRadius: widget.frontLayerBorderRadius, + color: widget.inactiveOverlayColor.withOpacity(0.7), + ), + ), ), - ), + ], ), ), ), @@ -335,7 +368,26 @@ class _BackdropScaffoldState extends State borderRadius: widget.frontLayerBorderRadius, child: Stack( children: [ - widget.frontLayer, + Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // subHeader + DefaultTextStyle( + key: _subHeaderKey, + style: Theme.of(context).textTheme.subtitle1, + child: widget.subHeader != null + ? Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, vertical: 12.0), + child: widget.subHeader, + ) + : Container(), + ), + // frontLayer + Flexible(child: widget.frontLayer), + ], + ), _buildInactiveLayer(context), ], ), @@ -631,6 +683,61 @@ class BackdropAppBar extends StatelessWidget implements PreferredSizeWidget { } } +class BackdropSubHeader extends StatelessWidget { + final Widget title; + final Widget divider; + final bool automaticallyImplyLeading; + final bool automaticallyImplyTrailing; + final Widget leading; + final Widget trailing; + + const BackdropSubHeader({ + Key key, + @required this.title, + this.divider, + this.automaticallyImplyLeading = false, + this.automaticallyImplyTrailing = true, + this.leading, + this.trailing, + }) : assert(title != null), + super(key: key); + + @override + Widget build(BuildContext context) { + Widget _buildAutomaticLeadingOrTrailing(BuildContext context) => + FadeTransition( + opacity: Tween(begin: 1.0, end: 0.0) + .animate(Backdrop.of(context).controller), + child: Icon(Icons.keyboard_arrow_up), + ); + + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + leading ?? + (automaticallyImplyLeading + ? _buildAutomaticLeadingOrTrailing(context) + : Container()), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 4.0), + child: title, + ), + ), + trailing ?? + (automaticallyImplyTrailing + ? _buildAutomaticLeadingOrTrailing(context) + : Container()), + ], + ), + divider ?? Divider(height: 4.0, indent: 16.0), + ], + ); + } +} + /// Implements the back layer to be used for navigation. /// /// This class can be used as a back layer for [BackdropScaffold]. It enables to From 06e4d34527e5a3d5533c1491bc5317f99fbdc1be Mon Sep 17 00:00:00 2001 From: Harsh Bhikadia Date: Sun, 31 May 2020 01:53:16 +0530 Subject: [PATCH 02/10] minor comment --- lib/backdrop.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 74f87c0..d9ee291 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -85,7 +85,7 @@ class BackdropScaffold extends StatefulWidget { /// The widget that is shown as sub-header in front layer final Widget subHeader; - /// This boolean flag keeps subHeader active when [backLayer] is visible + /// This boolean flag keeps subHeader active when [backLayer] is visible. Defaults to true. final bool subHeaderAlwaysActive; /// Deprecated. Use [BackdropAppBar.actions]. From 1c9758873f89ff4b08ad4800b61c5b0aa10d4775 Mon Sep 17 00:00:00 2001 From: Harsh Bhikadia Date: Sun, 31 May 2020 01:53:26 +0530 Subject: [PATCH 03/10] minor comment change --- lib/backdrop.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index d9ee291..26ba3a3 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -326,6 +326,7 @@ class _BackdropScaffoldState extends State behavior: HitTestBehavior.opaque, child: Column( children: [ + // if subHeaderAlwaysActive then do not apply inactiveOverlayColor for area with _headerHeight widget.subHeader != null && widget.subHeaderAlwaysActive ? Container(height: _headerHeight) : Container(), From 1ea949e62137263b00c1483c1081794584bf1d63 Mon Sep 17 00:00:00 2001 From: Felix Wielander Date: Mon, 1 Jun 2020 10:03:56 +0200 Subject: [PATCH 04/10] Small documentation corrections --- lib/backdrop.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 26ba3a3..497a772 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -152,17 +152,17 @@ class BackdropScaffold extends StatefulWidget { /// [FloatingActionButton] for the [Scaffold] /// - /// Defaults to `null` which leads the [Scaffold] without a [FloatingActionButton] + /// Defaults to `null` which leads the [Scaffold] without a [FloatingActionButton]. final Widget floatingActionButton; /// [FloatingActionButtonLocation] for the [FloatingActionButton] in the [Scaffold] /// - /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonLocation] + /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonLocation]. final FloatingActionButtonLocation floatingActionButtonLocation; /// [FloatingActionButtonAnimator] for the [FloatingActionButton] in the [Scaffold] /// - /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonAnimator] + /// Defaults to `null` which leads Scaffold to use the default [FloatingActionButtonAnimator]. final FloatingActionButtonAnimator floatingActionButtonAnimator; /// Defines the color for the inactive front layer. @@ -326,7 +326,7 @@ class _BackdropScaffoldState extends State behavior: HitTestBehavior.opaque, child: Column( children: [ - // if subHeaderAlwaysActive then do not apply inactiveOverlayColor for area with _headerHeight + // if subHeaderAlwaysActive then do not apply inactiveOverlayColor for area with _headerHeight widget.subHeader != null && widget.subHeaderAlwaysActive ? Container(height: _headerHeight) : Container(), From e5087701b5eff36f4db970e3a584683709606e5a Mon Sep 17 00:00:00 2001 From: Felix Wielander Date: Mon, 1 Jun 2020 10:16:23 +0200 Subject: [PATCH 05/10] Removed unnecessary border radius of inactive overlay container --- lib/backdrop.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 497a772..4f3e8eb 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -332,10 +332,7 @@ class _BackdropScaffoldState extends State : Container(), Expanded( child: Container( - decoration: BoxDecoration( - borderRadius: widget.frontLayerBorderRadius, - color: widget.inactiveOverlayColor.withOpacity(0.7), - ), + color: widget.inactiveOverlayColor.withOpacity(0.7), ), ), ], From 37d384888c7d50998b50cb769311dba8bb14e524 Mon Sep 17 00:00:00 2001 From: Felix Wielander Date: Mon, 1 Jun 2020 10:42:18 +0200 Subject: [PATCH 06/10] Documented BackdropSubHeader + corrected other docs parts --- lib/backdrop.dart | 170 +++++++++++++++++++++++++++++----------------- 1 file changed, 107 insertions(+), 63 deletions(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 4f3e8eb..913c91c 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -40,26 +40,26 @@ class Backdrop extends InheritedWidget { /// Usage example: /// ```dart /// Widget build(BuildContext context) { -// return MaterialApp( -// title: 'Backdrop Demo', -// home: BackdropScaffold( -// appBar: BackdropAppBar( -// title: Text("Backdrop Example"), -// actions: [ -// BackdropToggleButton( -// icon: AnimatedIcons.list_view, -// ) -// ], -// ), -// backLayer: Center( -// child: Text("Back Layer"), -// ), -// frontLayer: Center( -// child: Text("Front Layer"), -// ), -// ), -// ); -// } +/// return MaterialApp( +/// title: 'Backdrop Demo', +/// home: BackdropScaffold( +/// appBar: BackdropAppBar( +/// title: Text("Backdrop Example"), +/// actions: [ +/// BackdropToggleButton( +/// icon: AnimatedIcons.list_view, +/// ) +/// ], +/// ), +/// backLayer: Center( +/// child: Text("Back Layer"), +/// ), +/// frontLayer: Center( +/// child: Text("Front Layer"), +/// ), +/// ), +/// ); +/// } /// ``` /// /// See also: @@ -79,10 +79,10 @@ class BackdropScaffold extends StatefulWidget { /// Content that should be displayed on the back layer. final Widget backLayer; - /// The widget that is shown on the front layer . + /// The widget that is shown on the front layer. final Widget frontLayer; - /// The widget that is shown as sub-header in front layer + /// The widget that is shown as sub-header on top of the front layer. final Widget subHeader; /// This boolean flag keeps subHeader active when [backLayer] is visible. Defaults to true. @@ -528,21 +528,21 @@ enum BackdropIconPosition { /// Usage example: /// ```dart /// Widget build(BuildContext context) { -// return MaterialApp( -// title: 'Backdrop Demo', -// home: BackdropScaffold( -// appBar: BackdropAppBar( -// title: Text("Backdrop Example"), -// actions: [ -// BackdropToggleButton( -// icon: AnimatedIcons.list_view, -// ) -// ], -// ), -// ... -// ), -// ); -// } +/// return MaterialApp( +/// title: 'Backdrop Demo', +/// home: BackdropScaffold( +/// appBar: BackdropAppBar( +/// title: Text("Backdrop Example"), +/// actions: [ +/// BackdropToggleButton( +/// icon: AnimatedIcons.list_view, +/// ) +/// ], +/// ), +/// ... +/// ), +/// ); +/// } /// ``` /// /// See also: @@ -681,14 +681,58 @@ class BackdropAppBar extends StatelessWidget implements PreferredSizeWidget { } } +/// A wrapper for adding a sub-header to the used backdrop front layer(s). +/// This class can be passed to [BackdropScaffold] to specify the sub-header +/// that should be shown while the front layer is "inactive" (the back layer is +/// "showing"). +/// +/// Usage example: +/// ```dart +/// BackdropScaffold( +/// appBar: ..., +/// backLayer: ..., +/// subHeader: BackdropSubHeader( +/// title: Text("Sub Header"), +/// ), +/// frontLayer: ..., +/// ) +/// ``` class BackdropSubHeader extends StatelessWidget { + /// The primary content of the sub-header. final Widget title; + + /// The divider that should be shown at the bottom of the sub-header. final Widget divider; + + /// Flag indicating whether the leading widget for the sub-header should be + /// automatically determined by [BackdropSubHeader]. + /// + /// If set to `true`, a leading `Icon(Icons.keyboard_arrow_up)` is added to + /// the sub-header. + /// + /// Defaults to `false`. final bool automaticallyImplyLeading; + + /// Flag indicating whether the trailing widget for the sub-header should be + /// automatically determined by [BackdropSubHeader]. + /// + /// If set to `true`, a trailing `Icon(Icons.keyboard_arrow_up)` is added to + /// the sub-header. + /// + /// Defaults to `true`. final bool automaticallyImplyTrailing; + + /// Widget to be shown as leading element to the sub-header. If set, the value + /// of [automaticallyImplyLeading] is ignored. final Widget leading; + + /// Widget to be shown as trailing element to the sub-header. If set, the value + /// of [automaticallyImplyTrailing] is ignored. final Widget trailing; + /// Creates a [BackdropSubHeader] instance. + /// + /// The [title] argument must not be `null`. const BackdropSubHeader({ Key key, @required this.title, @@ -744,33 +788,33 @@ class BackdropSubHeader extends StatelessWidget { /// Usage example: /// ```dart /// int _currentIndex = 0; -// final List _pages = [Widget1(), Widget2()]; +/// final List _pages = [Widget1(), Widget2()]; // -// @override -// Widget build(BuildContext context) { -// return MaterialApp( -// title: 'Backdrop Demo', -// home: BackdropScaffold( -// appBar: BackdropAppBar( -// title: Text("Navigation Example"), -// actions: [ -// BackdropToggleButton( -// icon: AnimatedIcons.list_view, -// ) -// ], -// ), -// stickyFrontLayer: true, -// frontLayer: _pages[_currentIndex], -// backLayer: BackdropNavigationBackLayer( -// items: [ -// ListTile(title: Text("Widget 1")), -// ListTile(title: Text("Widget 2")), -// ], -// onTap: (int position) => {setState(() => _currentIndex = position)}, -// ), -// ), -// ); -// } +/// @override +/// Widget build(BuildContext context) { +/// return MaterialApp( +/// title: 'Backdrop Demo', +/// home: BackdropScaffold( +/// appBar: BackdropAppBar( +/// title: Text("Navigation Example"), +/// actions: [ +/// BackdropToggleButton( +/// icon: AnimatedIcons.list_view, +/// ) +/// ], +/// ), +/// stickyFrontLayer: true, +/// frontLayer: _pages[_currentIndex], +/// backLayer: BackdropNavigationBackLayer( +/// items: [ +/// ListTile(title: Text("Widget 1")), +/// ListTile(title: Text("Widget 2")), +/// ], +/// onTap: (int position) => {setState(() => _currentIndex = position)}, +/// ), +/// ), +/// ); +/// } /// ``` class BackdropNavigationBackLayer extends StatelessWidget { /// The items to be inserted into the underlying [ListView] of the From ee71766afee71a9ebef827b75cabd3706a7db361 Mon Sep 17 00:00:00 2001 From: Felix Wielander Date: Mon, 1 Jun 2020 10:56:03 +0200 Subject: [PATCH 07/10] Small docs correction --- lib/backdrop.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 913c91c..7093498 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -105,7 +105,7 @@ class BackdropScaffold extends StatefulWidget { /// [BoxConstraints.biggest.height]-[headerHeight]. /// /// - /// if [subHeader] is defined then height of subHeader otherwise defaults to 32.0. + /// If [subHeader] is defined then height of subHeader otherwise defaults to 32.0. final double headerHeight; /// Defines the [BorderRadius] applied to the front layer. From cbac6e930f7ee37f2e4f512d31d5b1fdb354a147 Mon Sep 17 00:00:00 2001 From: Harsh Bhikadia Date: Thu, 4 Jun 2020 16:07:20 +0530 Subject: [PATCH 08/10] [subHeader] removed default padding in `BackdropScaffoldState` and added to `BackdropSubHeader` also made it configurable. --- lib/backdrop.dart | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 7093498..68d4ddb 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -374,13 +374,7 @@ class _BackdropScaffoldState extends State DefaultTextStyle( key: _subHeaderKey, style: Theme.of(context).textTheme.subtitle1, - child: widget.subHeader != null - ? Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 12.0), - child: widget.subHeader, - ) - : Container(), + child: widget.subHeader ?? Container(), ), // frontLayer Flexible(child: widget.frontLayer), @@ -704,6 +698,11 @@ class BackdropSubHeader extends StatelessWidget { /// The divider that should be shown at the bottom of the sub-header. final Widget divider; + /// Padding that will be applied to the sub-header. + /// + /// Defaults to `EdgeInsets.all(16.0)`. + final EdgeInsets padding; + /// Flag indicating whether the leading widget for the sub-header should be /// automatically determined by [BackdropSubHeader]. /// @@ -737,6 +736,7 @@ class BackdropSubHeader extends StatelessWidget { Key key, @required this.title, this.divider, + this.padding = const EdgeInsets.all(16.0), this.automaticallyImplyLeading = false, this.automaticallyImplyTrailing = true, this.leading, @@ -753,29 +753,29 @@ class BackdropSubHeader extends StatelessWidget { child: Icon(Icons.keyboard_arrow_up), ); - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - children: [ - leading ?? - (automaticallyImplyLeading - ? _buildAutomaticLeadingOrTrailing(context) - : Container()), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0), + return Padding( + padding: padding, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + leading ?? + (automaticallyImplyLeading + ? _buildAutomaticLeadingOrTrailing(context) + : Container()), + Expanded( child: title, ), - ), - trailing ?? - (automaticallyImplyTrailing - ? _buildAutomaticLeadingOrTrailing(context) - : Container()), - ], - ), - divider ?? Divider(height: 4.0, indent: 16.0), - ], + trailing ?? + (automaticallyImplyTrailing + ? _buildAutomaticLeadingOrTrailing(context) + : Container()), + ], + ), + divider ?? Divider(height: 4.0, indent: 16.0), + ], + ), ); } } From 7d7929f4c628a73a8d75775fddb2e307448ca995 Mon Sep 17 00:00:00 2001 From: Harsh Bhikadia Date: Thu, 4 Jun 2020 16:12:20 +0530 Subject: [PATCH 09/10] [BackdropSubHeader] `divider` outside `Padding` --- lib/backdrop.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 68d4ddb..6f944c7 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -753,12 +753,12 @@ class BackdropSubHeader extends StatelessWidget { child: Icon(Icons.keyboard_arrow_up), ); - return Padding( - padding: padding, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: padding, + child: Row( children: [ leading ?? (automaticallyImplyLeading @@ -773,9 +773,9 @@ class BackdropSubHeader extends StatelessWidget { : Container()), ], ), - divider ?? Divider(height: 4.0, indent: 16.0), - ], - ), + ), + divider ?? Divider(height: 4.0, indent: 16.0), + ], ); } } From 1bab9213204a34618bfd0707704468d646458c69 Mon Sep 17 00:00:00 2001 From: Harsh Bhikadia Date: Fri, 5 Jun 2020 13:49:41 +0530 Subject: [PATCH 10/10] - [BackdropSubHeader] padding defaults to `EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0)` - [BackdropSubHeader] set `endIndent` to 16.0 for default `divider` --- lib/backdrop.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/backdrop.dart b/lib/backdrop.dart index 3b2465f..cbe5097 100644 --- a/lib/backdrop.dart +++ b/lib/backdrop.dart @@ -724,11 +724,13 @@ class BackdropSubHeader extends StatelessWidget { final Widget title; /// The divider that should be shown at the bottom of the sub-header. + /// + /// Defaults to `Divider(height: 4.0, indent: 16.0, endIndent: 16.0)`. final Widget divider; /// Padding that will be applied to the sub-header. /// - /// Defaults to `EdgeInsets.all(16.0)`. + /// Defaults to `EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0)`. final EdgeInsets padding; /// Flag indicating whether the leading widget for the sub-header should be @@ -764,7 +766,7 @@ class BackdropSubHeader extends StatelessWidget { Key key, @required this.title, this.divider, - this.padding = const EdgeInsets.all(16.0), + this.padding = const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0), this.automaticallyImplyLeading = false, this.automaticallyImplyTrailing = true, this.leading, @@ -802,7 +804,7 @@ class BackdropSubHeader extends StatelessWidget { ], ), ), - divider ?? Divider(height: 4.0, indent: 16.0), + divider ?? const Divider(height: 4.0, indent: 16.0, endIndent: 16.0), ], ); } @@ -817,7 +819,7 @@ class BackdropSubHeader extends StatelessWidget { /// ```dart /// int _currentIndex = 0; /// final List _pages = [Widget1(), Widget2()]; -// +/// /// @override /// Widget build(BuildContext context) { /// return MaterialApp(