Skip to content
Snippets Groups Projects
Commit 0502b39a authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Compute gradient color from bar height

parent 93fb581b
No related branches found
No related tags found
1 merge request!16Resolve "Compute gradient color from bar height"
Pipeline #4495 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.14
app.versionCode=14
app.versionName=0.0.15
app.versionCode=15
Gradients uniformisation on bars of same charts.
Uniformisation des dégradés de couleur entre les barres du même graphique.
......@@ -55,7 +55,7 @@ class CustomBarChart extends StatelessWidget {
required double value,
required Color barColor,
required double barWidth}) {
final gradient = this.getGradient(barColor);
final gradient = this.getGradient(barColor, value, this.getMaxCountsValue());
final borderColor = barColor.darken(20);
return BarChartGroupData(
......@@ -75,10 +75,12 @@ class CustomBarChart extends StatelessWidget {
);
}
LinearGradient getGradient(Color baseColor) {
LinearGradient getGradient(Color baseColor, double value, double maxValue) {
double alignmentTopValue = value != 0.0 ? -2 * maxValue / value + 1 : 0;
return LinearGradient(
begin: Alignment.topLeft,
end: Alignment(0.8, 1),
begin: Alignment(-1, alignmentTopValue),
end: Alignment(1, 1),
colors: <Color>[
baseColor.lighten(30),
baseColor,
......
......@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
publish_to: 'none'
version: 0.0.14+14
version: 0.0.15+15
environment:
sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment