penta_core 3.0.0
penta_core: ^3.0.0 copied to clipboard
Core toolkit for Flutter apps: namespaced extensions, spacing tokens, result models, use case contracts, JSON localization, toast, showcase, responsive layout and an international phone field.
Changelog #
3.0.0 #
Full rework of the package. Requires Dart 3.8 / Flutter 3.32.
Breaking changes and migration #
- Single entry point. Import only
package:penta_core/penta_core.dart. Theindex.dartbarrel files and themanagers/folder were removed. - Extensions are now zero-cost extension types. Usage through
.extis unchanged, but the public type names changed (ContextExtension+ContextExt,StringExtension+StringExt...).context.ext.seperateGenerator(list, sep)→list.ext.separatedBy(sep)(deprecated alias kept)list.ext.firstOrNull(test)→firstWhereOrNull(test)(deprecated alias kept)list.ext.orderWithData(cmp)→sorted(cmp)(deprecated alias kept)map.ext.removeWhere(test)→whereNot(test)(deprecated alias kept)formatShortmoved frominttonum.
- AppValues:
AppValuesConfigis now an immutable value class.AppValuesConfig.initialize(md: 14)→AppValues.configure(const AppValuesConfig(md: 14))(deprecated alias kept). - Localization
LocaleManageris no longer generic; the notifier type is the publicLocaleController<T>.LocaleManager.I.notifier→controller.LocaleManagerProvideris now aStatefulWidgetthat owns its controller (LocaleManagerProvider.createstill works). The locale is no longer reset when a parent rebuilds.context.localeManagerNotifierReadno longer subscribes to changes. UselocaleManagerNotifierWatch, or thetranslate*(context)helpers, inbuild.- The
<T extends Enum>type parameter was removed fromtranslate,trand the related helpers. - The generator emits
static const Stringfields instead of getters and sanitizes keys that are not valid identifiers.
- WidgetStateMixin: the state type is public now (
ViewState<S>withViewStateIdle/Busy/Success/Fail).ViewState.whenis generic. - ResponseModel: the duplicate
foldextension andResponseModelExtensionwere removed.castTois now a method ofResponseModelFail. - Toast
PentaToastShowOptions:dissmissAll→dismissAll,dissmissable→dismissible, unusedstackCountremoved, newdismissOnTap.optionsis optional inshowandshowText.PentaToastConfig.customAnimationreceives the animation:(child, animation) => ....PentaToastController.I.dispose()→dismissAll(),dismissAndShowNext()→dismiss()(deprecated aliases kept).
- Phone field
PentaPhoneFieldCountryCodesEnumcarriesisoCode,dialCode,minLength,maxLength,flag,countryName()andinfo().- The unused
PentaPhoneFieldContainerConfigwas removed. - A
phoneNumber.customBuilderresult is now wrapped inExpanded.
- Responsive: breakpoints come from the nearest
PentaResponsiveWrapper(PentaBreakpoints). Static breakpoint getters return the defaults. - Showcase:
PentaShowcaseOverlayWrapperisconstand keeps its info key in its state. - Others:
EmailValidationConstants→disposableEmailDomains(Set).PentaDebouncer.debouncereturnsFuture<S?> Function(T).PentaEventBus.destroy()returns aFuture.IPentaCache/IPentaRouterare unchanged. - The unused
build,source_gen,pathandbuild_runnerdependencies were removed.
Bug fixes #
Color.ext.toMaterialColorlooped forever and produced wrong shades.String.ext.random*threw aRangeError(nextIntlimit).validPhoneWithPluscontained a stray character and rejected valid numbers; e-mail validation no longer rejects TLDs longer than 4 letters.- Duplicate entries in the disposable domain list; the lookup is now O(1).
TimestampConverter.convertToDateTimeUTCreturned local time.ImageStringConvertertreateddata:URIs as files and failed to decode them. It now also works on web.LoadingCallbackDialogleft the dialog open when the future threw, could pop the wrong route, and showed a cancel button whencancelablewas false.LocaleManagerProvider.maybeOfthrew when no provider was present.translateWithNamedArgsreplaced only the first occurrence of a placeholder.WidgetStateMixin.executeStatecrashed afterdispose; exceptions are now reported as a fail state.PentaResponsiveWrappercustom breakpoints were silently ignored, anddeviceSizeused physical instead of logical pixels.PentaResponsiveWidgetnever removed its binding observer.- The showcase recreated its
GlobalKeyon every build, and the arrow painter never cancelled its event bus subscription. PentaUnderlineTextleaked tap recognizers and ignored text scaling and RTL.- Toast:
boxShadowandmaxToastswere ignored,copyWithdroppedcustomAnimation, the animation controller outlived its widget, and showing a toast beforePentaToastwas mounted crashed. - Phone field: changing
languageCodehad no effect, thedropdownselection type did nothing,keyboardTypewas ignored, and colors were hard-coded instead of coming from the theme. FirebaseExceptionConverterignored locales without a country code;invalid-credentialis now recognized.
Added #
ResponseModel.success/fail/guard,dataOrNull,errorOrNull,map,then, equality.ErrorModel.code/error/stackTrace,fromException,copyWith.- Context:
padding,viewInsets,isKeyboardOpen,orientation,widthPercent,navigator,messenger,unfocus... - Extensions:
chunked,distinctBy,groupBy,getOrNull,withoutNulls,getAs,remap,isBetween,capitalized,titleCase,toIntOrNull,isDisposableEmail,lighten/darken,toHex,onColor,startOfDay,endOfDay,isToday,isTomorrow,isYesterday,DateTimeLabels,Uint8List.ext.toDataUri, widgetexpanded/flexible/align/onTap/opacity. AppValues.x.ext.gap,sizedBox.square, start/end directional paddings.PentaResponsiveSizeTypes.parentConstraints,PentaBreakpoints,PentaResponsiveWrapper.value.LocaleController.fallbackLocale,hasKey,LocaleManager.loadFromMap.PentaPhoneFieldStringsto override texts,focusNode,autovalidateMode.PentaDebouncerinstance API,PentaEventBus.on<S>().- Test suite (60 tests).
2.1.0 #
- Fixed localization arguments.
- Added contextless translation methods:
- tr(): Translate using the globally registered notifier (no BuildContext).
- trWithArgs(List
- trWithNamedArgs(Map<String, String> args): Translate with named arguments using the globally registered notifier.
2.0.0 #
- Toast: Toast notification widget for displaying brief messages to users
- Showcase Tutorial Widget: Widget for creating interactive onboarding tutorials and feature highlights
- Extension formats updated: All extensions now use the simplified value.ext.x format instead of value.ext.category.x for easier and more intuitive usage
1.1.0 #
- International Phone Input: Complete phone number input with country selection
- Multi-language Support: Built-in support for 25+ languages
- Country Flag Display: Visual country flags with customizable display options
- Phone Number Validation: Built-in validation with customizable patterns
- Country Code Selection: Dropdown with searchable country list
- Customizable Layout: Flexible layout configuration options
- Callbacks Support: Comprehensive callback system for user interactions
- Text Widgets: Enhanced text widgets with underline support (PentaUnderlineText)
- SizedBox Widgets: Convenient spacing widgets (Gap widget for consistent layouts)
- Field Widgets: Organized field widget structure for better maintainability
- Cache Service: Renamed interface from ICache to IPentaCache for consistency
- Router Service: Renamed interface from IRouter to IPentaRouter for consistency
- Enhanced Utilities: Improved Firebase exception converter and loading dialog
- Updated README: Comprehensive documentation with usage examples
- Improved Constants: Enhanced app values and email validation constants
- Better Organization: Reorganized extension structure and removed unused object extensions
- Locale Manager: Enhanced locale management capabilities
- Fixed interface naming consistency across services
- Improved extension organization and removed deprecated components
- Enhanced locale manager functionality
- Updated pubspec.yaml with improved dependencies
- Enhanced example application with phone field demonstration
1.0.2+1 #
- Fixed version number consistency in pubspec.yaml and CHANGELOG.md
1.0.2 #
- Responsive Layout: PentaResponsiveWidget and PentaAdaptiveWidget for responsive design
- Layout Widgets: Padding, SizedBox, and layout management widgets
- Adaptive Widgets: Platform-specific widget rendering (Android, iOS, Web)
- String Extensions: Validation, conversion, random generation, and formatting
- DateTime Extensions: Formatting, calculation, comparison, and conversion utilities
- List & Map Extensions: Sorting, filtering, manipulation, and search operations
- Context Extensions: Screen information, theme access, and widget context utilities
- Number & Int Extensions: Math operations, formatting, and conversions
- Color Extensions: Material colors and color manipulation
- Widget Extensions: Sliver widgets and widget manipulation
- App Values Extensions: Padding, radius, and SizedBox utilities
- Bool Extensions: Boolean operations and operators
- Iterable Extensions: Iterable manipulation and filtering
- Uint8List Extensions: Binary data conversion utilities
- Object Extensions: Object manipulation and filtering
- Cache Service: Interface for caching operations
- Router Service: Navigation and routing interface
- Connectivity Service: Internet connection checking
- PentaDebouncer: Input debouncing utilities
- PentaEventBus: Application-wide event management
- LoadingCallbackDialog: Callback-based loading dialogs
- FirebaseExceptionConverter: Firebase error message conversion
- ImageStringConverter: Image loading with error handling
- TimestampConverter: Timestamp conversion utilities
- Response Models: Standardized API response handling
- Error Models: Comprehensive error handling and management
- Use Case Models: Clean architecture use case patterns for different scenarios
- Object Models: Base models with ID support
- Material Models: Material design color utilities
- State Mixins: Safe state management for widgets
- Repository Mixins: Data repository patterns for clean architecture
- Widget State Mixins: Widget-specific state management
- Locale Manager: Complete locale management system with provider support
- Locale Manager Extension: Extension methods for locale management
- Locale Manager Notifier: State management for locale changes
- Locale Manager Provider: Provider-based locale management
- App Values: Centralized application constants for consistent spacing
- Email Validation: Email validation constants and patterns
- Language Generator: CLI tool for generating locale keys from JSON files
- Fixed vertical padding calculation in _PaddingAppValuesExt
- Improved timeWhen method to correctly identify 'Today' condition
- Added UTC normalization for date extensions
- Updated README.md for consistency and clarity
- Added comprehensive package description
- Created initial CHANGELOG.md structure
- Added homepage and repository fields to pubspec.yaml
- Updated lang_generator executable path in pubspec.yaml
- Added timeWhen method for improved date formatting