Skip to content

Instantly share code, notes, and snippets.

View anitaa1990's full-sized avatar
🎯
Focusing

Anitaa Murthy anitaa1990

🎯
Focusing
  • Chennai
View GitHub Profile
// Inside my app/build.gradle.kts
dependencies {
// Google Maps
implementation(libs.google.maps.compose)
}
[versions]
googleMapsCompose = "6.5.2"
[libraries]
## Google Maps Compose: simplifies the integration of Google Maps into Jetpack Compose by providing
## composable functions that wrap the Maps SDK
google-maps-compose = { group = "com.google.maps.android", name = "maps-compose", version.ref = "googleMapsCompose" }
/**
*
* This composable creates a custom, swipeable button that resembles a "slide to book" interaction.
* It is composed of two main parts:
* - The outer track (the full-width button background) which displays the label.
* - The inner slider thumb, which can be dragged from left to right.
*
*
* @param btnText Text to display on the outer button track (e.g., "Book Ride ₹199")
* @param btnTextStyle Text style for the button label (e.g., font weight, color)
@Composable
fun SlideToBookButton(
btnText: String,
btnTextStyle: TextStyle,
outerBtnBackgroundColor: Color,
sliderBtnBackgroundColor: Color,
@DrawableRes sliderBtnIcon: Int,
onBtnSwipe: () -> Unit
) {
// Slider button width
@Composable
fun SlideToBookButton(
btnText: String,
btnTextStyle: TextStyle,
outerBtnBackgroundColor: Color,
sliderBtnBackgroundColor: Color,
@DrawableRes sliderBtnIcon: Int,
onBtnSwipe: () -> Unit
) {
// Slider button width
@Composable
fun SlideToBookButton(
btnText: String,
btnTextStyle: TextStyle,
outerBtnBackgroundColor: Color,
sliderBtnBackgroundColor: Color,
@DrawableRes sliderBtnIcon: Int,
onBtnSwipe: () -> Unit
) {
// Slider button width
@Composable
fun SlideToBookButton(
btnText: String, // The text label shown on the button (e.g., "Book Ride ₹199")
btnTextStyle: TextStyle, // The style for the button text (font, weight, size, etc.)
outerBtnBackgroundColor: Color, // Background color for the outer track (entire button)
sliderBtnBackgroundColor: Color, // Background color for the draggable thumb
@DrawableRes sliderBtnIcon: Int, // Icon to show inside the draggable thumb
onBtnSwipe: () -> Unit // Callback triggered when swipe is completed
)
/**
*
* This composable creates a custom, swipeable button that resembles a "slide to book" interaction.
* It is composed of two main parts:
* - The outer track (the full-width button background) which displays the label.
* - The inner slider thumb, which can be dragged from left to right.
*
*
* @param btnText Text to display on the outer button track (e.g., "Book Ride ₹199")
* @param btnTextStyle Text style for the button label (e.g., font weight, color)
/**
* A composable function that displays the main notes screen in the app.
* This screen dynamically updates its content based on the UI state provided by the ViewModel.
*
* @param viewModel The ViewModel that provides the state and handles user interactions.
*/
@Composable
fun NotesScreen(
viewModel: NoteViewModel
) {
/**
* The main composable function for setting up the app's UI structure.
* It defines the scaffold layout, navigation, and other top-level elements for the app.
*
* @param navController The navigation controller for managing app navigation.
* @param snackbarHostState The state for displaying snackbars in the app.
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MainApp(