diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 6806f5a8e51478c1fb525c99617a4d600e170659..a07bb9db0728db1e147b248ca22209a2153ce223 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -3,19 +3,15 @@ <option name="myName" value="Project Default" /> <inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="GlancePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true"> <option name="composableFile" value="true" /> @@ -31,23 +27,18 @@ </inspection_tool> <inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> <inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true"> <option name="composableFile" value="true" /> - <option name="previewFile" value="true" /> </inspection_tool> </profile> </component> \ No newline at end of file diff --git a/app/src/main/java/at/ac/fhstp/pawwatch/MainActivity.kt b/app/src/main/java/at/ac/fhstp/pawwatch/MainActivity.kt index cb97ba402493ee5a24c411bf01fda812c72205df..1040be57cc76f913a6dfcc27682fa36f789d8be7 100644 --- a/app/src/main/java/at/ac/fhstp/pawwatch/MainActivity.kt +++ b/app/src/main/java/at/ac/fhstp/pawwatch/MainActivity.kt @@ -17,10 +17,10 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import at.ac.fhstp.pawwatch.data.AppointmentRepository import at.ac.fhstp.pawwatch.data.db.AppointmentDatabase -import at.ac.fhstp.pawwatch.ui.DetailScreen -import at.ac.fhstp.pawwatch.ui.EditScreen +import at.ac.fhstp.pawwatch.ui.DetailAppointmentScreen +import at.ac.fhstp.pawwatch.ui.EditAppointmentScreen import at.ac.fhstp.pawwatch.ui.AppointmentViewModelFactory -import at.ac.fhstp.pawwatch.ui.AddScreen +import at.ac.fhstp.pawwatch.ui.AddAppointmentScreen import at.ac.fhstp.pawwatch.ui.OverviewScreen import at.ac.fhstp.pawwatch.ui.theme.PawWatchTheme import at.ac.fhstp.pawwatch.ui.PetViewModel @@ -72,7 +72,7 @@ class MainActivity : ComponentActivity() { OverviewScreen(appointmentViewModel, navController) } composable(Screens.AddAppointment.route) { - AddScreen( + AddAppointmentScreen( viewModel = appointmentViewModel, onAppointmentClick = { appointment -> val route = Screens.AppointmentDetails(appointment.id.toString()) @@ -100,7 +100,7 @@ class MainActivity : ComponentActivity() { } composable(Screens.AppointmentDetails("appointmentId").route) { backStackEntry -> val appointmentId = backStackEntry.arguments?.getString("appointmentId") - DetailScreen( + DetailAppointmentScreen( appointmentId = appointmentId, viewModel = appointmentViewModel, navController = navController @@ -108,7 +108,7 @@ class MainActivity : ComponentActivity() { } composable(Screens.EditAppointment("{appointmentId}").route) { backStackEntry -> val appointmentId = backStackEntry.arguments?.getString("appointmentId") - EditScreen( + EditAppointmentScreen( appointmentId = appointmentId, viewModel = appointmentViewModel, navController = navController diff --git a/app/src/main/java/at/ac/fhstp/pawwatch/Navigation.kt b/app/src/main/java/at/ac/fhstp/pawwatch/Navigation.kt index 5c1e3c10c24106efe65a88b246e031d53976c277..137512e7e31eee83633134d9c729886335ea39d8 100644 --- a/app/src/main/java/at/ac/fhstp/pawwatch/Navigation.kt +++ b/app/src/main/java/at/ac/fhstp/pawwatch/Navigation.kt @@ -62,145 +62,17 @@ fun BottomNavigationBar(navController: NavController) { icon = { Icon(Icons.Filled.Add, contentDescription = "Add Appointment") }, label = { Text("Add") } ) - NavigationBarItem( - selected = currentRoute == Screens.Profile.route, - onClick = { navController.navigate(Screens.Profile.route) }, - icon = { Icon(Icons.Filled.Person, contentDescription = "Profile") }, - label = { Text("Profile") } - ) NavigationBarItem( selected = currentRoute == Screens.Overview.route, onClick = { navController.navigate(Screens.Overview.route) }, icon = { Icon(Icons.AutoMirrored.Filled.List, contentDescription = "Appointments") }, label = { Text("Appointments") } ) + NavigationBarItem( + selected = currentRoute == Screens.Profile.route, + onClick = { navController.navigate(Screens.Profile.route) }, + icon = { Icon(Icons.Filled.Person, contentDescription = "Profile") }, + label = { Text("Profile") } + ) } -} -//} - -//@Composable -//fun OverviewScreen(viewModel: AppointmentViewModel, navController: NavController) { -// val appointments by viewModel.appointments.collectAsState() -// -// LazyColumn(modifier = Modifier.fillMaxWidth().padding(16.dp)) { -// items(appointments) { appointment -> -// AppointmentCard(appointment = appointment) { -// navController.navigate(Screens.AppointmentDetails(appointmentId = appointment.id.toString()).createRoute(appointment.id.toString())) -// } -// Spacer(modifier = Modifier.height(14.dp)) -// } -// } -//} -// -//@Composable -//fun AppointmentCard(appointment: AppointmentEntity, onClick: () -> Unit) { -// OutlinedCard( -// modifier = Modifier -// .fillMaxWidth() -// .padding(start = 16.dp, top = 8.dp, end = 16.dp, bottom = 0.dp), -// onClick = onClick, -// colors = CardDefaults.outlinedCardColors( -// containerColor = MaterialTheme.colorScheme.secondary, -// contentColor = MaterialTheme.colorScheme.onPrimary -// ) -// ) { -// Column(modifier = Modifier.padding(16.dp)) { -// Text(appointment.petName, style = MaterialTheme.typography.bodyLarge) -// Spacer(modifier = Modifier.height(3.dp)) -// Text(appointment.category, style = MaterialTheme.typography.bodyMedium) -// Spacer(modifier = Modifier.height(10.dp)) -// Text(appointment.description, style = MaterialTheme.typography.bodyMedium) -// Spacer(modifier = Modifier.height(14.dp)) -// Text( -// "Date: ${DateFormat.getDateInstance().format(Date(appointment.appointmentDate))}", -// style = MaterialTheme.typography.bodyMedium -// ) -// } -// } -//} - -//@Composable -//fun ProfileScreen(navController: NavController, petViewModel: PetViewModel) { -// val pets by petViewModel.pets.collectAsState(initial = emptyList()) -// -// LazyColumn(modifier = Modifier.fillMaxWidth().padding(16.dp)) { -// items(pets) { pet -> -// OutlinedCard( -// modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp), -// onClick = { -// navController.navigate(Screens.EditPet(pet.id.toString()).route) -// } -// ) { -// Column(modifier = Modifier.padding(16.dp)) { -// Text(pet.name, style = MaterialTheme.typography.bodyLarge) -// Spacer(modifier = Modifier.height(8.dp)) -// Text(pet.type, style = MaterialTheme.typography.bodyMedium) -// Spacer(modifier = Modifier.height(8.dp)) -// Text(pet.description, style = MaterialTheme.typography.bodyMedium) -// } -// } -// } -// } -//} -// -//@Composable -//fun EditPetScreen(navController: NavController, petId: Int, petViewModel: PetViewModel) { -// val pet = petViewModel.getPetById(petId) -// -// if (pet == null) { -// Text("Pet not found") -// return -// } -// -// var name by remember { mutableStateOf(pet.name) } -// var type by remember { mutableStateOf(pet.type) } -// var description by remember { mutableStateOf(pet.description) } -// -// Scaffold { paddingValues -> -// Column( -// modifier = Modifier.padding(paddingValues).padding(16.dp), -// verticalArrangement = Arrangement.spacedBy(16.dp) -// ) { -// Text("Edit Pet", style = MaterialTheme.typography.headlineMedium) -// -// OutlinedTextField( -// value = name, -// onValueChange = { name = it }, -// label = { Text("Name") }, -// modifier = Modifier.fillMaxWidth() -// ) -// -// OutlinedTextField( -// value = type, -// onValueChange = { type = it }, -// label = { Text("Type") }, -// modifier = Modifier.fillMaxWidth() -// ) -// -// OutlinedTextField( -// value = description, -// onValueChange = { description = it }, -// label = { Text("Description") }, -// modifier = Modifier.fillMaxWidth() -// ) -// -// Row( -// modifier = Modifier.fillMaxWidth(), -// horizontalArrangement = Arrangement.SpaceBetween -// ) { -// Button(onClick = { -// petViewModel.editPet(petId, name, type, description) -// navController.navigateUp() -// }) { -// Text("Save") -// } -// Button(onClick = { -// petViewModel.deletePet(petId) -// navController.navigateUp() -// }) { -// Text("Delete") -// } -// } -// } -// } -//} +} \ No newline at end of file diff --git a/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddScreen.kt b/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddAppointmentScreen.kt similarity index 99% rename from app/src/main/java/at/ac/fhstp/pawwatch/ui/AddScreen.kt rename to app/src/main/java/at/ac/fhstp/pawwatch/ui/AddAppointmentScreen.kt index e46112398da2907a8e5e4567270bc9fa7be276d1..2797fcb4f93ebe2114d3a8ed0b46b7eb6c64f05c 100644 --- a/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddScreen.kt +++ b/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddAppointmentScreen.kt @@ -19,7 +19,7 @@ import java.util.* @OptIn(ExperimentalMaterial3Api::class) @Composable -fun AddScreen( +fun AddAppointmentScreen( viewModel: AppointmentViewModel, onAppointmentClick: (AppointmentEntity) -> Unit, onAddAppointmentClick: (String, String, Long, String) -> Unit, @@ -148,7 +148,7 @@ fun AddScreen( AlertDialog( onDismissRequest = { errorAddAppointment = false }, title = { Text("Could not add an appointment") }, - text = { Text("Please fill in all required fields and select a date and time") }, + text = { Text("Please fill in all required fields (Name and Category), and select a date and time") }, confirmButton = { Button( onClick = { errorAddAppointment = false } diff --git a/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddPetScreen.kt b/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddPetScreen.kt index 059640fe381d94abd424d0e49c350e71847fcb88..1b1e36a0fb0dbe8d07db76cc1cc5d321a92c08b6 100644 --- a/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddPetScreen.kt +++ b/app/src/main/java/at/ac/fhstp/pawwatch/ui/AddPetScreen.kt @@ -1,45 +1,181 @@ package at.ac.fhstp.pawwatch.ui import androidx.compose.foundation.layout.* +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material3.* import androidx.compose.runtime.* +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.navigation.NavController +@OptIn(ExperimentalMaterial3Api::class) @Composable fun AddPetScreen(navController: NavController, petViewModel: PetViewModel) { var name by remember { mutableStateOf("") } var type by remember { mutableStateOf("") } var description by remember { mutableStateOf("") } - var errorMessage by remember { mutableStateOf("") } + var showErrorDialog by remember { mutableStateOf(false) } // Error dialog state - Scaffold { paddingValues -> - Column(modifier = Modifier.padding(paddingValues).padding(16.dp)) { - if (errorMessage.isNotEmpty()) { + // Using Box for layout similar to EditAppointmentScreen + Box( + modifier = Modifier + .fillMaxSize() + .padding(35.dp) // Padding for spacing within the screen + ) { + // Back Button at the Top-Start + OutlinedButton( + onClick = { + navController.navigateUp() + }, + modifier = Modifier + .align(Alignment.TopStart), // Aligns the button at the top-left corner + colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.background), + elevation = ButtonDefaults.elevatedButtonElevation(defaultElevation = 3.dp), + ) { + Icon( + imageVector = Icons.AutoMirrored.Filled.ArrowBack, + contentDescription = "Back", + tint = MaterialTheme.colorScheme.onPrimary + ) + Spacer(modifier = Modifier.width(6.dp)) + Text( + text = "Back", + color = MaterialTheme.colorScheme.onPrimary, + style = MaterialTheme.typography.labelMedium + ) + } + + // Centered content + Column( + modifier = Modifier + .fillMaxSize() + .padding(top = 45.dp), // Leave space for the back button + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center + ) { + Text( + text = "Add New Pet", + style = MaterialTheme.typography.headlineMedium + ) + + Spacer(modifier = Modifier.height(25.dp)) + + Text( + text = "Pet Name:", + modifier = Modifier.align(Alignment.Start) + ) + Spacer(modifier = Modifier.height(5.dp)) + + OutlinedTextField( + value = name, + onValueChange = { name = it }, + modifier = Modifier.fillMaxWidth(), + colors = TextFieldDefaults.outlinedTextFieldColors( + containerColor = MaterialTheme.colorScheme.secondary + ), + textStyle = MaterialTheme.typography.bodyMedium, + placeholder = { + Text( + text = "Enter your pet name, e.g. Cupcake", + style = MaterialTheme.typography.bodyMedium + ) + } + ) + + Spacer(modifier = Modifier.height(20.dp)) + + Text( + text = "Pet Type:", + modifier = Modifier.align(Alignment.Start) + ) + Spacer(modifier = Modifier.height(5.dp)) + + OutlinedTextField( + value = type, + onValueChange = { type = it }, + modifier = Modifier.fillMaxWidth(), + colors = TextFieldDefaults.outlinedTextFieldColors( + containerColor = MaterialTheme.colorScheme.secondary + ), + textStyle = MaterialTheme.typography.bodyMedium, + placeholder = { + Text( + text = "Enter your pet type, e.g. Cat, Dog, etc.", + style = MaterialTheme.typography.bodyMedium + ) + } + ) + + Spacer(modifier = Modifier.height(20.dp)) + + Text( + text = "Description (Optional):", + modifier = Modifier.align(Alignment.Start) + ) + Spacer(modifier = Modifier.height(5.dp)) + + OutlinedTextField( + value = description, + onValueChange = { description = it }, + modifier = Modifier + .fillMaxWidth() + .heightIn(max = 100.dp) // Restrict height + .let { modifier -> + if (description.length > 200) { + modifier.verticalScroll(rememberScrollState()) // Enable scrolling for long descriptions + } else { + modifier + } + }, + colors = TextFieldDefaults.outlinedTextFieldColors( + containerColor = MaterialTheme.colorScheme.secondary + ), + textStyle = MaterialTheme.typography.bodyMedium, + placeholder = { + Text( + text = "Enter a description, e.g. Favourite food, habits, etc.", + style = MaterialTheme.typography.bodyMedium + ) + } + ) + + Spacer(modifier = Modifier.height(30.dp)) + + OutlinedButton( + onClick = { + if (name.isBlank() || type.isBlank()) { + showErrorDialog = true // Show the error dialog if validation fails + } else { + petViewModel.addPet(name, type, description.ifBlank { "No Description" }) + navController.popBackStack() + } + }, + modifier = Modifier.width(200.dp), + colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.primary), + elevation = ButtonDefaults.elevatedButtonElevation(defaultElevation = 3.dp) + ) { Text( - text = errorMessage, - color = MaterialTheme.colorScheme.error, - style = MaterialTheme.typography.bodyMedium + text = "Save", + style = MaterialTheme.typography.labelMedium ) - Spacer(modifier = Modifier.height(8.dp)) } - OutlinedTextField(value = name, onValueChange = { name = it }, label = { Text("Name") }) - Spacer(modifier = Modifier.height(8.dp)) - OutlinedTextField(value = type, onValueChange = { type = it }, label = { Text("Type") }) - Spacer(modifier = Modifier.height(8.dp)) - OutlinedTextField(value = description, onValueChange = { description = it }, label = { Text("Description") }) - Spacer(modifier = Modifier.height(16.dp)) - Button(onClick = { - if (name.isBlank() || type.isBlank()) { - errorMessage = "Name and Type are required fields!" - } else { - petViewModel.addPet(name, type, description.ifBlank { "No Description" }) - navController.popBackStack() - } - }) { - Text("Save") + // Error Dialog + if (showErrorDialog) { + AlertDialog( + onDismissRequest = { showErrorDialog = false }, + title = { Text("Could not add pet") }, + text = { Text("Please fill in all required fields (Name and Type)") }, + confirmButton = { + Button(onClick = { showErrorDialog = false }) { + Text("OK") + } + } + ) } } } diff --git a/app/src/main/java/at/ac/fhstp/pawwatch/ui/DetailScreen.kt b/app/src/main/java/at/ac/fhstp/pawwatch/ui/DetailAppointmentScreen.kt similarity index 99% rename from app/src/main/java/at/ac/fhstp/pawwatch/ui/DetailScreen.kt rename to app/src/main/java/at/ac/fhstp/pawwatch/ui/DetailAppointmentScreen.kt index dcb6987d916039d818046c93ec617fe442b8bf5f..a93285954e61c31f7e549c3f1a2e7f42ea091697 100644 --- a/app/src/main/java/at/ac/fhstp/pawwatch/ui/DetailScreen.kt +++ b/app/src/main/java/at/ac/fhstp/pawwatch/ui/DetailAppointmentScreen.kt @@ -16,7 +16,7 @@ import java.util.Date import java.util.Locale @Composable -fun DetailScreen( +fun DetailAppointmentScreen( appointmentId: String?, viewModel: AppointmentViewModel, navController: NavController diff --git a/app/src/main/java/at/ac/fhstp/pawwatch/ui/EditScreen.kt b/app/src/main/java/at/ac/fhstp/pawwatch/ui/EditAppointmentScreen.kt similarity index 99% rename from app/src/main/java/at/ac/fhstp/pawwatch/ui/EditScreen.kt rename to app/src/main/java/at/ac/fhstp/pawwatch/ui/EditAppointmentScreen.kt index 0e91f39bf1cbe1aa6138044736d09702c3dd31d7..27fd7e5735ff78a3fb9540aeeb51044453a32de2 100644 --- a/app/src/main/java/at/ac/fhstp/pawwatch/ui/EditScreen.kt +++ b/app/src/main/java/at/ac/fhstp/pawwatch/ui/EditAppointmentScreen.kt @@ -18,7 +18,7 @@ import java.util.Locale @OptIn(ExperimentalMaterial3Api::class) @Composable -fun EditScreen( +fun EditAppointmentScreen( appointmentId: String?, viewModel: AppointmentViewModel, navController: NavController diff --git a/app/src/main/java/at/ac/fhstp/pawwatch/ui/ProfileScreen.kt b/app/src/main/java/at/ac/fhstp/pawwatch/ui/ProfileScreen.kt index 2bea734ff08e68889a387a4ba64f99b9831cfe3f..dda3aabccc6a187f731418b7eea68f45f8ac96a5 100644 --- a/app/src/main/java/at/ac/fhstp/pawwatch/ui/ProfileScreen.kt +++ b/app/src/main/java/at/ac/fhstp/pawwatch/ui/ProfileScreen.kt @@ -7,6 +7,7 @@ import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.lifecycle.viewmodel.compose.viewModel import androidx.compose.ui.unit.dp @@ -18,49 +19,88 @@ import at.ac.fhstp.pawwatch.data.db.PetDatabase fun ProfileScreen(navController: NavController, petViewModel: PetViewModel) { val pets by petViewModel.pets.collectAsState(initial = emptyList()) - Scaffold { paddingValues -> - Column(modifier = Modifier.padding(paddingValues).padding(16.dp)) { - // Header Row with Title and "Add New Pet" button - Row( - modifier = Modifier - .fillMaxWidth() - .padding(bottom = 16.dp), - horizontalArrangement = Arrangement.SpaceBetween - ) { - Text("Your Pets", style = MaterialTheme.typography.headlineMedium) - - // Add New Pet button in the top-right corner - Button( - onClick = { navController.navigate("addPet") }, - modifier = Modifier.height(40.dp) - ) { - Text("Add New Pet") - } - } + Box( + modifier = Modifier + .fillMaxSize() + .padding(35.dp) + ) { + // "Your Pets" label at the top + Text( + text = "Your Pets", + style = MaterialTheme.typography.headlineMedium, + modifier = Modifier + .align(Alignment.TopCenter) // Align at the top center of the Box + .padding(top = 16.dp) // Add padding at the top + ) + // Center the rest of the content + Column( + modifier = Modifier + .fillMaxSize() + .padding(top = 75.dp), // Adjust top padding to avoid overlap with label + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(10.dp) // Add spacing between items + ) { // Pet List or Placeholder Text if (pets.isEmpty()) { - Text("No pets found. Add your first pet!", style = MaterialTheme.typography.bodyMedium) + Text( + "No pets found. Add your first pet!", + style = MaterialTheme.typography.bodyLarge + ) } else { - LazyColumn(modifier = Modifier.fillMaxWidth().padding(16.dp)) { + LazyColumn( + modifier = Modifier + .fillMaxWidth() + .weight(1f) // This allows the list to take the remaining space + ) { items(pets) { pet -> OutlinedCard( - modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp), - onClick = { navController.navigate("editPet/${pet.id}") } + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 8.dp), + onClick = { navController.navigate("editPet/${pet.id}") }, + colors = CardDefaults.outlinedCardColors( + containerColor = MaterialTheme.colorScheme.secondary, + contentColor = MaterialTheme.colorScheme.onPrimary + ), + elevation = CardDefaults.elevatedCardElevation(defaultElevation = 3.dp) ) { Column(modifier = Modifier.padding(16.dp)) { Text(pet.name, style = MaterialTheme.typography.bodyLarge) Spacer(modifier = Modifier.height(8.dp)) Text(pet.type, style = MaterialTheme.typography.bodyMedium) Spacer(modifier = Modifier.height(8.dp)) - Text(pet.description, style = MaterialTheme.typography.bodyMedium) + + val shortenDescription = if (pet.description.length > 70) { + "${pet.description.take(70)}..." + } else { + pet.description + } + + Text( + shortenDescription, + style = MaterialTheme.typography.bodyMedium + ) } } } } } + + // Add Pet Button at the bottom + OutlinedButton( + modifier = Modifier.width(200.dp), + colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.primary), + onClick = { + navController.navigate("addPet") + }, + elevation = ButtonDefaults.elevatedButtonElevation(defaultElevation = 3.dp) + ) { + Text( + text = "Add your pet", + style = MaterialTheme.typography.labelMedium + ) + } } } } - -