flutter_metrics 1.0.0 copy "flutter_metrics: ^1.0.0" to clipboard
flutter_metrics: ^1.0.0 copied to clipboard

outdated

This plugin is a plugin that applies the text size using the TextScaleFactor value.

Flutter Metrics #

pub

This plugin is a plugin that applies the text size using the TextScaleFactor value.

How to use #

First, wrap it with a MetricsApp widget.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await MetricsApp.ensureInitialized();

  runApp(
    MetricsApp(
      child: const MyApp(),
      defaultMetric: const Metric(1.0),
      metrics: const [
        Metric(0.5),
        Metric(1.0),
        Metric(2.0),
      ],
    ),
  );
}

Change Metric Value #

How to update metric values

Whenever the Metric value changes, we store it in SharedPreferences. Therefore, when the application is newly started, the saved value is read and applied.

context.setMetric(const Metric(0.5));

Apply Metric Value #

How to apply metric values

Text(
  'Lorem Ipsum is simply dummy text of the printing...',
  textScaleFactor: context.metric.value,
),

Example #

See example/lib/main.dart for details.

0
likes
0
points
37
downloads

Publisher

unverified uploader

Weekly Downloads

This plugin is a plugin that applies the text size using the TextScaleFactor value.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, shared_preferences

More

Packages that depend on flutter_metrics