easy_typography

Creator: coderz1093

Last updated:

0 purchases

easy_typography Image
easy_typography Images

Languages

Categories

Add to Cart

Description:

easy typography

Easy Typography #
A easy way to use typography in flutter

Features #

Use Text Theme Styled Text with widgets, no need to pass context
Use Locale Keys instead of texts

Getting started #
You can start using just passing the text to one of the text widgets.
import 'package:easy_typography/easy_typography.dart';

class MyWidget extends StatelessWidget {
const MyWidget({super.key});

@override
Widget build(BuildContext context) {
return const Scaffold(
body: BodyLargeText('my text')
);
}
}
copied to clipboard
Usage #
Widget names #
Since we use the same names from the flutter TextTheme class, you can just use the same name.
We have the following widgets:

DisplayLargeText
DisplayMediumText
DisplaySmallText
HeadlineMediumText
HeadlineSmallText
TitleLargeText
TitleMediumText
TitleSmallText
BodyLargeText
BodyMediumText
BodySmallText
LabelLargeText
LabelSmallText

Parameters #
We also use the same parameters as the widget Text from 'package:flutter/material.dart', so if you need to customize, just pass the parameters as usual
Fit #
You can use the parameter fit, passing a BoxFit enum. When passing, the text will be wrapped by a FittedBox class
Locale #
You can use your locale using the parameter textKey or using the constructor DisplayLargeText.key.
import 'package:easy_typography/easy_typography.dart';

class MyWidget extends StatelessWidget {
const MyWidget({super.key});

@override
Widget build(BuildContext context) {
return const Scaffold(
body: DisplayLargeText.key('my_key')
);
}
}
copied to clipboard
To configure your locale, you need to implement the class TextLocale, using the method localize as your way to localize your text:
class MyLocale extends TextLocale {
@override
String localize(String key) {
return testText;
}
}
copied to clipboard
After that you just need to pass to your class to our singleton BaseTextLocale before you application starts:
import 'package:easy_typography/easy_typography.dart';

BaseTextLocale().setLocale(Locale());}
copied to clipboard
Additional information #
Since this package uses the Text be warned that if this class changes, the widgets names might change as well!

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.