forked from lofcoding/NewsApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from icanerdogan/release/1.0.2
Release/1.0.2
- Loading branch information
Showing
9 changed files
with
308 additions
and
81 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
app/src/main/java/com/canerdogan/jetnews/ui/screen/contact/ContactBottomDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package com.canerdogan.jetnews.ui.screen.contact | ||
|
||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Add | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.ExtendedFloatingActionButton | ||
import androidx.compose.material3.FloatingActionButton | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.ModalBottomSheet | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.rememberModalBottomSheetState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import kotlinx.coroutines.launch | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun ContactBottomDialog( | ||
onClick: (Boolean) -> Unit, | ||
isShowDialog: Boolean | ||
) { | ||
val sheetState = rememberModalBottomSheetState() | ||
val scope = rememberCoroutineScope() | ||
var showBottomSheet by remember { mutableStateOf(isShowDialog) } | ||
|
||
if (showBottomSheet) { | ||
ModalBottomSheet( | ||
onDismissRequest = { | ||
showBottomSheet = false | ||
}, | ||
sheetState = sheetState | ||
) { | ||
// Sheet content | ||
Button(onClick = { | ||
scope.launch { sheetState.hide() }.invokeOnCompletion { | ||
if (!sheetState.isVisible) { | ||
showBottomSheet = false | ||
} | ||
} | ||
}) { | ||
Text("Hide bottom sheet") | ||
} | ||
} | ||
} | ||
|
||
/* val sheetState = rememberModalBottomSheetState() | ||
val scope = rememberCoroutineScope() | ||
var showBottomSheet by remember { mutableStateOf(false) } | ||
Scaffold( | ||
floatingActionButton = { | ||
ExtendedFloatingActionButton( | ||
text = { Text("Show bottom sheet") }, | ||
icon = { Icon(Icons.Filled.Add, contentDescription = "") }, | ||
onClick = { | ||
showBottomSheet = true | ||
} | ||
) | ||
} | ||
) { contentPadding -> | ||
// Screen content | ||
if (showBottomSheet) { | ||
ModalBottomSheet( | ||
modifier = Modifier.padding(contentPadding), | ||
onDismissRequest = { | ||
showBottomSheet = false | ||
}, | ||
sheetState = sheetState | ||
) { | ||
// Sheet content | ||
Button(onClick = { | ||
scope.launch { sheetState.hide() }.invokeOnCompletion { | ||
if (!sheetState.isVisible) { | ||
showBottomSheet = false | ||
} | ||
} | ||
}) { | ||
Text("Hide bottom sheet") | ||
} | ||
} | ||
} | ||
}*/ | ||
|
||
} |
Oops, something went wrong.