syncfusion charts package on flutter - flutter

I am using this package syncfusion_flutter_charts: ^18.4.47 to provide chart this is my code and there is a square beside my chart as showing in the pic
I am using this package syncfusion_flutter_charts: ^18.4.47 to provide chart this is my code and there is a square beside my chart as showing in the picenter image description here
body: SizedBox(
height: 200,
width: 300,
child: SfCartesianChart(
primaryXAxis: CategoryAxis(
maximumLabelWidth: 80,
),
enableAxisAnimation: true,
// borderColor: yellow,
plotAreaBorderColor: yellow,
plotAreaBackgroundColor: yellow,
series: <ChartSeries<GeluValue, String>>[
BarSeries(
dataSource: <GeluValue>[
GeluValue("السبت", 180),
GeluValue("الاحد", 200),
GeluValue("الاثنين", 160),
GeluValue("الثلاثاء", 70),
GeluValue("الاربعاء", 90),
GeluValue("الخميس", 100),
GeluValue("الجمعة", 70),
],
xAxisName: "days",
yAxisName: "values",
// color: yellow,
animationDuration: 20,
xValueMapper: (GeluValue gelu, _) => gelu.day,
yValueMapper: (GeluValue gelu, _) => gelu.gelu,
)
]),
),

We would like to tell you that, since the chart is a widget formed by drawing, RTL is not applicable for it. Your reported issue may arise due to using of delegates in your app like GlobalWidgetsLocalizations.delegate. Since for Arabic and some other locales, the default behavior is by RTL (right-to-left), we get the position from the right end and the chart starts to render from there. To resolve this issue, you can use the following code snippet,
Directionality(
textDirection: TextDirection.ltr,
child: SfCartesianChart()
)
By wrapping up our chart widget using the Directionality widget and set the textDirection to TextDirection.ltr will allow rendering the chart from the left end and hopes this will resolve your issue. Also, if you need the mirror image of the chart, you can achieve it by using the opposedPosition and isInversed properties in the respective axis. Here we also attached the modified given sample and screenshot for your reference, please make use of it. Now the rendered chart looks like renders from RTL (right-to-left). To know more about our charts, please refer to the following help document.
https://help.syncfusion.com/flutter/cartesian-charts/axis-customization#placing-axes-at-the-opposite-side
Sample: https://www.syncfusion.com/downloads/support/directtrac/320174/ze/I320174-arabic-chart499151652
Screenshots
Mirror image

Related

what will do after icon broke suddenly in appbar?

I am developing a flutter app where appbar icon broke suddenly without any reason. Try to fix but nothing has been found yet.
enter image description here
AppBar(
actions: [
GestureDetector(
onTap: () {},
child: SvgPicture.asset(
iconSearch,
color: VisuColors.white,
),
),
]
)
According to the image and code that you provide, things that come to my mind are:
1- Try to give width and height to SvgPicture.asset like this:
SvgPicture.asset(
iconSearch,
color: VisuColors.white,
width: 15,
height: 15,
),
2- Check the color that you gave to SvgPicture.asset, maybe it has something related to the color.
3- If these 2 solutions didn't solve your problem, check your SVG file and try to use another SVG file to see if the problem is with the file that you use. Because sometimes, the SVG files may be broken (size, color, formatting etc.).

how to create multiple radial bar inside each other?

I need to make a multiple radial bar inside each other. I searched but only syncfusion_flutter_charts package had some thing like that but I it needs licenses .There is no limitation on using other flutter packages.
the chart is some thing like this multiple radial bar
The best way to do this is to use a Stack widget together with Positioned Widgets. Examples with guides are found in the added links by the Flutter team itself.
What You can do is, use Stack widget to stack the Widgets and use to Wrap those widgets in Positioned widget to Passioned them the way you want inside the Stack.
Although I should mention heavy use of stack widget will have some performance impact.
using this way you can achieve it ( this is only a example , how to do it , it is not a implementation code ) ,
write code according to the use case , that is add alignment ,positioned ,etc...
stack(children: [
CircularPercentIndicator(
radius: 50.0,
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.purple,
.....
.....
),
CircularPercentIndicator(
radius: 100.0,
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.red,
.....
.....
),
CircularPercentIndicator(
radius: 150.0,
circularStrokeCap: CircularStrokeCap.round,
progressColor: Colors.blue,
.....
.....
),
])
actually I found the best way.CircularPercentIndicator has a center property which takes a widget. I gave it an another CircularPercentIndicator .this way worked perfect

Flutter: Remove brightness bar from flutter_colorpicker

I used the flutter_colorpicker package to implement a color picker in my app. My widget looks something like this:
ColorPicker(
pickerColor: ...,
paletteType: PaletteType.hueWheel,
onColorChanged: (color) {
...
},
enableAlpha: false,
labelTypes: const [],
)
In the UI it looks like this:
Now I want to remove the brightness bar on the bottom. I know that the color picker is not complete without that brighness bar but I will handle the brightness a different way. I have found no official documentation on how to achieve this.
How do I remove that bar? Hacks are also welcome or somehow extending the package with inheritance.
Here I attach some links which contains no brightnesss bar
Flutter Material Color Picker
Flex Color Picker
I have solved the problem by clipping away that bar using a ClipRect widget:
ClipRect(
child: Align(
alignment: Alignment.topCenter,
heightFactor: 0.75,
child: ColorPicker(
...
colorPickerWidth: 250,
),
),
);
I have not found any unwanted side effects with this approach yet.

Flutter | auto_size_text inside of Expanded FittedBox

