Skip to content

Commit a144afd

Browse files
committed
moved Column inside of AnimatedPane
1 parent bf88324 commit a144afd

File tree

1 file changed

+38
-19
lines changed

1 file changed

+38
-19
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleListDetailPaneScaffold.kt

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -144,26 +144,26 @@ fun SampleNavigableListDetailPaneScaffoldFull() {
144144
}
145145
},
146146
detailPane = {
147-
Column {
148-
// Allow users to dismiss the detail pane. Use back navigation to
149-
// hide an expanded detail pane.
150-
if (scaffoldNavigator.scaffoldValue[ListDetailPaneScaffoldRole.Detail] == PaneAdaptedValue.Expanded) {
151-
// Material design principles promote the usage of a right-aligned
152-
// close (X) button.
153-
IconButton(
154-
modifier = Modifier.align(Alignment.End).padding(16.dp),
155-
onClick = {
156-
scope.launch {
157-
scaffoldNavigator.navigateBack(backNavigationBehavior)
147+
AnimatedPane {
148+
// Show the detail pane content if selected item is available
149+
scaffoldNavigator.currentDestination?.contentKey?.let {
150+
Column {
151+
// Allow users to dismiss the detail pane. Use back navigation to
152+
// hide an expanded detail pane.
153+
if (scaffoldNavigator.scaffoldValue[ListDetailPaneScaffoldRole.Detail] == PaneAdaptedValue.Expanded) {
154+
// Material design principles promote the usage of a right-aligned
155+
// close (X) button.
156+
IconButton(
157+
modifier = Modifier.align(Alignment.End).padding(16.dp),
158+
onClick = {
159+
scope.launch {
160+
scaffoldNavigator.navigateBack(backNavigationBehavior)
161+
}
162+
}
163+
) {
164+
Icon(Icons.Default.Close, contentDescription = "Close")
158165
}
159166
}
160-
) {
161-
Icon(Icons.Default.Close, contentDescription = "Close")
162-
}
163-
}
164-
AnimatedPane {
165-
// Show the detail pane content if selected item is available
166-
scaffoldNavigator.currentDestination?.contentKey?.let {
167167
MyDetails(it)
168168
}
169169
}
@@ -180,6 +180,7 @@ fun SampleListDetailPaneScaffoldWithPredictiveBackFull() {
180180
val scaffoldNavigator = rememberListDetailPaneScaffoldNavigator<MyItem>()
181181
val customScaffoldDirective = customPaneScaffoldDirective(currentWindowAdaptiveInfo())
182182
val scope = rememberCoroutineScope()
183+
val backNavigationBehavior = BackNavigationBehavior.PopUntilScaffoldValueChange
183184

184185
ThreePaneScaffoldPredictiveBackHandler(
185186
navigator = scaffoldNavigator,
@@ -208,7 +209,25 @@ fun SampleListDetailPaneScaffoldWithPredictiveBackFull() {
208209
AnimatedPane {
209210
// Show the detail pane content if selected item is available
210211
scaffoldNavigator.currentDestination?.contentKey?.let {
211-
MyDetails(it)
212+
Column {
213+
// Allow users to dismiss the detail pane. Use back navigation to
214+
// hide an expanded detail pane.
215+
if (scaffoldNavigator.scaffoldValue[ListDetailPaneScaffoldRole.Detail] == PaneAdaptedValue.Expanded) {
216+
// Material design principles promote the usage of a right-aligned
217+
// close (X) button.
218+
IconButton(
219+
modifier = Modifier.align(Alignment.End).padding(16.dp),
220+
onClick = {
221+
scope.launch {
222+
scaffoldNavigator.navigateBack(backNavigationBehavior)
223+
}
224+
}
225+
) {
226+
Icon(Icons.Default.Close, contentDescription = "Close")
227+
}
228+
}
229+
MyDetails(it)
230+
}
212231
}
213232
}
214233
},

0 commit comments

Comments
 (0)