tools_box 0.1.3
tools_box: ^0.1.3 copied to clipboard
A comprehensive Flutter utility toolkit providing string manipulation, date formatting, widget extensions, form validation, and platform detection utilities. Includes convenient extension methods for [...]
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.
0.1.3 - 2026-05-26 #
Added - New Features #
ListUtils (List Operation Utilities)
firstOrDefault/lastOrDefault- Safe element access with defaultsunique- Remove duplicates while preserving orderchunked(int size)- Split list into chunks of specified sizegroupBy<K>(keyFn)- Group elements by key functionskipFirst/skipLast- Skip elements from start or endgetOrNull(index)- Safe index access with bounds checkingfindFirst(predicate)/findLast(predicate)- Find elements matching predicateswap(i, j)- Swap two elements in placecyclic(index)- Cyclic/wrapping element access- Numeric extensions:
sum,average,minValue,maxValue,median
NumUtils (Number Formatting & Operations)
formatWithCommas- Format number with thousand separatorstoCurrency({symbol})- Format as currency stringtoPercentage({decimalPlaces})- Convert to percentage stringformatNumber({decimalPlaces})- Format with decimal placesclampRange(min, max)- Clamp value within rangeisBetween(min, max)/isWithin(min, max)- Range checkingtoDurationString()- Convert seconds to human-readable durationtoFileSize()- Convert bytes to human-readable file sizeroundTo(decimalPlaces)- Round to specified decimal placesisPositive/isNegative/isZero/isNonZero- Sign checksisEven/isOdd- Parity checksdifferenceFrom(other)- Absolute difference calculationatMost(maxValue)/atLeast(minValue)- Value cappingtimes<T>(callback)- Repeat callback n times
ColorUtils (Color Conversion & Manipulation)
fromHex(hexString)- Parse hex string to ColortoHex({includeAlpha})- Convert Color to hex stringlighten(amount)/darken(amount)- Adjust color brightnessmix(color1, color2, ratio)- Blend two colors togetherwithOpacity(color, opacity)- Adjust alpha/opacitygetRed/getGreen/getBlue/getAlpha- Extract color componentsisDark(color)/isLight(color)- Luminance-based detectioncontrastingText(backgroundColor)- Get readable text colorrandom({minAlpha, maxAlpha})- Generate random colorstoHSL(color)/fromHSL(h, s, l)- HSL color space conversions- Color extension methods:
toHex(),lighten(),darken(),mixWith(), etc.
Documentation #
- Updated README.md with new utility APIs (English)
- Updated README.zh-CN.md with new utility APIs (Chinese)
- Added comprehensive examples for all new methods
Testing #
- Test coverage expanded for new utilities
0.1.2 - 2026-05-25 #
Added - New Features #
PlatformUtils (Platform Detection Utilities)
isWeb- Check if running on Web platformisAndroid- Check if running on Android platformisIOS- Check if running on iOS platformisMacOS- Check if running on macOS platformisWindows- Check if running on Windows platformisLinux- Check if running on Linux platformisFuchsia- Check if running on Fuchsia platformisMobile- Check if mobile device (Android or iOS)isDesktop- Check if desktop (macOS, Windows or Linux)platformName- Get platform name (English)platformNameCN- Get platform name (Chinese)operatingSystem- Get OS identifieroperatingSystemVersion- Get OS versioncurrentLocale- Get current system localelocalHostname- Get local hostnamenumberOfProcessors- Get CPU core countpathSeparator- Get path separatorisRelease/isDebug- Runtime mode detectionsupportsFileSystem()- File system support checksupportsNetworkSockets()- Network socket support checksupportsProcessInfo()- Process info support checkrunOnPlatform({...})- Execute callbacks per platform (no return value)runOnPlatformWithResult<T>({...})- Execute callbacks per platform (with return value)
Documentation #
- Updated README.md with PlatformUtils API documentation
- Updated Features list with platform detection features
Testing #
- Added PlatformUtils test cases (6 tests)
- Coverage for platform detection, name retrieval, and conditional execution
0.1.1 - 2026-05-23 #
Changed - Improvements #
Project Structure Optimization
- Renamed
example_appdirectory toexample(follows Flutter package conventions) - Added
.pubignorefile (optimized pub.dev publishing config) - Updated
.gitignorepath references - Updated all documentation path references (README.md, CODE_WIKI.md)
Documentation Improvements
- Reorganized README.md with clear API list format
- Each module shows source file link and Demo link
- Used code blocks for method names and descriptions
- Improved readability and search efficiency
- Updated CODE_WIKI.md directory references
- Updated CHANGELOG.md example app name
Package Publishing Configuration
- Resolved Pub validation warning: "checked-in files are ignored by .gitignore"
- Added .pubignore to exclude example directory (should not publish to pub.dev)
- Optimized package structure following Flutter package best practices
Dependencies #
- No new dependencies added
0.1.0 - 2026-05-23 #
Added - New Features #
StringUtils (String Utilities)
isEmail- Email format validationisPhoneNumber- Chinese phone number validationcapitalize- Capitalize first lettercapitalizeAllOf- Capitalize each word's first letterisNumeric- Check if numeric stringreverse- Reverse stringnullIfEmpty- Convert empty string to nulltruncate- String truncation (custom suffix support)removeWhitespace- Remove all whitespace charactersisURL- URL format validation
DateUtils (Date/Time Utilities)
formatDate- Date formatting (custom pattern support)formatDateTime- Date/time formattingtimeAgo- Relative time display (Chinese, e.g., 5 minutes ago, 2 hours ago)isToday- Check if todayisYesterday- Check if yesterdaystartOfDay- Get start of dayendOfDay- Get end of daydaysInRange- Generate date list in range
WidgetExtensions (Widget Extension Methods)
paddingAll- Equal padding on all sidespaddingSymmetric- Horizontal/vertical paddingonly- Custom direction paddingcenter- Center alignmentalign- Custom alignmentexpand- Expanded wrapperflexible- Flexible wrapperpositioned- Absolute positioningonTap- Add tap event handlersizedBox- Set dimensionsclipRRect- Rounded corner clippingdecorated- Add decoration (background, border, etc.)opacity- Set transparencysafeArea- Safe area wrapperhero- Hero animation tagtooltip- Tooltip messagevisible- Control visibility
BuildContextExtensions (BuildContext Extensions)
screenWidth- Get screen widthscreenHeight- Get screen heighttheme- Get ThemeDatatextTheme- Get TextThemecolorScheme- Get ColorSchemeisKeyboardVisible- Check keyboard visibilityhideKeyboard- Hide keyboardshowSnackBar- Show SnackBarpush- Page navigation (navigate)pop- Page return (go back)isDarkMode- Check dark mode
ValidationUtils (Form Validation Utilities)
isValidEmail- Email validity validationisValidPhone- Phone number validity validationisValidPassword- Password validity validation (min length support)isValidURL- URL validity validationisValidIDCard- ID card number validationisChinese- Chinese character detectioncontainsOnlyNumbers- Pure number detectioncontainsOnlyLetters- Pure letter detectioncontainsOnlyLettersAndNumbers- Letter and number detectionvalidateEmail- Form email validation (error message or null)validatePhone- Form phone number validationvalidatePassword- Form password validationvalidateRequired- Required field validation
Dependencies #
- Added
intl: ^0.19.0 || ^0.20.0for date formatting
Testing #
- Added 11 unit test cases
- Coverage of StringUtils, DateUtils, ValidationUtils core functionality
- All tests passed
Documentation #
- Complete README.md documentation
- Detailed usage examples and API documentation
- Development guide and contribution guide
- Created example application (example)
Project Setup #
- Updated pubspec.yaml configuration
- Set version to 0.1.0
- Added repository URL and issue tracker links
- Configured Dart SDK version requirement ^3.11.3
[Unreleased] #
Planned Features #
- ❌ ListUtils - List operation utilities
- ❌ NumUtils - Number processing utilities
- ❌ ColorUtils - Color conversion utilities
- ❌ CacheUtils - Cache management utilities
- ❌ SharedPreferences utility wrapper
- ❌ Network request utility wrapper
- ❌ More Widget extension methods
- ❌ Internationalization support (i18n)
Version Guide #
Version Number Rules #
- Major (X.0.0): Incompatible API changes
- Minor (0.X.0): Backward-compatible new features
- Patch (0.0.X): Backward-compatible bug fixes
Update Type Labels #
- Added: New features
- Changed: Changes to existing features
- Deprecated: Features to be removed soon
- Removed: Removed features
- Fixed: Bug fixes
- Security: Security fixes
Release History #
| Version | Date | Description |
|---|---|---|
| 0.1.3 | 2026-05-26 | Added ListUtils, NumUtils, ColorUtils utilities |
| 0.1.2 | 2026-05-25 | Added PlatformUtils platform detection utilities |
| 0.1.1 | 2026-05-23 | Project structure optimization, documentation improvements, package publishing configuration optimization |
| 0.1.0 | 2026-05-23 | Initial release with basic utility collection |