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

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
120
pub points
0%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, shared_preferences

More

Packages that depend on flutter_metrics