flutter_metrics 1.0.0 flutter_metrics: ^1.0.0 copied to clipboard
This plugin is a plugin that applies the text size using the TextScaleFactor value.
Flutter Metrics #
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.