package com.acitelight.aether.view import android.widget.Toast import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Key import androidx.compose.material.icons.filled.Person import androidx.compose.material3.Button import androidx.compose.material3.Card import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import com.acitelight.aether.viewModel.MeScreenViewModel @Composable fun MeScreen(meScreenViewModel: MeScreenViewModel = viewModel()) { val context = LocalContext.current var username by meScreenViewModel.username; var privateKey by meScreenViewModel.privateKey; Column( modifier = Modifier .fillMaxSize() .padding(8.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Top ) { // Card component for a clean, contained UI block Card( modifier = Modifier .fillMaxWidth() .padding(8.dp) ) { Column( modifier = Modifier .padding(16.dp) .fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally ) { Text( text = "Account Setting", style = MaterialTheme.typography.headlineMedium, modifier = Modifier.padding(bottom = 16.dp).align(Alignment.Start) ) // Username input field OutlinedTextField( value = username, onValueChange = { username = it }, label = { Text("Username") }, leadingIcon = { Icon(Icons.Default.Person, contentDescription = "Username") }, singleLine = true, modifier = Modifier.fillMaxWidth() ) Spacer(modifier = Modifier.height(16.dp)) // Private key input field OutlinedTextField( value = privateKey, onValueChange = { privateKey = it }, label = { Text("Key") }, leadingIcon = { Icon(Icons.Default.Key, contentDescription = "Key") }, singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), modifier = Modifier.fillMaxWidth() ) Spacer(modifier = Modifier.height(24.dp)) // Save Button Button( onClick = { meScreenViewModel.updateAccount(username, privateKey); Toast.makeText(context, "Account updated", Toast.LENGTH_SHORT).show() }, modifier = Modifier.fillMaxWidth() ) { Text("Save") } } } } }