Skip to content

Instantly share code, notes, and snippets.

View gabrielbmoro's full-sized avatar
👋
Hii

Gabriel Bronzatti Moro gabrielbmoro

👋
Hii
View GitHub Profile
@gabrielbmoro
gabrielbmoro / QuizReport.kt
Created March 10, 2023 18:46
AccessibilityArticle8
@Composable
fun QuizReport(
rightAnswersValue: String,
totalQuestionsValue: String,
modifier: Modifier = Modifier
) {
val description = stringResource(
R.string.score_report_content_description,
totalQuestionsValue,
rightAnswersValue
@gabrielbmoro
gabrielbmoro / BasicText.kt
Created March 10, 2023 18:45
AccessibilityArticle7
BasicText(
text = text,
Modifier
.padding(
vertical = 40.dp,
horizontal = 30.dp
)
.semantics {
this.text = AnnotatedString(description)
},
@Composable
fun PageIndicator(modifier: Modifier = Modifier, amountOfIndicators: Int, step: Int) {
val description = stringResource(
R.string.page_indicator_description,
amountOfIndicators,
step + 1
)
Row(
// parte adicionada
@gabrielbmoro
gabrielbmoro / PageIndicator.kt
Created March 10, 2023 18:43
AccessibilityArticle5
// Círculo com suporte pra selecionado e não selecionado
@Composable
fun Dot(isSelected: Boolean) {
Canvas(
modifier = Modifier
.size(24.dp)
.padding(end = 4.dp),
onDraw = {
val color = if (isSelected) LightBlue else Gray
drawCircle(color)
@gabrielbmoro
gabrielbmoro / modifier.kt
Created March 10, 2023 18:43
AccessibilityArticle4
val modifier = Modifier
.fillMaxWidth(2f)
.clip(CircleShape)
.background(answerState.backgroundColor)
.padding(8.dp)
.toggleable(
enabled = isAnswerSelectionEnabled,
role = Role.RadioButton,
onValueChange = {
attemptCallback(answer)
@gabrielbmoro
gabrielbmoro / modifier.kt
Created March 10, 2023 18:42
AccessibilityArticle3
val modifier = Modifier
.fillMaxWidth(2f)
.clip(CircleShape)
.background(answerState.backgroundColor)
.padding(8.dp)
.toggleable(
enabled = isAnswerSelectionEnabled,
role = Role.RadioButton,
onValueChange = {
attemptCallback(answer)
@gabrielbmoro
gabrielbmoro / Card.kt
Created March 10, 2023 18:41
AccessibilityArticle2
Card(
modifier = modifier
.height(120.dp)
.width(200.dp)
.clip(RoundedCornerShape)
.clickable(
onClick = clickEvent,
role = Role.Button,
onClickLabel = "Acessar"
),
@gabrielbmoro
gabrielbmoro / Card.kt
Created March 10, 2023 18:40
AccessibilityArticle
Card(
modifier = modifier
.height(120.dp)
.width(200.dp)
.clip(RoundedCornerShape)
.clickable(
onClick = clickEvent
),
backgroundColor = backgroundColor
) {
@gabrielbmoro
gabrielbmoro / PieChart.kt
Last active March 12, 2023 00:39
PieChart example using compose
package com.example.composecharts.ui.widgets
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
@gabrielbmoro
gabrielbmoro / TimeHelperTest.test.ts
Created September 6, 2022 21:24
An API Project - Gists Part 6
import { TimeHelper } from "util/TimeHelper"
describe("Time Helper", () => {
it("should get total minutes from 3h", () => {
const totalMinutes = TimeHelper.getTotalMinutes("3h")
expect(totalMinutes).toBe(180)
})
it("should get total minutes from 3h 15min", () => {
const totalMinutes = TimeHelper.getTotalMinutes("3h 15min")