appcraft_phone_util_flutter 1.2.2
appcraft_phone_util_flutter: ^1.2.2 copied to clipboard
Flutter library for phone number parsing, validation, formatting, country detection (200+ countries) and input masking via ACPhoneInputFormatter and ACPhoneEditingController.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased] #
1.2.2 #
Fixed #
.github/workflows/publish.ymltrigger pattern wasv[0-9]+.[0-9]+.[0-9]+*but the package convention uses bare semver tags (e.g.,1.2.0, notv1.2.0). With the original pattern, pushing a release tag would not trigger the publish workflow. Trigger updated to[0-9]+.[0-9]+.[0-9]+*.verify-versionjob no longer strips a leadingvfrom the tag name (TAG="${GITHUB_REF_NAME}"instead ofTAG="${GITHUB_REF_NAME#v}") — tag is now compared topubspec.yaml:versionexactly.
1.2.1 #
Fixed #
- Dangling library doc comment in
lib/src/presentation/ac_phone_presentation.dartcausing pub.dev static analysis penalty (analyzer infodangling_library_doc_comments). Resolved by adding an unnamedlibrary;directive after the doc-comment block. CHANGELOG.mdnon-ASCII content causing the pub.dev «Provide a valid CHANGELOG.md» score to drop to 0/5. All historical entries translated to English (ASCII-only).
Changed #
CHANGELOG.mdfully translated to English. Dates removed from version headings: format is now## [X.Y.Z]instead of## [X.Y.Z] - YYYY-MM-DD. Git log remains the source of truth for release dates.- Minimum Dart SDK constraint bumped from
>=2.14.0to>=2.19.0. Required by the unnamedlibrary;directive used to attach the library-level doc comment inac_phone_presentation.dart.
Internal #
- Added
.github/workflows/publish.ymlfor automated publishing to pub.dev on git tag push. Uses OIDC authentication via the reusabledart-lang/setup-dart/.github/workflows/publish.yml@v1workflow; no long-livedPUB_TOKENsecret required. Pre-publish steps rundart analyze --fatal-infos --fatal-warningsandflutter test; the version inpubspec.yamlis verified to match the pushed tag. - Added regression test
test/changelog_ascii_test.dartenforcing non-ASCII ratio < 5% inCHANGELOG.md. Prevents future reintroduction of non-English content into the changelog.
1.2.0 #
Added #
- Exported
ACPhoneCountriesclass fromac_phone_util.dart— public access to the supported countries registry (ACPhoneCountries.instance.all,.instance.hashedCountries). Previously the class was only accessible throughlib/src/.
Fixed #
- Analyzer info
include_file_not_foundforpackage:flutter_lints/flutter.yamlinexample/: addedflutter_lints: ^3.0.0todev_dependenciesofexample/pubspec.yaml. dart pub publish --dry-runwarning «checked-in files are ignored by a .gitignore»:pubspec.lockremoved from git index (library convention — lockfile is not committed);.vscode/removed from.gitignore(launch.json is committed for the team), excluded from the published package via the new.pubignore.
- Lint
implementation_importsinexample/lib/national_phone_demo_page.dart: import switched to the public entry-point afterACPhoneCountrieswas exported.
Notes #
- Existing imports
import 'package:appcraft_phone_util_flutter/ac_phone_util.dart';continue to work. - Library runtime behavior is unchanged — only the public API is extended and the dev environment + publish pipeline are fixed.
1.1.1 #
Added #
LICENSEfile (MIT) at the package root — required for publication on pub.dev.lib/appcraft_phone_util_flutter.dart— canonical entry-point matching the package name. Equivalent to the existinglib/ac_phone_util.dart(re-export).
Changed #
pubspec.yaml: addedrepository,homepage,issue_tracker,topicsfields.pubspec.yaml:descriptionexpanded — accurately reflects the package functionality (parsing, validation, formatting, country detection, input masking).README.md: installation viaflutter pub addis now the primary instruction; the git source is kept as secondary## From source.
Notes #
- Existing imports
import 'package:appcraft_phone_util_flutter/ac_phone_util.dart';continue to work without changes — backward compatibility is guaranteed by the smoke testcanonical_entry_point_test.dart. - Runtime behavior is unchanged — only metadata and the publish artifact structure. First publication on pub.dev.
1.1.0 #
Added #
- Public contract for
ACPhoneInputFormatter: explicit digits-only filtering guarantee — non-digit characters (letters, emoji, punctuation, unicode whitespace) are dropped on input and paste.FilteringTextInputFormatter.digitsOnlyis no longer required alongsideACPhoneInputFormatter.
Changed #
ACPhoneEditingController: whentextchanges, automatically replaces the trunk-prefix digits with the digits of the actualphoneCodeof the detected country. For example, entering89008007060without a formatter producestext = '79008007060'(country = RU); withACPhoneInputFormatter(mask: '+# (###) ###-##-##')—+7 (900) 800-70-60. The replacement is surgical: it touches only the first N digit characters (N = length of the digits version ofphoneCode), preserves the mask/separators and the cursor position by digit-count. For numbers where the trunk-prefix already matchesphoneCode(+79...,+380...), the rewrite is not invoked. Masking remains entirely the responsibility of the formatter.example/lib/national_phone_demo_page.dart: removed redundantFilteringTextInputFormatter.digitsOnlyfrominputFormatters— demonstrates simplified integration.
Fixed #
ACPhoneInputFormatter: backspace on a mask separator ((,),-, space) now removes the preceding digit — fixes editing stalls on formatted numbers.ACPhoneEditingController: automatic removal of a lone+when the last digit of the number is erased.ACPhoneInputFormatter: trimming of trailing separators after the last digit — eliminates stalls when deleting (+7, +7 (900) and similar partial states).
Refactored #
ACPhoneEditingController:_isRewritingreplaced with_lastText— memo-guard plus saving onfindPhonewhen only the selection changes.
1.0.0 #
BREAKING CHANGES #
ACPhoneInputFormatter: parameterscountryandonPhoneChangedremoved. The formatter now takes a single required parametermask: String. Auto-detection of the country is no longer built into the formatter — useACPhoneEditingController(auto-detect) orACNationalPhoneEditingController(with an explicit country).ACPhoneCountry.telMaskrenamed tonationalMask. Behavior changed: parentheses and dashes are now preserved. For the old behavior (without parentheses and dashes) use the newrawNationalMask.
Added #
ACPhoneCountry.rawMask— full mask without(,),-; separator is space only.ACPhoneCountry.rawNationalMask— national mask without(,),-.ACNationalPhoneEditingController— input controller for the national part of the number with an externally provided country (countryvia constructor and setter).rawPhoneNumberreturns the full number,isValidvalidates viaACPhoneUtil.- Example application updated: two separate demo pages
(
auto_detect_demo_page.dart,national_phone_demo_page.dart) with navigation from the home screen.
Migration #
// BEFORE (0.0.1)
ACPhoneInputFormatter(country: country, onPhoneChanged: (d) => ...);
// AFTER (1.0.0) — full number
ACPhoneInputFormatter(mask: country.mask);
// AFTER — national part only
ACPhoneInputFormatter(mask: country.nationalMask);
0.0.1 #
Added #
- Phone number parsing and validation (
ACPhoneUtil) - Country detection by phone code with 200+ countries
- Localized country names in 36 languages (
ACPhoneCountryLocalizations) - Phone number input formatter (
ACPhoneInputFormatter) with auto-detection and fixed mask modes - Phone editing controller (
ACPhoneEditingController) with phone data access and validation - Example application demonstrating library usage