Can not import font family - flutter

Hello everyone one i am trying to import a font family in my flutter project. I downloaded the ttf file and import it in the pubs pubspec.yaml like on the picture. I did pub get and get the following error: expected fonts to either be null or a list like on the picture. I also tried to add many assets but getting another error. I searched on Google about the error but found nothing. Please help mepuspec.yaml

You have to add a space between your dash and asset at line 44
YAML is a file format that is layout sensitive (see: https://www.cloudbees.com/blog/yaml-tutorial-everything-you-need-get-started)

Related

Search option in syncfusion_flutter_pdfviewer package flutter does not work

My goal is to use the search option on pdf, I found this package but I am having trouble using it, Do you have any suggestions for me?
1- TextSearchOption in syncfusion_flutter_pdfviewer package doesn't work (it's not defined).1
2- Another case is when I use this option ( Link ) in pdf but it doesn't work when I enter a text to search
1 - In order to TextSearchOption work, you need to import the syncfusion pdf. Add import "package:syncfusion_flutter_pdf/pdf.dart"; at the top of the file.
https://help.syncfusion.com/flutter/pdf-viewer/text-search
Import ‘package:syncfusion_flutter_pdf/pdf.dart’ in the Dart code if
you use the TextSearchOption parameter.
This will make the text inside the parenthesis to be searched: _pdfViewerController.searchText('the'). It will show all the "the" found in the pdf.
Here's a working example of the code you show on your picture.
2 - The link also gives an example of how to implement a search bar:
https://help.syncfusion.com/flutter/pdf-viewer/text-search#how-to-create-and-display-a-custom-search-toolbar-with-the-search-features

How do I upload Icons from material-ui?

I have run npm install using material-ui icons
npm install #material-ui/icons
and imported the search icon in my code but I have not getting any output.
import SearchIcon from "#material-ui/icons/Search";
when I call the search icon
<SearchIcon />
the program outputs a blank screen but without it the code works fine. Does anyone know why the icon is not showing?
This is my code if it helps
The icons are not exported as default on the Material UI library. Therefore you also shouldn't try to import them as default. Try something like this:
import { Search as SearchIcon } from "#mui/icons-material";

How do I use Font Awesome as a custom font in SwiftUI?

I have followed a number of tutorials in adding a custom font to my SwiftUI package. I have take the following steps:
Add Font Awesome 5 Free Solid-900.otf to my project.
Made sure that the font is copied and added to the target
Added the font file names to the Fonts provided by application array in Info.plist
Tried to get the font name
Tried a large number of permutations and combinations for the font name.
I tried the following:
Text(Text("\u{f071} Danger Will Robinson").font(.custom("Font Awesome 5 Free Regular", size: 20))
which is supposed to give me an alert icon, but all I get is a question mark.
Is there a trick to using Font Awesome in this way?
I know there are a few packages available, but I’m trying to learn more about the process itself, and I can’t see that it should be too hard.
OK, I worked it out.
For MacOS, the Info.plist key is: Application fonts resource path, not as above.
The next trick is to get the font name.
One method is to install the font, and then check FontBook. The PostScript name is the name I need.
The other is to run the following code:
let fontManager = NSFontManager.shared
let fonts = fontManager.availableFonts
for name in fonts {
print(name)
}
That’s what happens when all the tutorials are for iOS, not MacOS.

Flutter Unable to load asset

I could find this issue as quite common, but any of the suggestions didn't help me.
I want to simply show an image:
body: new Image.asset('rh.png',width:300,height:100),
You can see it is in the correct folder
It has correct place in pubspec.yaml
But I still get an error:
Unable to load asset: rh.png
I tried a lot of suggestions from github or stackoverflow, but none of them helped me; played with spaces and tabs in .yaml file (doing flutter clean after each attempt), tried to rename .png file and put it in the subfolder - no success. Where is the catch?
You didn't add assets with the filename:
Correct way is: new Image.asset('assets/rh.png', width:300, height:100)
Complete image path should be passed for fetching any asset file
in your case using assets/rh.png would resolve the error
The problem is with your path to your .png file.
It should address properly to the file location.
Correct form would be something like below:
new Image(image: AssetImage('assets/rh.png')),

Is window copyable in Flutter

I need copy data of window and add to clipboard. I searched and I found nothing.
I reiceved data from rest api with html tags and I use html view for render the html tag. that's why I can't selectable text.
How to copy data of window or body of stateful widget? Any idea?
If you want to copy text from your app, you can use the SelectableText widget. There was recently a Widget of the Week video on it here:
https://www.youtube.com/watch?v=ZSU3ZXOs6hc&vl=en
There isn't a way to copy images or other data except for text, as far as I know.
You can use the following package to capture a screenshot.
Add the following to install
dependencies:
screenshot: ^0.1.1
Then import it
import 'package:screenshot/screenshot.dart';
Example can be found here Screenshot Example
References
screenshot package