Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zekierciyas/survey-compose
A Survey library of fully configurable, dynamic questions/answers and UI written in Jetpack Compose.
https://github.com/zekierciyas/survey-compose
android android-survey jetpack-compose questionnaire questionnaire-android survey-jetpack-compose survey-view
Last synced: 3 months ago
JSON representation
A Survey library of fully configurable, dynamic questions/answers and UI written in Jetpack Compose.
- Host: GitHub
- URL: https://github.com/zekierciyas/survey-compose
- Owner: zekierciyas
- License: apache-2.0
- Created: 2024-02-09T20:01:09.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-08T19:25:56.000Z (8 months ago)
- Last Synced: 2024-05-02T15:17:36.082Z (7 months ago)
- Topics: android, android-survey, jetpack-compose, questionnaire, questionnaire-android, survey-jetpack-compose, survey-view
- Language: Kotlin
- Homepage:
- Size: 11.6 MB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - zekierciyas/survey-compose - A Survey library of fully configurable, dynamic questions/answers and UI written in Jetpack Compose. (Kotlin)
README
# Survey View
[![](https://jitpack.io/v/zekierciyas/survey-compose.svg)](https://jitpack.io/#zekierciyas/survey-compose)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-survey--compose-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/8480)Android library written in Jetpack Compose, containing a fully configurable survey/questionnaire screen.
## Gradle
**Step 1** : Add the JitPack repository to your build file
```gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```**Step 2** : Add the dependency
```gradle
implementation 'com.github.zekierciyas:survey-compose:1.0.0'
```## Usage
``` kotlin
@Composable
fun SurveyView() {var showMessage by remember { mutableStateOf(false) }
val sampleSurvey = listOf(
SurveyModel(
questionType = QuestionType.MULTIPLE_CHOICE,
questionId = "id1",
questionTitle = "1) Select your favorite color:",
answers = listOf("Red", "Green", "Blue"),
questionDescription = "Description"
),
SurveyModel(
questionType = QuestionType.SINGLE_CHOICE,
questionId ="id2",
questionTitle ="2) Choose your preferred programming language:",
answers = listOf("Java", "Kotlin", "Swift", "Python"),
questionDescription = "Description"
),
SurveyModel(
questionType = QuestionType.TEXT,
questionId ="id3",
questionTitle ="3) Choose your preferred programming language:",
questionDescription = "Description"
)
)
SurveyScreen(
survey = sampleSurvey,
backgroundColor = Color.White,
singleOptionUI = SingleOptionUI(
questionTitle = SurveyText(
color = Color.DarkGray,
fontWeight = FontWeight.ExtraBold
),
answer = SurveyText(
color = Color.DarkGray,
fontWeight = FontWeight.Medium
),
selectedColor = Color.White,
unSelectedColor = Color.Gray,
borderColor = Color.Gray
),
multipleOptionUI = MultipleOptionUI(
questionTitle = SurveyText(
color = Color.DarkGray,
fontWeight = FontWeight.ExtraBold
),
answer = SurveyText(
color = Color.DarkGray,
fontWeight = FontWeight.Medium
),
checkedColor = Color.Gray,
uncheckedColor = Color.White,
borderColor = Color.Gray
),
textOptionUI = TextOptionUI(
questionTitle = SurveyText(
color = Color.DarkGray,
fontWeight = FontWeight.ExtraBold
),
answer = SurveyText(
color = Color.Gray,
fontWeight = FontWeight.Medium
),
borderColor = Color.Gray,
backgroundColor = Color.White,
surveyOutlinedText = SurveyOutlinedText(
focusedTextColor = Color.DarkGray,
unfocusedContainerColor = Color.White,
focuedLabelColor = Color.DarkGray
)
),
callbackAnswers = {},
callbackAllAnswered = {
showMessage = true
})if (showMessage) {
Snackbar(
action = {
Button(
onClick = { showMessage = false }
) {
Text("Dismiss")
}
}
) {
Text(text = "All questions are done")
}
}
}
```