Skip to content
Snippets Groups Projects

settingsScreen.kt

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by a6-alrashdi
    Edited
    settingsScreen.kt 3.74 KiB
    package com.example.match
    import android.annotation.SuppressLint
    import androidx.compose.foundation.background
    import androidx.compose.foundation.layout.*
    import androidx.compose.foundation.text.BasicText
    import androidx.compose.material.*
    import androidx.compose.material3.ExperimentalMaterial3Api
    import androidx.compose.material3.IconButton
    import androidx.compose.material3.Scaffold
    import androidx.compose.material3.Switch
    import androidx.compose.material3.Text
    import androidx.compose.material3.TopAppBar
    import androidx.compose.runtime.*
    import androidx.compose.ui.Alignment
    import androidx.compose.ui.Modifier
    import androidx.compose.ui.graphics.Color
    import androidx.compose.ui.text.font.FontWeight
    import androidx.compose.ui.text.style.TextAlign
    import androidx.compose.ui.unit.dp
    import androidx.compose.ui.unit.sp
    import androidx.compose.material.icons.Icons
    import androidx.compose.material.icons.filled.*
    import androidx.compose.material3.Icon
    import com.example.match.ui.common.AppHeader
    
    @SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
    @Composable
    fun SettingsScreen(onClose: () -> Unit) {
        Scaffold(
            topBar = {
                // Reuse the AppHeader with the back button (cross icon)
                AppHeader(
                    title = "Settings",
                    onBackClick = { onClose() } // Pass back button action (onClose to go back)
                )
            }
        ) { paddingValues ->
            // Use paddingValues to ensure content is not hidden behind the header
            Column(
                modifier = Modifier
                    .fillMaxSize()
                    .padding(paddingValues) // Add padding from Scaffold's content area
            ) {
                // App Preferences
                Text("App Preferences", fontSize = 18.sp, fontWeight = FontWeight.Bold)
                Row(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(vertical = 8.dp),
                    horizontalArrangement = Arrangement.SpaceBetween,
                    verticalAlignment = Alignment.CenterVertically
                ) {
                    Text("Notifications")
                    Switch(checked = false, onCheckedChange = { /* Handle toggle */ })
                }
    
                Spacer(modifier = Modifier.height(16.dp))
    
                // About App
                Text("About App", fontSize = 18.sp, fontWeight = FontWeight.Bold)
                Column(modifier = Modifier.padding(vertical = 8.dp)) {
                    Row(
                        modifier = Modifier.fillMaxWidth(),
                        horizontalArrangement = Arrangement.SpaceBetween
                    ) {
                        Text("Terms of Service")
                        IconButton(onClick = { /* Handle action */ }) {
                            Icon(Icons.Default.Info, contentDescription = "Info")
                        }
                    }
                    Row(
                        modifier = Modifier.fillMaxWidth(),
                        horizontalArrangement = Arrangement.SpaceBetween
                    ) {
                        Text("Privacy Policy")
                        IconButton(onClick = { /* Handle action */ }) {
                            Icon(Icons.Default.Info, contentDescription = "Info")
                        }
                    }
                    Row(
                        modifier = Modifier.fillMaxWidth(),
                        horizontalArrangement = Arrangement.SpaceBetween
                    ) {
                        Text("Version Information")
                        Text("Version 1.0.0")
                    }
                }
    
                Spacer(modifier = Modifier.height(16.dp))
    
                // Support
                Text("Support", fontSize = 18.sp, fontWeight = FontWeight.Bold)
                Text("Contact Support: APP@SUPPORT.COM")
            }
        }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment