Comments (6)
给一下最小可复现代码,我看看
from ptqflipper.
Box(modifier = Modifier.padding(top = 10.dp, end = 20.dp).fillMaxSize()) {
val state by rememberPTQBookPageViewState(pageCount = 100)
val config by rememberPTQBookPageViewConfig(pageColor = Color.White)
PTQBookPageView(
state = state, config = config, modifier = Modifier.fillMaxSize().background(
Color.Transparent, shape = RoundedCornerShape(
topStart = 0.dp, topEnd = 32.dp, bottomEnd = 32.dp, bottomStart = 0.dp
)
)
) {
contents { currentPage, refresh ->
Box {
Card(
shape = RoundedCornerShape(
topStart = 0.dp, topEnd = 32.dp, bottomEnd = 32.dp, bottomStart = 0.dp
), colors = CardDefaults.cardColors(
containerColor = Color.White
), modifier = Modifier.fillMaxSize()
) {
Text("$currentPage", style = MaterialTheme.typography.bodyLarge)
}
Image(painter = Images.HomeLeft.painter(), contentDescription = null)
}
refresh()
}
}
}
from ptqflipper.
就是在PTQBookPageView的modifer中和的Card 里面加载了shape,去做一个圆角的效果,就会出现 这个。
from ptqflipper.
看了一下,现在的实现方式暂时不支持设置圆角,我得想想圆角怎么实现
from ptqflipper.
书页必须是矩形,因为裁了边(比如圆角)的话,阴影以及翻起来的那一页都不好画,并且书页底色本身只能是非透明的
from ptqflipper.
Box(modifier = Modifier.padding(top = 10.dp, end = 20.dp).fillMaxSize()) { val state by rememberPTQBookPageViewState(pageCount = 100) val config by rememberPTQBookPageViewConfig(pageColor = Color.White) PTQBookPageView( state = state, config = config, modifier = Modifier.fillMaxSize().background( Color.Transparent, shape = RoundedCornerShape( topStart = 0.dp, topEnd = 32.dp, bottomEnd = 32.dp, bottomStart = 0.dp ) ) ) { contents { currentPage, refresh -> Box { Card( shape = RoundedCornerShape( topStart = 0.dp, topEnd = 32.dp, bottomEnd = 32.dp, bottomStart = 0.dp ), colors = CardDefaults.cardColors( containerColor = Color.White ), modifier = Modifier.fillMaxSize() ) { Text("$currentPage", style = MaterialTheme.typography.bodyLarge) } Image(painter = Images.HomeLeft.painter(), contentDescription = null) } refresh() } } }
如果是外面的圆角,在最外面直接Clip就行了,比如你的PTQBookPageView那一级的Modifier。但是这两天想了下,如果翻起来的那一页要画圆角,不知道怎么画,因为有个问题就是,当你翻的很小的时候,就是只翻开了一点的时候,你设的圆角的半径会超过翻开了的边长度,不知道怎么处理了。
from ptqflipper.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ptqflipper.