Last updated:
0 purchases
flutter metrics
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),
],
),
);
}
copied to clipboard
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));
copied to clipboard
Apply Metric Value #
How to apply metric values
Text(
'Lorem Ipsum is simply dummy text of the printing...',
textScaleFactor: context.metric.value,
),
copied to clipboard
Example #
See example/lib/main.dart for details.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.