From 97ea8a9af9245d330d1b7a855384c3e351491e6a Mon Sep 17 00:00:00 2001 From: fourleaf Date: Tue, 9 Jul 2024 11:51:34 +0800 Subject: [PATCH] refactory: Rename FormatFunction and Formatter in NumberBox to NumberBoxFormatFunction NumberBoxFormatter --- lib/src/controls/form/number_box.dart | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/src/controls/form/number_box.dart b/lib/src/controls/form/number_box.dart index c745f996..5a337360 100644 --- a/lib/src/controls/form/number_box.dart +++ b/lib/src/controls/form/number_box.dart @@ -9,9 +9,9 @@ import 'package:math_expressions/math_expressions.dart'; const kNumberBoxOverlayWidth = 60.0; const kNumberBoxOverlayHeight = 100.0; -typedef FormatFunction = String? Function(num? number); +typedef NumberBoxFormatFunction = String? Function(num? number); -abstract interface class Formatter { +abstract interface class NumberBoxFormatter { String format(dynamic number); } @@ -100,9 +100,9 @@ class NumberBox extends StatefulWidget { final num largeChange; /// The precision indicates the number of digits that's accepted for double - /// value. + /// value. /// - /// If set, [pattern], [formatter] and [format] must be `null`. + /// If set, [pattern], [formatter] and [format] must be `null`. /// /// Default is 2. final int? precision; @@ -110,20 +110,20 @@ class NumberBox extends StatefulWidget { /// The parttern for the number box. The pattern is used to format the number /// when the user inputs a value. /// - /// If set, [precision], [formatter] and [format] must be `null`. + /// If set, [precision], [formatter] and [format] must be `null`. final String? pattern; /// The formatter for the number box. The formatter is used to format the /// number when the user inputs a value. /// - /// If set, [pattern], [precision] and [format] must be `null`. - final Formatter? formatter; + /// If set, [pattern], [precision] and [format] must be `null`. + final NumberBoxFormatter? formatter; /// The format function for the number box. The format function is used to /// format the number when the user input a value. /// - /// If set, [pattern], [formatter] and [precision] must be `null`. - final FormatFunction? format; + /// If set, [pattern], [formatter] and [precision] must be `null`. + final NumberBoxFormatFunction? format; /// The minimum value allowed. If the user input a value below than min, /// the value is replaced by min. @@ -343,7 +343,7 @@ class NumberBoxState extends State> { // use dynamic to simulate duck typing late final dynamic _formatter; - late final FormatFunction _format; + late final NumberBoxFormatFunction _format; final controller = TextEditingController();