Skip to content

Commit

Permalink
refactory: Rename FormatFunction and Formatter in NumberBox to Number…
Browse files Browse the repository at this point in the history
…BoxFormatFunction NumberBoxFormatter
  • Loading branch information
FourLeafTec committed Jul 9, 2024
1 parent 346d251 commit 97ea8a9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/src/controls/form/number_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -100,30 +100,30 @@ class NumberBox<T extends num> 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;

/// 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.
Expand Down Expand Up @@ -343,7 +343,7 @@ class NumberBoxState<T extends num> extends State<NumberBox<T>> {

// use dynamic to simulate duck typing
late final dynamic _formatter;
late final FormatFunction _format;
late final NumberBoxFormatFunction _format;

final controller = TextEditingController();

Expand Down

0 comments on commit 97ea8a9

Please sign in to comment.