搜索

PythonReactSEOPDF
GitHub Skill

new-screen

Scaffold a new Jetpack Compose screen following project patterns. Use when creating a new screen or view in the app.

vide☆ 41 仓库 Stars5 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

New Screen Skill

Create a new Jetpack Compose screen following MateDroid's patterns.

Project Structure

Screens are located in app/src/main/java/com/matedroid/ui/screens/:

screens/
├── dashboard/
│   └── DashboardScreen.kt
├── drives/
│   ├── DrivesScreen.kt
│   └── DriveDetailScreen.kt
├── charges/
│   ├── ChargesScreen.kt
│   └── ChargeDetailScreen.kt
├── settings/
│   └── SettingsScreen.kt
└── {feature}/
    └── {Feature}Screen.kt

Process

  1. Ask the user for:

    • Screen name (e.g., "Battery Health")
    • Brief description of what it displays
    • Whether it needs navigation parameters
  2. Read an existing screen as reference (e.g., DashboardScreen.kt)

  3. Create the new screen file following the pattern

Screen Template

package com.matedroid.ui.screens.{feature}

import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.matedroid.R

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun {Feature}Screen(
    onNavigateBack: () -> Unit,
    modifier: Modifier = Modifier
) {
    Scaffold(
        topBar = {
            TopAppBar(
                title = { Text(stringResource(R.string.{feature}_title)) },
                navigationIcon = {
                    IconButton(onClick = onNavigateBack) {
                        Icon(
                            imageVector = Icons.AutoMirrored.Filled.ArrowBack,
                            contentDescription = stringResource(R.string.back)
                        )
                    }
                }
            )
        }
    ) { paddingValues ->
        Column(
            modifier = modifier
                .fillMaxSize()
                .padding(paddingValues)
                .padding(16.dp)
        ) {
            // Screen content here
        }
    }
}

After Creating the Screen

  1. Add string resources for the screen title using the translate skill
  2. Add navigation route to the app's navigation graph
  3. Remind the user to wire up the navigation

Common Patterns

Loading State
var isLoading by remember { mutableStateOf(true) }

if (isLoading) {
    CircularProgressIndicator()
} else {
    // Content
}
API Data Fetching
LaunchedEffect(Unit) {
    // Fetch data from TeslamateApiService
}
Pull to Refresh
val pullRefreshState = rememberPullToRefreshState()
PullToRefreshBox(state = pullRefreshState, isRefreshing = isRefreshing) {
    // Content
}
Cards
Card(
    modifier = Modifier.fillMaxWidth(),
    colors = CardDefaults.cardColors(
        containerColor = MaterialTheme.colorScheme.surfaceVariant
    )
) {
    // Card content
}

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-02-04
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!