How to draw a text inside a path in flutter - flutter

I want to draw a text inside a path in flutter. In android, the requirement can be achieved by using canvas.drawTextOnPath(). But in flutter, I didn't find any method to draw the text inside a path.
expected output:

I have created a package to achieve this in Flutter.
Link: draw_on_path: used to draw text or pattern along the given path.
Just use
canvas.drawTextOnPath(text, path);
There is an optional parameter for TextStyle and other customization.

Related

Create Vertical List in Flutter

I want to create this type of listview using flutter.
https://dribbble.com/shots/6872462-Food-ordering-app-Animate
You can find out more by clicking on this link. But I don't know how to create this type of list. I mean, you can see in the GIF that the list is indexed based.
A fixed indexed item container is colored.
How can I achieve it?
Flutter provides you with a widget very similar to the result you want to achieve called NavigationRail.
You will not have the animation by default, but you can maybe search in the source code of this widget how to create a custom widget that will implement animations.

How to edit flutter_clean_calendar package?

So i want to customize some widget in this package. I want to change selectedDay(the big red circle) size.
So i go to it's definition and try to change it. I just need to add some width as argument to Container, but i can't.
I also try to wraps widget by using the bell icon, but it doesn't work. I can't choose any widget, other than getX
I try to type, but no option shows up
My flutter plugins work just fine in other file. So is it mean that i can't edit or add any widget in lib file? How to edit this file?

How to add rounded border to the CircularProgressIndicator in Flutter?

I would like achieve the corners for the progress indicator as per above image.
Adding rounded border to the LinearProgressIndicator can be done easily but it's not the same with CircularProgressIndicator as there is no support given in the flutter library yet.
This has been raised here and the solution given by the flutter team is here.
So here we can have a clean and custom solution for this issue i.e just add the ..strokeCap = StrokeCap.round to the default CircularProgressIndicator class.
Copy the source code for classes CircularProgressIndicator and ProgressIndicator to a separate file into your code repository and add the strokeCap value as per your requirement in _CircularProgressIndicatorPainter.
There you go. you have the indicator as expected in the above image.
There r some packages but if u wanna do it manually. Take a look this drive-link. I did it manually. U can change it as u want to. [here's]
You can make use of this curved_progress_bar package. Or if you want to design it manually then you can look into the source code of the package here curved_progress_bar - GitHub

How to draw pdf content in flutter canvas

I'm using Flutter with pdf package. In the readme it says use printing to show pdf in app.
However, I want to draw in front of the pdf content(taking notes/make annotations). So I guess I have to draw pdf content in my CustomPaint widget to get more control to it.
I searched around and didn't found any useful experience. Please let me know it my approach is correct/reasonable and if there's any better approach.
Thanks!
I think the part of the README you're talking about is this one :
Use the printing package https://pub.dev/packages/printing for full
flutter print and share operation.
This printing package is meant for printing to a real printer.
The pdf package you're using is only meant for creating a pdf in a flutter application, not for displaying it as a widget.
What you want to achieve is to display a pdf and annote on top of it. Your approach is a correct one:
Use a CustomPainter
Add a PDF widget as its child
Paint your annotations on the foreground painter.
To display a pdf as a widget you'll need another package like advance_pdf_viewer.
Painting on the foreground painter is important because as stated in the CustomPaint class documentation:
When asked to paint, CustomPaint first asks its painter to paint on
the current canvas, then it paints its child, and then, after painting
its child, it asks its foregroundPainter to paint.
The code should look like :
PDFDocument doc = await PDFDocument.fromAsset('assets/test.pdf');
return CustomPaint(
child: PDFViewer(doc: document)),
foregroundPainter: AnnotationsPainter(),
);

Flutter box decoration in a container

How can I use svg image in a container's box decoration? Seems it only allows the png/jpg files in AssetImage(). I am trying to display two images on top of the background image set through the box decoration. I am trying to dodge the method of stack. So is there a way?
Flutter has no inbuilt support for SVG as of now..
But you can try this package -> https://pub.dev/packages/flutter_svg
final Widget svg = new SvgPicture.asset(
"assets/image.svg",
);
However, I'd recommend not using an SVG, instead convert your image to a png format