Skip to content

Commit

Permalink
style(theme): 优化样式
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaoyaning committed Aug 21, 2022
1 parent f3b9471 commit be71f9c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
7 changes: 0 additions & 7 deletions app/src/main/java/com/jyn/composecalculator/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@ package com.jyn.composecalculator

import android.content.res.Configuration.ORIENTATION_PORTRAIT
import android.os.Bundle
import android.view.Window
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import androidx.lifecycle.viewmodel.compose.viewModel
import com.apkfuns.logutils.LogUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import com.apkfuns.logutils.LogUtils
import com.jyn.composecalculator.BOTTOM_FRACTION
import com.jyn.composecalculator.DateViewModel
import com.jyn.composecalculator.ui.theme.evaluator
import com.jyn.composecalculator.ui.theme.myTheme
import com.jyn.composecalculator.ui.view.InputText
import com.jyn.composecalculator.ui.view.ItemText
Expand Down Expand Up @@ -131,7 +130,7 @@ fun TextBox(process: Float, onClick: () -> Unit) {
) {
TopAppBar(
modifier = Modifier
.padding(top = 30.dp)
.padding(top = 25.dp)
.height(50.dp),
title = { Text("历史记录", color = myTheme.textColor) },
navigationIcon = {
Expand Down Expand Up @@ -162,9 +161,6 @@ fun TextBox(process: Float, onClick: () -> Unit) {
viewModel.resultText.value = item.result
}) {
ItemText(input = item.input, result = item.result)
if (index < viewModel.results.size - 1) {
Divider()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.jyn.composecalculator.isDark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -26,7 +24,6 @@ import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.jyn.composecalculator.DateViewModel
import com.jyn.composecalculator.isPortrait
import com.jyn.composecalculator.ui.theme.evaluator
import com.jyn.composecalculator.ui.theme.myTheme

@Composable
Expand Down Expand Up @@ -100,7 +97,7 @@ fun InputText(process: Float) {
@Composable
fun ItemText(input: String, result: String) {
Column(
modifier = Modifier.height(110.dp),
modifier = Modifier.height(120.dp),
verticalArrangement = Arrangement.Center
) {
Text(
Expand All @@ -117,11 +114,13 @@ fun ItemText(input: String, result: String) {
)
)

Spacer(modifier = Modifier.height(10.dp))

Text(
modifier = Modifier.fillMaxWidth(),
text = result,
color = Color.Gray,
fontSize = if (isPortrait) 23.sp else 20.sp,
fontSize = if (isPortrait) 26.sp else 23.sp,
maxLines = 1,
textAlign = TextAlign.End,
style = TextStyle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.colorspace.ColorSpaces
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.apkfuns.logutils.LogUtils
import com.jyn.composecalculator.isDark
import com.jyn.composecalculator.ui.theme.myTheme

/**
* 取值1..100
Expand Down

0 comments on commit be71f9c

Please sign in to comment.