Disclaimer:
I am very new to flutter, this is my first solo project that I am creating. All other projects have only been very short tutorials. The problem I am having (described below) may seem like a very easy fix, but as I am new please do explain it in detail as best you can, being able to visualize what you are saying also helps (through code, diagrams etc). Thank you.
Problem:
Unable to get auto_size_text maxLines to work correctly. On top of this, unable to get MaxFontSize working.
Further Explanation
I am using the auto_size_text package, setup with the pubspec.yaml dependency: auto_size_text: ^2.1.0 and import: 'package:auto_size_text/auto_size_text.dart'. I also changed my pubspec.yaml environment from sdk: ">=2.12.0 <3.0.0" to sdk: ">=2.11.0 <3.0.0" to allow non null safe packages to work - as per direction of this tutorial.
I am creating a container inside of my app, inside of this container is a Column widget, inside the Column widget are several rows. One of these rows is intended as a title. The code for it is below:
Row( // Row is inside of a Column which is inside of a Container
children: [
const SizedBox(width: 55), // Used to create padding either side of text
Expanded(
child: FittedBox(
child: AutoSizeText(
'70 | Brighton - Abbotsford and Green Island', // Header Example
maxLines: 2, // Cannot get this to work, always remains one line
maxFontSize: 20, // Does not work, always resizes to max font in order to fill whole FittedBox
style: TextStyle(
fontSize: 20, // Unsure if I need this, adding or removing seems to have to effect.
color: color.AppColor.textMain.withOpacity(0.8),
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(width: 55), // Used to create padding either side of text
],
),
With this code I get this result - Note that the blue line is another row above the title but still inside of the same Column widget.
Desired Result:
The font is far too small, so I want it to be split among two lines. I am designing this container to be reused and I will later change it so the text is imported from a CSV file so name lengths will be varied. They all need to be readable, and while it's fine for smaller titles (example), larger ones need to have a bigger font while still fitting inside the same boundaries, so two lines is required. As also mentioned, I am unable to get the maxFontSize working, resulting in shorter titles having too large of a font.
Attempted Solutions:
I have tired using a null safe version of auto_size_text but was unable to get it working (as it's a prerelease I assume it isn't functioning properly).
I have another solution without using auto_size_text package
SizedBox(
child: TextField(
controller: _yourController,
decoration: InputDecoration(
border: InputBorder.none,
contentPadding: EdgeInsets.all(8),
),
textInputAction: TextInputAction.done,
keyboardType: TextInputType.multiline,
maxLines: null,
),
),
keyboardType: TextInputType.multiline makes TextField can be resized automatically and move to new line if it reach max width, and
maxLines: null makes your text can be written with many lines, and then
decoration here i use to remove TextField box border
Solved
I solved my own problem almost accidently while playing around with the code I posted in the original question.
Solution:
Although not the most convenient, the solution is to replace the Expanded widget and FittedBox to a SizedBox. Below is the adjusted code including comments about changes made.
Row( // Row is inside of a Column which is inside of a Container
children: [
const SizedBox(width: 55), // Used to create padding either side of text
SizedBox( // Changed the Expanded and FittedBox to a sized box with a width of 280, source container has a width of 390, so text is allowed a width of 280 once you subtract the width 55 SizedBox's either side
width: 280,
child: AutoSizeText(
'70 | Brighton - Abbotsford and Green Island', // Header Example
maxLines: 2, // Cannot get this to work, always remains one line
maxFontSize: 20, // Does not work, always resizes to max font in order to fill whole FittedBox
style: TextStyle(
fontSize: 20, // Unsure if I need this, adding or removing seems to have to effect.
color: color.AppColor.textMain.withOpacity(0.8),
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(width: 55), // Used to create padding either side of text
],
),
Thanks

Flutter - Cartesian Charts - After a few minutes my chart starts to overwrite itself

I have an SfCartesianChart (Line-chart), which takes data from a bluetooth device. Works great for around 2/3 minutes. Then it starts plotting the data from the beginning again. Essentially overwriting the chart but leaving the existing data in place.
So rather than a continual left to right set of data points i get a line from the right side of the screen, back to the left about half way through the data reading.
Has anyone experienced this or is anyone able to offer some suggestions?
This is the widget that calls a _ChartData class and gets data from the streambuilder.
widget = Container(
height: 200,
child: SfCartesianChart(
zoomPanBehavior: _zoomPanBehavior,
borderColor: Colors.transparent,
onZoomEnd: (ZoomPanArgs args) {
print(args.currentZoomFactor);
print(args.currentZoomPosition);
},
borderWidth: 0,
primaryYAxis: NumericAxis(
title: AxisTitle(text: 'BPM'),
visibleMinimum: 45,
visibleMaximum: 90,
),
plotAreaBackgroundColor: Colors.transparent,
tooltipBehavior: TooltipBehavior(enable: true),
primaryXAxis: NumericAxis(
isVisible: false,
interval: 20,
// visibleMinimum: 45,
// visibleMaximum: 90,
autoScrollingMode: AutoScrollingMode.start),
series: <LineSeries<_ChartData, int>>[
LineSeries<_ChartData, int>(
color: Colors.red,
onRendererCreated:
(ChartSeriesController controller) {
seriesController = controller;
},
animationDuration: 0,
dataSource: chartData,
xValueMapper: (_ChartData data, _) => data.x,
yValueMapper: (_ChartData data, _) => data.y1),
]),
);```
Thanks for the interest in our Flutter charts. We have analyzed your query and the given code snippet and suspect that issue may be the setting of wrong visibleMinimum and visibleMaximum. By default, it will automatically calculate the range based on the data points and renders the chart correctly, so remove this or set proper values to them will resolve your issue. Also, ensure whether the chartData is getting proper data from the stream builder. Kindly contact us through our support forums, Direct-Trac, or feedback portal if you need any further assistance. We are always happy to assist you!