Skip to content

Commit

Permalink
feat(autocomplete_entry_card): ๐Ÿ’„ improve layout on large words (#60)
Browse files Browse the repository at this point in the history
* feat(autocomplete_entry_card): ๐Ÿ’„ improve layout on large words

* feat(search_bar_results): โ™ฟ๏ธ autofocus `TextFormField`
  • Loading branch information
albertms10 committed Feb 8, 2024
1 parent 504abb6 commit c7e710a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
1 change: 1 addition & 0 deletions lib/src/pages/word_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class WordPage extends StatelessWidget {
appBar: AppBar(
title: SelectableText(
word.word,
maxLines: 1,
style: theme.textTheme.displaySmall!.copyWith(fontSize: 32),
),
backgroundColor: Colors.transparent,
Expand Down
44 changes: 24 additions & 20 deletions lib/src/widgets/autocomplete_entry_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,35 @@ class AutocompleteEntryCard extends StatelessWidget {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text.rich(
TextSpan(
children: [
if (isIncompleteStart)
TextSpan(
text: word.word.substring(0, start),
style: headlineTextStyle.copyWith(
color: headlineTextStyle.color!.withOpacity(0.4),
Expanded(
child: Text.rich(
maxLines: 1,
softWrap: false,
overflow: TextOverflow.fade,
TextSpan(
children: [
if (isIncompleteStart)
TextSpan(
text: word.word.substring(0, start),
style: headlineTextStyle.copyWith(
color: headlineTextStyle.color!.withOpacity(0.4),
),
),
),
TextSpan(
text: word.word.substring(start, end),
style: headlineTextStyle,
),
if (isIncompleteEnd)
TextSpan(
text: word.word.substring(end),
style: headlineTextStyle.copyWith(
color: headlineTextStyle.color!.withOpacity(0.4),
),
text: word.word.substring(start, end),
style: headlineTextStyle,
),
],
if (isIncompleteEnd)
TextSpan(
text: word.word.substring(end),
style: headlineTextStyle.copyWith(
color: headlineTextStyle.color!.withOpacity(0.4),
),
),
],
),
),
),
const Spacer(),
const SizedBox(width: 4),
BookmarkButton(word: word),
],
Expand Down
1 change: 1 addition & 0 deletions lib/src/widgets/search_bar_results.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class _SearchBarResultsState extends State<SearchBarResults> {
),
child: TextFormField(
autocorrect: false,
autofocus: true,
style: const TextStyle(fontSize: 18),
decoration: InputDecoration(
hintText: appLocalizations.search,
Expand Down

0 comments on commit c7e710a

Please sign in to comment.