Skip to content

Commit

Permalink
add text span children support
Browse files Browse the repository at this point in the history
  • Loading branch information
frybitsinc committed Jul 24, 2024
1 parent 6a5bb23 commit edd2c42
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
8 changes: 4 additions & 4 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -343,7 +343,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -421,7 +421,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -470,7 +470,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
18 changes: 18 additions & 0 deletions example/lib/presentation/samples/radar/radar_chart_sample1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,24 @@ class _RadarChartSample1State extends State<RadarChartSample1> {
case 0:
return RadarChartTitle(
text: 'Mobile or Tablet',
children:[
const TextSpan(
text: "\n(or sth else....",
style: TextStyle(
fontSize: 17,
color: Colors.red,
fontWeight: FontWeight.w700
),
),
const TextSpan(
text: "or watever it is....)",
style: TextStyle(
fontSize: 17,
color: Colors.green,
fontWeight: FontWeight.w700
),
),
],
angle: usedAngle,
);
case 2:
Expand Down
4 changes: 4 additions & 0 deletions lib/src/chart/radar_chart/radar_chart_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ enum RadarShape {
class RadarChartTitle {
const RadarChartTitle({
required this.text,
this.children,
this.angle = 0,
this.positionPercentageOffset,
});

/// [text] is used to draw titles outside the [RadarChart]
final String text;

/// [children] is used to draw additional titles outside the [RadarChart]
final List<InlineSpan>? children;

/// [angle] is used to rotate the title
final double angle;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/chart/radar_chart/radar_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class RadarChartPainter extends BaseChartPainter<RadarChartData> {
for (var index = 0; index < data.titleCount; index++) {
final baseTitleAngle = Utils().degrees(diffAngle * index);
final title = data.getTitle!(index, baseTitleAngle);
final span = TextSpan(text: title.text, style: style);
final span = TextSpan(text: title.text, children: title.children, style: style);
_titleTextPaint
..text = span
..layout();
Expand Down

0 comments on commit edd2c42

Please sign in to comment.