Skip to content

Commit f8e669b

Browse files
PHKennyclaude
andauthored
Release v7.5.11: Improve password input requirements validation (#115)
- Refactored ThemedPasswordInput to use .entries for cleaner iteration - Improved performance by eliminating redundant map lookups - Updated version to 7.5.11 - Added changelog entry Technical changes: - Changed from requirements.keys with lookups to requirements.entries - Replaced requirements[requirement]! with entry.value - More idiomatic Dart code following modern best practices Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 parents 95b142f + 7520301 commit f8e669b

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 7.5.11
4+
5+
- Improved `ThemedPasswordInput` requirements validation logic to use `.entries` for cleaner iteration and better performance.
6+
37
## 7.5.10
48

59
- Renamed `tools/` to `tool/` as suggestion of the Dart team to follow the standard convention for Dart CLI tools.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ packages:
374374
path: ".."
375375
relative: true
376376
source: path
377-
version: "7.5.10"
377+
version: "7.5.11"
378378
leak_tracker:
379379
dependency: transitive
380380
description:

lib/src/inputs/src/general/password_input.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ class _ThemedPasswordInputState extends State<ThemedPasswordInput> {
102102
/// [_matches] is the list of regular expressions that match the requirements met by the current password value.
103103
Map<String, bool> get _matches {
104104
final matches = <String, bool>{};
105-
for (final requirement in requirements.keys) {
106-
matches[requirements[requirement]!] = requirement.hasMatch(widget.value ?? '');
105+
for (final entry in requirements.entries) {
106+
matches[entry.value] = entry.key.hasMatch(widget.value ?? '');
107107
}
108108
return matches;
109109
}
@@ -187,23 +187,23 @@ class _ThemedPasswordInputState extends State<ThemedPasswordInput> {
187187
),
188188
richMessage: TextSpan(
189189
children: [
190-
for (final requirement in requirements.keys) ...[
190+
for (final entry in requirements.entries) ...[
191191
WidgetSpan(
192192
child: Padding(
193193
padding: const EdgeInsets.all(5),
194194
child: Row(
195195
mainAxisSize: MainAxisSize.min,
196196
children: [
197197
Icon(
198-
_matches[requirements[requirement]!]!
198+
_matches[entry.value]!
199199
? LayrzIcons.solarOutlineCheckCircle
200200
: LayrzIcons.solarOutlineCloseCircle,
201201
size: 16,
202-
color: _matches[requirements[requirement]!]! ? Colors.green : Colors.red,
202+
color: _matches[entry.value]! ? Colors.green : Colors.red,
203203
),
204204
const SizedBox(width: 8),
205205
Text(
206-
_translate(requirements[requirement]!),
206+
_translate(entry.value),
207207
style: Theme.of(context).textTheme.bodySmall?.copyWith(
208208
color: validateColor(color: Theme.of(context).scaffoldBackgroundColor),
209209
),

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: layrz_theme
22
description: Layrz standard styling library for Flutter. Widget library following the Material Design 3 guidelines, with a focus on reliavility and functionality.
3-
version: "7.5.10"
3+
version: "7.5.11"
44
homepage: https://theme.layrz.com
55
repository: https://github.com/goldenm-software/layrz_theme
66

0 commit comments

Comments
 (0)