Overview
TheMapScreen provides an interactive campus map that helps students locate buildings, classrooms, laboratories, and facilities. It includes a search function, category filters, and a visual map representation.
Main Composable
MapScreen()
Scaffold with a floating action button for location services and displays:
- Header with “CAMPUS LOCATOR” branding
- Search bar for buildings and rooms
- Category filter chips
- Visual campus map representation
- List of nearby buildings with distances
- My Location FAB in TecBlue color
- Search text field with state management
- Filter chips for content categories
- Interactive building list
- Light gray background (Color(0xFFF5F6F8))
Sub-Composables
MapHeader()
- Label: “CAMPUS LOCATOR”
- Title: “Mapa del campus”
- Description: “Encuentra rápidamente edificios, aulas y laboratorios”
- TecBlue background
- 32dp rounded bottom corners
- White text with varying opacity levels
- Multiple text sizes for hierarchy
FilterChipCustom()
text- Label text for the filter (e.g., “Todos”, “Aulas”, “Labs”)selected- Whether this filter is currently active
- Selected: TecBlue background with white text
- Unselected: White background with gray text
- Pill-shaped with 50dp corner radius
- Semi-bold font weight
- “Todos” (All)
- “Aulas” (Classrooms)
- “Labs” (Laboratories)
- “Cafetería” (Cafeteria)
CampusMapCard()
- Large card container (320dp height)
- Light gray background with border
- Building boxes positioned with offsets:
- Edificio A - Blue box at (28dp, 42dp)
- Lab 3 - Green box at (180dp, 82dp)
- Cafetería - Orange box at (90dp, 210dp)
- Location indicator (TecGold dot at 250dp, 200dp)
- “Plano del campus” legend in bottom-left corner
- 28dp rounded corners
- 4dp elevation
- Color-coded building boxes with rounded corners
- White legend card overlay
BuildingItem()
title- Building name (e.g., “Edificio A”, “Laboratorio 3”)subtitle- Description with type and distance (e.g., “Aulas generales · 120 m”)iconColor- Color for the icon and background tint
- Labs → Science icon (Icons.Outlined.Science)
- Cafetería → Coffee icon (Icons.Outlined.Coffee)
- Default → Apartment icon (Icons.Outlined.Apartment)
- Circular icon container (52dp) with colored background
- Building name in large bold text
- Subtitle with type and distance
- Location pin icon on the right
- Clickable card with 3dp elevation
Search Functionality
The screen includes anOutlinedTextField for searching buildings and classrooms:
Building Color System
| Building Type | Color | Hex |
|---|---|---|
| Edificio A (Classrooms) | Blue | #2563EB |
| Laboratorio 3 (Labs) | Green | #10B981 |
| Cafetería (Cafeteria) | Orange | #FF7A00 |
Map Features
- Visual Map Card - Shows building positions and layout
- Search Bar - Find specific buildings or rooms
- Category Filters - Filter by type (All, Classrooms, Labs, Cafeteria)
- Nearby Buildings List - Shows buildings sorted by distance
- Location FAB - Quick access to current location
Source Code
File:app/src/main/java/com/example/appcontrolescolar/ui/screens/MapScreen.kt