Skip to content

Commit 8ab7dc7

Browse files
committed
26-default-background-color-set-to-100c2a
1 parent 9235b4c commit 8ab7dc7

File tree

17 files changed

+115
-47
lines changed

17 files changed

+115
-47
lines changed

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.7.10'
2+
ext.kotlin_version = '1.8.10'
33
repositories {
44
google()
55
mavenCentral()

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip

example/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pluginManagement {
2323

2424
plugins {
2525
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
26-
id "com.android.application" version "7.3.0" apply false
26+
id "com.android.application" version "8.1.0" apply false
2727
}
2828

2929
include ":app"

example/lib/charts/basic_bar_chart.dart

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class BasicBarChart extends StatefulWidget {
1414
class _BasicBarChartState extends State<BasicBarChart> {
1515

1616
final controller = GraphifyController();
17+
var _chartCreated = false;
1718
Timer? timer;
1819

1920
@override
@@ -33,23 +34,51 @@ class _BasicBarChartState extends State<BasicBarChart> {
3334

3435
@override
3536
Widget build(BuildContext context) {
36-
return GraphifyView(
37-
controller: controller,
38-
initialOptions: const {
39-
"xAxis": {
40-
"type": "category",
41-
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
42-
},
43-
"yAxis": {
44-
"type": "value"
45-
},
46-
"series": [
47-
{
48-
"data": [120, 200, 150, 80, 70, 110, 130],
49-
"type": "bar"
50-
}
51-
]
52-
},
37+
return Stack(
38+
children: [
39+
40+
GraphifyView(
41+
controller: controller,
42+
onCreated: () async {
43+
await Future.delayed(const Duration(milliseconds: 400));
44+
setState(() {
45+
_chartCreated = true;
46+
});
47+
},
48+
initialOptions: const {
49+
'backgroundColor': 'transparent',
50+
"xAxis": {
51+
"type": "category",
52+
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
53+
},
54+
"yAxis": {
55+
"type": "value"
56+
},
57+
"series": [
58+
{
59+
"data": [120, 200, 150, 80, 70, 110, 130],
60+
"type": "bar"
61+
}
62+
],
63+
},
64+
),
65+
66+
if (!_chartCreated)
67+
Positioned.fill(
68+
child: Container(
69+
color: Colors.white,
70+
child: const Center(
71+
child: SizedBox.square(
72+
dimension: 100,
73+
child: CircularProgressIndicator.adaptive(
74+
backgroundColor: Colors.green,
75+
),
76+
)
77+
)
78+
),
79+
),
80+
81+
],
5382
);
5483
}
5584

example/lib/charts/basic_line_chart.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ class _BasicLineChartState extends State<BasicLineChart> {
3636
return GraphifyView(
3737
controller: controller,
3838
onConsoleMessage: (message) {
39-
print("awdawd message$message");
39+
print("[ERROR] $message");
4040
},
4141
initialOptions: const {
42+
"backgroundColor": 'transparent',
4243
"xAxis": {
4344
"type": "category",
4445
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]

example/lib/charts/nested_pies_chart.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class NestedPiesChart extends StatelessWidget {
99
return GraphifyView(
1010
controller: GraphifyController(),
1111
initialOptions: const {
12+
"backgroundColor": 'transparent',
1213
"tooltip": {"trigger": "item", "formatter": "{a} <br/>{b}: {c} ({d}%)"},
1314
"legend": {
1415
"data": [

example/pubspec.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ packages:
104104
path: ".."
105105
relative: true
106106
source: path
107-
version: "1.0.8"
107+
version: "1.0.9"
108108
integration_test:
109109
dependency: "direct dev"
110110
description: flutter
@@ -383,10 +383,10 @@ packages:
383383
dependency: transitive
384384
description:
385385
name: webview_flutter_wkwebview
386-
sha256: d7403ef4f042714c9ee2b26eaac4cadae7394cb0d4e608b1dd850c3ff96bd893
386+
sha256: c49a98510080378b1525132f407a92c3dcd3b7145bef04fb8137724aadcf1cf0
387387
url: "https://pub.dev"
388388
source: hosted
389-
version: "3.18.2"
389+
version: "3.18.4"
390390
sdks:
391391
dart: ">=3.7.0-0 <4.0.0"
392392
flutter: ">=3.27.0"

lib/src/resources/index.html.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@
33
import 'package:graphify/src/resources/dependencies.js.dart';
44
import 'package:graphify/src/utils/js_methods.dart';
55

6-
String indexHtml({ required String id, bool enableDependency = true}) {
6+
String indexHtml({
7+
required String id,
8+
bool enableDependency = true,
9+
String? backgroundColor,
10+
}) {
711
return '''<!DOCTYPE html>
812
<html>
913
<head>
1014
<meta charset="UTF-8">
11-
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
1215
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
13-
<title>Graphify</title>
1416
<style>
1517
html, body {
16-
background-color: #100c2a;
18+
${backgroundColor != null ? "background-color: $backgroundColor;" : ""}
1719
height: -webkit-fill-available;
1820
box-sizing: content-box;
1921
margin: 0;
@@ -40,4 +42,4 @@ String indexHtml({ required String id, bool enableDependency = true}) {
4042
</body>
4143
</html>
4244
''';
43-
}
45+
}

lib/src/utils/color_util.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import 'dart:ui' show Color;
2+
3+
final class ColorUtils {
4+
5+
static String colorToRgba(Color color) {
6+
return 'rgba(${(color.r * 255).toInt()}, ${(color.g * 255).toInt()}, ${(color.b * 255).toInt()}, ${color.a})';
7+
}
8+
9+
}

lib/src/utils/gradient/graphify_gradient.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:ui';
2+
import 'package:graphify/src/utils/color_util.dart';
23

34
abstract class GraphifyGradient {
45
const GraphifyGradient({
@@ -44,8 +45,7 @@ class GraphifyGradientColorStop {
4445
Map<String, dynamic> toJson() {
4546
return <String, dynamic>{
4647
'offset': offset,
47-
'color':
48-
'rgba(${(color.r * 255).toInt()}, ${(color.g * 255).toInt()}, ${(color.b * 255).toInt()}, ${color.a})',
48+
'color': ColorUtils.colorToRgba(color),
4949
};
5050
}
5151
}

0 commit comments

Comments
 (0)