Skip to content

Commit 63693f9

Browse files
committed
Style updates for the suggestion widget.
1 parent 596ff08 commit 63693f9

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

pkg/web_app/lib/src/widget/completion/suggest.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class Suggestion {
116116
}
117117
// include matched prefix as part of the display option
118118
if (completion.terminal) {
119-
html = '$match$html';
119+
html = '<span class="completion-overlap">$match</span>$html';
120120
}
121121
final score = (option.startsWith(word) ? math.pow(overlap.length, 3) : 0) +
122122
math.pow(overlap.length, 2) +

pkg/web_app/test/widget/completion/suggest_test.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,50 +68,52 @@ void main() {
6868
'start': 0,
6969
'end': 5,
7070
'value': 'is:flutter-favorite ',
71-
'html': 'is:flu<span class="completion-overlap">tt</span>er-favorite',
71+
'html':
72+
'<span class="completion-overlap">is:</span>flu<span class="completion-overlap">tt</span>er-favorite',
7273
'score': 4.125,
7374
},
7475
{
7576
'start': 0,
7677
'end': 5,
7778
'value': 'is:unlisted ',
78-
'html': 'is:unlis<span class="completion-overlap">t</span>ed',
79+
'html':
80+
'<span class="completion-overlap">is:</span>unlis<span class="completion-overlap">t</span>ed',
7981
'score': 1.125,
8082
},
8183
{
8284
'start': 0,
8385
'end': 5,
8486
'value': 'is:dart3-compatible ',
8587
'html':
86-
'is:dar<span class="completion-overlap">t</span>3-compa<span class="completion-overlap">t</span>ible',
88+
'<span class="completion-overlap">is:</span>dar<span class="completion-overlap">t</span>3-compa<span class="completion-overlap">t</span>ible',
8789
'score': 1.0625,
8890
},
8991
{
9092
'start': 0,
9193
'end': 5,
9294
'value': 'is:legacy ',
93-
'html': 'is:legacy',
95+
'html': '<span class="completion-overlap">is:</span>legacy',
9496
'score': 0.0,
9597
},
9698
{
9799
'start': 0,
98100
'end': 5,
99101
'value': 'is:null-safe ',
100-
'html': 'is:null-safe',
102+
'html': '<span class="completion-overlap">is:</span>null-safe',
101103
'score': 0.0,
102104
},
103105
{
104106
'start': 0,
105107
'end': 5,
106108
'value': 'is:plugin ',
107-
'html': 'is:plugin',
109+
'html': '<span class="completion-overlap">is:</span>plugin',
108110
'score': 0.0
109111
},
110112
{
111113
'start': 0,
112114
'end': 5,
113115
'value': 'is:wasm-ready ',
114-
'html': 'is:wasm-ready',
116+
'html': '<span class="completion-overlap">is:</span>wasm-ready',
115117
'score': 0.0,
116118
},
117119
]);

pkg/web_css/lib/src/_search.scss

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,26 +110,23 @@
110110
overflow-x: hidden;
111111
appearance: none;
112112
width: 25ex;
113-
padding-bottom: 4px;
114-
border-left: 1px solid #000;
115-
border-right: 1px solid #000;
116-
border-bottom: 1px solid #000;
113+
border: 1px solid #000;
117114
border-bottom-left-radius: 5px;
118115
border-bottom-right-radius: 5px;
119116
max-height: 20em;
120117
background: var(--pub-searchbar_input-background-color);
121-
color: var(--pub-input-placeholder-color);
118+
color: var(--pub-searchbar_suggest-text-color);
122119
font-size: 16px;
123120
margin-left: 48px; // counter padding-left on .search-bar>.input
124121
margin-top: -14px; // counter padding-top on .search-bar>.input
125122

126123
>.completion-option {
127124
cursor: pointer;
128125
white-space: nowrap;
129-
padding: 0px 3px;
126+
padding: 1px 4px;
130127

131128
&:hover {
132-
background-color: var(--pub-searchbar_input_hover-background-color);
129+
background-color: var(--pub-searchbar_suggest_hover-background-color);
133130
}
134131

135132
.completion-overlap {
@@ -139,6 +136,6 @@
139136
}
140137

141138
>.completion-option-selected {
142-
background-color: var(--pub-searchbar_input_hover-background-color);
139+
background-color: var(--pub-searchbar_suggest_hover-background-color);
143140
}
144141
}

pkg/web_css/lib/src/_variables.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@
7979
--pub-searchbar-background-color: #132030;
8080
--pub-searchbar-text-color: #8d9399;
8181
--pub-searchbar_input-background-color: #35404d;
82-
--pub-searchbar_input_hover-background-color: #455060;
8382
--pub-searchbar_input-text-color: var(--pub-color-white);
83+
--pub-searchbar_suggest_hover-background-color: #455060;
84+
--pub-searchbar_suggest-text-color: #a9a9a9;
8485
--pub-session_warning-background-color: #ffffaa;
8586
--pub-site_header_banner-background-color: #1C2834;
8687
--pub-site_header_banner-text-color: #f8f9fa;

0 commit comments

Comments
 (0)