@@ -1024,9 +1024,6 @@ enum _ActionLevel {
10241024
10251025/// Describes which layout will be used by [_MasterDetailFlow] .
10261026enum _LayoutMode {
1027- /// Use a nested or lateral layout depending on available screen width.
1028- auto,
1029-
10301027 /// Always use a lateral layout.
10311028 lateral,
10321029
@@ -1052,9 +1049,7 @@ class _MasterDetailFlow extends StatefulWidget {
10521049 const _MasterDetailFlow ({
10531050 required this .detailPageBuilder,
10541051 required this .masterViewBuilder,
1055- this .automaticallyImplyLeading = true , // ignore: unused_element
10561052 this .detailPageFABlessGutterWidth,
1057- this .displayMode = _LayoutMode .auto, // ignore: unused_element
10581053 this .title,
10591054 });
10601055
@@ -1080,14 +1075,6 @@ class _MasterDetailFlow extends StatefulWidget {
10801075 /// See [AppBar.title] .
10811076 final Widget ? title;
10821077
1083- /// Override the framework from determining whether to show a leading widget or not.
1084- ///
1085- /// See [AppBar.automaticallyImplyLeading] .
1086- final bool automaticallyImplyLeading;
1087-
1088- /// Forces display mode and style.
1089- final _LayoutMode displayMode;
1090-
10911078 @override
10921079 _MasterDetailFlowState createState () => _MasterDetailFlowState ();
10931080
@@ -1173,21 +1160,13 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp
11731160
11741161 @override
11751162 Widget build (BuildContext context) {
1176- switch (widget.displayMode) {
1177- case _LayoutMode .nested:
1178- return _nestedUI (context);
1179- case _LayoutMode .lateral:
1163+ return LayoutBuilder (builder: (BuildContext context, BoxConstraints constraints) {
1164+ final double availableWidth = constraints.maxWidth;
1165+ if (availableWidth >= _materialWideDisplayThreshold) {
11801166 return _lateralUI (context);
1181- case _LayoutMode .auto:
1182- return LayoutBuilder (builder: (BuildContext context, BoxConstraints constraints) {
1183- final double availableWidth = constraints.maxWidth;
1184- if (availableWidth >= _materialWideDisplayThreshold) {
1185- return _lateralUI (context);
1186- } else {
1187- return _nestedUI (context);
1188- }
1189- });
1190- }
1167+ }
1168+ return _nestedUI (context);
1169+ });
11911170 }
11921171
11931172 Widget _nestedUI (BuildContext context) {
@@ -1236,11 +1215,10 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp
12361215 builder: (BuildContext c) {
12371216 return BlockSemantics (
12381217 child: _MasterPage (
1239- leading: widget.automaticallyImplyLeading && Navigator .of (context).canPop ()
1218+ leading: Navigator .of (context).canPop ()
12401219 ? BackButton (onPressed: () { Navigator .of (context).pop (); })
12411220 : null ,
12421221 title: widget.title,
1243- automaticallyImplyLeading: widget.automaticallyImplyLeading,
12441222 masterViewBuilder: widget.masterViewBuilder,
12451223 ),
12461224 );
@@ -1266,7 +1244,6 @@ class _MasterDetailFlowState extends State<_MasterDetailFlow> implements _PageOp
12661244 _builtLayout = _LayoutMode .lateral;
12671245 return _MasterDetailScaffold (
12681246 actionBuilder: (_, __) => const < Widget > [],
1269- automaticallyImplyLeading: widget.automaticallyImplyLeading,
12701247 detailPageBuilder: (BuildContext context, Object ? args, ScrollController ? scrollController) =>
12711248 widget.detailPageBuilder (context, args ?? _cachedDetailArguments, scrollController),
12721249 detailPageFABlessGutterWidth: widget.detailPageFABlessGutterWidth,
@@ -1282,13 +1259,11 @@ class _MasterPage extends StatelessWidget {
12821259 this .leading,
12831260 this .title,
12841261 this .masterViewBuilder,
1285- required this .automaticallyImplyLeading,
12861262 });
12871263
12881264 final _MasterViewBuilder ? masterViewBuilder;
12891265 final Widget ? title;
12901266 final Widget ? leading;
1291- final bool automaticallyImplyLeading;
12921267
12931268 @override
12941269 Widget build (BuildContext context) {
@@ -1297,7 +1272,6 @@ class _MasterPage extends StatelessWidget {
12971272 title: title,
12981273 leading: leading,
12991274 actions: const < Widget > [],
1300- automaticallyImplyLeading: automaticallyImplyLeading,
13011275 ),
13021276 body: masterViewBuilder !(context, false ),
13031277 );
@@ -1317,7 +1291,6 @@ class _MasterDetailScaffold extends StatefulWidget {
13171291 this .actionBuilder,
13181292 this .initialArguments,
13191293 this .title,
1320- required this .automaticallyImplyLeading,
13211294 this .detailPageFABlessGutterWidth,
13221295 });
13231296
@@ -1332,7 +1305,6 @@ class _MasterDetailScaffold extends StatefulWidget {
13321305 final _ActionBuilder ? actionBuilder;
13331306 final Object ? initialArguments;
13341307 final Widget ? title;
1335- final bool automaticallyImplyLeading;
13361308 final double ? detailPageFABlessGutterWidth;
13371309
13381310 @override
@@ -1384,7 +1356,6 @@ class _MasterDetailScaffoldState extends State<_MasterDetailScaffold>
13841356 appBar: AppBar (
13851357 title: widget.title,
13861358 actions: widget.actionBuilder !(context, _ActionLevel .top),
1387- automaticallyImplyLeading: widget.automaticallyImplyLeading,
13881359 bottom: PreferredSize (
13891360 preferredSize: const Size .fromHeight (kToolbarHeight),
13901361 child: Row (
@@ -1458,7 +1429,6 @@ class _MasterDetailScaffoldState extends State<_MasterDetailScaffold>
14581429 appBar: AppBar (
14591430 title: widget.title,
14601431 actions: widget.actionBuilder !(context, _ActionLevel .top),
1461- automaticallyImplyLeading: widget.automaticallyImplyLeading,
14621432 ),
14631433 body: widget.masterViewBuilder (context, true ),
14641434 )
0 commit comments