easy_typography 0.1.3 copy "easy_typography: ^0.1.3" to clipboard
easy_typography: ^0.1.3 copied to clipboard

A easy way to use typography with handfull, Text like, widgets.

Easy Typography #

A easy way to use typography in flutter

tests

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')
    );
  }
}

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')
    );
  }
}

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;
  }
}

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());}

Additional information #

Since this package uses the Text be warned that if this class changes, the widgets names might change as well!

2
likes
120
pub points
32%
popularity

Publisher

unverified uploader

A easy way to use typography with handfull, Text like, widgets.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on easy_typography