0 purchases
web font loader
Web Font Loader #
You can use the interface directly:
import 'package:web_font_loader/web_font_loader.dart';
void main() {
load(Options(
google: GoogleFonts(families: [
'Lato'
])));
}
copied to clipboard
Use the service:
class MyComponent {
MyComponent(this._font);
final FontService _font;
void main() {
final family = GoogleFontFamilyImpl('Lato')
..styles.add(FontStyleImpl(family, 'Regular 400',
FontWeight.regular));
// can safely be called multiple times without
// downloading the fonts more than once
_font.use(family).then((ev) {
print('Font loaded!');
});
}
}
copied to clipboard
There is also a directive:
@Component(
//...
template: '<div [font-loader]="family">hello</div>',
directives: [FontLoaderComponent]
)
class MyComponent {
final family = GoogleFontFamilyImpl('Lato')
..styles.add(FontStyleImpl(family, 'Regular 400',
FontWeight.regular));
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.