@@ -16,6 +16,7 @@ import '../model/store.dart';
16
16
import 'autocomplete.dart' ;
17
17
import 'dialog.dart' ;
18
18
import 'icons.dart' ;
19
+ import 'inset_shadow.dart' ;
19
20
import 'store.dart' ;
20
21
import 'text.dart' ;
21
22
import 'theme.dart' ;
@@ -286,30 +287,49 @@ class _ContentInput extends StatelessWidget {
286
287
287
288
@override
288
289
Widget build (BuildContext context) {
289
- ColorScheme colorScheme = Theme .of (context).colorScheme;
290
+ const verticalPadding = 8.0 ;
291
+ const contentLineHeight = 22.0 ;
290
292
291
- return InputDecorator (
292
- decoration: const InputDecoration (),
293
- child: ConstrainedBox (
293
+ final designVariables = DesignVariables .of (context);
294
+
295
+ return ComposeAutocomplete (
296
+ narrow: narrow,
297
+ controller: controller,
298
+ focusNode: focusNode,
299
+ fieldViewBuilder: (context) => ConstrainedBox (
294
300
constraints: const BoxConstraints (
295
- // TODO constrain this adaptively (i.e. not hard-coded 200)
296
- maxHeight: 200 ,
297
- ),
298
- child: ComposeAutocomplete (
299
- narrow: narrow,
300
- controller: controller,
301
- focusNode: focusNode,
302
- fieldViewBuilder: (context) {
303
- return TextField (
301
+ // Reserve space to fully show the first 7th lines and just partially
302
+ // clip the 8th line, where the height matches the spec of 178 logical
303
+ // pixels. The partial line hints that the content input is
304
+ // scrollable. We do not expect this to work the same way with all
305
+ // font sizes.
306
+ maxHeight: verticalPadding + contentLineHeight * 7 + contentLineHeight * 0.727 ),
307
+ child: ClipRect (
308
+ child: InsetShadowBox (
309
+ top: verticalPadding, bottom: verticalPadding,
310
+ color: designVariables.composeBoxBg,
311
+ child: TextField (
304
312
controller: controller,
305
313
focusNode: focusNode,
306
- style: TextStyle (color: colorScheme.onSurface),
307
- decoration: InputDecoration .collapsed (hintText: hintText),
314
+ // Let the content show through the `contentPadding` so that
315
+ // our [InsetShadowBox] can fade it smoothly there.
316
+ clipBehavior: Clip .none,
317
+ style: TextStyle (
318
+ fontSize: 17 ,
319
+ height: (contentLineHeight / 17 ),
320
+ color: designVariables.textInput),
321
+ // The [TextField] will be a bit taller than the spec in height,
322
+ // because the bottom [contentPadding] is necessary for it to be
323
+ // fully scrolled down, so that the content passes the bottom
324
+ // shadow.
325
+ minLines: 2 ,
308
326
maxLines: null ,
309
327
textCapitalization: TextCapitalization .sentences,
310
- );
311
- }),
312
- ));
328
+ decoration: InputDecoration (
329
+ contentPadding: const EdgeInsets .symmetric (vertical: verticalPadding),
330
+ hintText: hintText,
331
+ hintStyle: TextStyle (
332
+ color: designVariables.textInput.withValues (alpha: 0.5 ))))))));
313
333
}
314
334
}
315
335
0 commit comments