Skip to content

Commit

Permalink
feat: restore multiple checkbox and add missing properties
Browse files Browse the repository at this point in the history
  • Loading branch information
LeadcodeDev committed Oct 25, 2024
1 parent 04c9eef commit 3b492ef
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 2.2.3
- Add missing properties `select` in select commander entry
- Fix multiple behaviour instead of single behaviour in `checkbox` component
- Enhance `info` logger method

# 2.2.2
- Remove `createSpace` method in `ask` component

Expand Down
6 changes: 5 additions & 1 deletion lib/src/application/components/checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ final class Checkbox<T>

void _onSelect() {
if (_multiple) {
_selectedOptions.add(_currentIndex);
if (_selectedOptions.contains(_currentIndex)) {
_selectedOptions.remove(_currentIndex);
} else {
_selectedOptions.add(_currentIndex);
}
} else {
_selectedOptions.clear();
_selectedOptions.add(_currentIndex);
Expand Down
2 changes: 2 additions & 0 deletions lib/src/commander.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ class Commander with TerminalTools {
{T? defaultValue,
required List<T> options,
String placeholder = '',
int displayCount = 5,
String Function(T)? onDisplay}) =>
Select<T>(_terminal,
message: message,
defaultValue: defaultValue,
displayCount: displayCount,
options: options,
placeholder: placeholder,
onDisplay: onDisplay)
Expand Down
10 changes: 9 additions & 1 deletion lib/src/domains/models/commander_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ final class CommanderTheme {
}

String infoFormatter(String? message) {
final buffer = StringBuffer()..writeAnsi(Print(' $message'));
final buffer = StringBuffer()
..writeAnsiAll([
SetStyles(Style.foreground(Color.green)),
Print('ℹ'),
SetStyles.reset,
Print(' $message'),
SetStyles.reset,
]);

return buffer.toString();
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: commander_ui
description: Commander is a Dart library for creating user interfaces within the terminal.
version: 2.2.2
version: 2.2.3
repository: https://github.com/LeadcodeDev/commander

topics:
Expand Down

0 comments on commit 3b492ef

Please sign in to comment.