Skip to content

Commit

Permalink
https://github.com/archethic-foundation/archethic-wallet/issues/920
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Mar 17, 2024
1 parent 4c60794 commit 97d15b5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/ui/views/add_account/bloc/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AddAccountFormNotifier extends AutoDisposeNotifier<AddAccountFormState> {
String name,
) async {
state = state.copyWith(
name: name.trimLeft().trimRight(),
name: name,
);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/views/contacts/bloc/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ContactCreationFormNotifier
);

void setName(String name, BuildContext context) {
state = state.copyWith(name: name.trimLeft().trimRight(), error: '');
state = state.copyWith(name: name, error: '');
}

void setAddress(String address, BuildContext context) {
Expand Down
21 changes: 10 additions & 11 deletions lib/ui/views/nft_creation/bloc/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,12 @@ class NftCreationFormNotifier
final propertiesToSet = [...state.properties]
..removeWhere(
(element) =>
element.propertyName.trimLeft().trimRight().toUpperCase() ==
propertyName.trimLeft().trimRight().toUpperCase(),
element.propertyName.toUpperCase() == propertyName.toUpperCase(),
)
..add(
NftCreationFormStateProperty(
propertyName: propertyName.trimLeft().trimRight(),
propertyValue: propertyValue.trimLeft().trimRight(),
propertyName: propertyName,
propertyValue: propertyValue,
),
)
..sort((a, b) => a.propertyName.compareTo(b.propertyName));
Expand All @@ -420,26 +419,26 @@ class NftCreationFormNotifier
return;
}

state = state.copyWith(name: name.trimLeft().trimRight(), error: '');
setProperty('name', name.trimLeft().trimRight());
state = state.copyWith(name: name, error: '');
setProperty('name', name);
}

void setSymbol(String symbol) {
state = state.copyWith(symbol: symbol.trimLeft().trimRight(), error: '');
state = state.copyWith(symbol: symbol, error: '');
}

void setInitialSupply(int initialSupply) {
state = state.copyWith(initialSupply: initialSupply, error: '');
}

void setDescription(String description) {
state = state.copyWith(description: description.trimLeft().trimRight());
setProperty('description', description.trimLeft().trimRight());
state = state.copyWith(description: description);
setProperty('description', description);
}

void setPropertyName(String propertyName) {
state = state.copyWith(
propertyName: propertyName.trimLeft().trimRight(),
propertyName: propertyName,
error: '',
);
}
Expand All @@ -452,7 +451,7 @@ class NftCreationFormNotifier

void setPropertyValue(String propertyValue) {
state = state.copyWith(
propertyValue: propertyValue.trimLeft().trimRight(),
propertyValue: propertyValue,
error: '',
);
}
Expand Down
10 changes: 4 additions & 6 deletions lib/ui/views/tokens_fungibles/bloc/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,15 @@ class AddTokenFormNotifier extends AutoDisposeNotifier<AddTokenFormState> {
return;
}

if (kTokenFordiddenName
.contains(name.trimLeft().trimRight().toUpperCase())) {
if (kTokenFordiddenName.contains(name.toUpperCase())) {
state = state.copyWith(
errorNameText: AppLocalizations.of(context)!.tokenNameUCO,
);
return;
}

state = state.copyWith(
name: name.trimLeft().trimRight(),
name: name,
);
_updateFees(
context,
Expand Down Expand Up @@ -202,16 +201,15 @@ class AddTokenFormNotifier extends AutoDisposeNotifier<AddTokenFormState> {
return;
}

if (kTokenFordiddenName
.contains(symbol.trimLeft().trimRight().toUpperCase())) {
if (kTokenFordiddenName.contains(symbol.toUpperCase())) {
state = state.copyWith(
errorSymbolText: AppLocalizations.of(context)!.tokenSymbolUCO,
);
return;
}

state = state.copyWith(
symbol: symbol.trimLeft().trimRight(),
symbol: symbol,
);
_updateFees(
context,
Expand Down

0 comments on commit 97d15b5

Please sign in to comment.