Skip to content

Commit

Permalink
Merge a067cee into c7e710a
Browse files Browse the repository at this point in the history
  • Loading branch information
albertms10 committed Feb 8, 2024
2 parents c7e710a + a067cee commit d085c18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/src/utils/string_extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extension StringExtension on String {
static final _wordsRegExp = RegExp(r'([a-zA-Zà-üÀ-Ü·\[\] -])*');

String get stripNumbers => _wordsRegExp.stringMatch(this) ?? '';
}
3 changes: 2 additions & 1 deletion lib/src/widgets/collection_avatar.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:el_meu_diec/model.dart';
import 'package:el_meu_diec/src/utils/string_extension.dart';
import 'package:flutter/material.dart';

class CollectionAvatar extends StatelessWidget {
Expand Down Expand Up @@ -28,7 +29,7 @@ class CollectionAvatar extends StatelessWidget {
children: [
for (var i = 0; i < words.length; i++)
Text(
words[i]?.word ?? '',
words[i]?.word.stripNumbers ?? '',
overflow: TextOverflow.fade,
maxLines: 1,
softWrap: false,
Expand Down

0 comments on commit d085c18

Please sign in to comment.