Starting to make changes. Alt+Enter not working properly on laptop though, so committing to work on a different one.

This commit is contained in:
Hyperling 2024-07-20 10:42:12 -07:00
parent f5b54f4b4a
commit dcca201a91

View File

@ -9,20 +9,30 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import com.hyperling.expensetracker.ui.theme.ExpenseTrackerTheme import com.hyperling.expensetracker.ui.theme.ExpenseTrackerTheme
import androidx.compose.ui.unit.sp
// Activity which allows data to be entered and saved to Shared Preferences. // Activity which allows data to be entered and saved to Shared Preferences.
@ -61,30 +71,60 @@ fun CreateExpense() {
editor.putString("Test", "Test") editor.putString("Test", "Test")
returnToMain() returnToMain()
} }
Column ( Column (
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxSize()
) { ) {
Row ( Row (
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center horizontalArrangement = Arrangement.Center,
) { ) {
Text( Text(
text = "New Expense Screen" text = "Add New Expense",
fontSize = 32.sp,
fontWeight = FontWeight.Bold
) )
} }
Row (
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
) {
var text by remember { mutableStateOf("") }
TextField(
value = text,
onValueChange = { text = it },
label = { Text("Label") }
)
}
Row ( Row (
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center horizontalArrangement = Arrangement.Center
) { ) {
Button(onClick = { returnToMain() }) { Spacer(modifier = Modifier.weight(1f))
Text(text = "Cancel")
} Button(
Button(onClick = { saveAndReturn() }) { onClick = { saveAndReturn() },
Modifier.weight(3f))
{
Text(text = "Save")
}
Spacer(modifier = Modifier.weight(1f))
Button(
onClick = { returnToMain() },
Modifier.weight(3f))
{
Text(text = "Cancel") Text(text = "Cancel")
} }
Spacer(modifier = Modifier.weight(1f))
} }
} }