@@ -20,7 +20,6 @@ import 'store.dart';
20
20
import 'text.dart' ;
21
21
import 'theme.dart' ;
22
22
23
- const double _inputVerticalPadding = 8 ;
24
23
const double _composeButtonWidth = 44 ;
25
24
const double _composeButtonHeight = 42 ;
26
25
@@ -287,30 +286,46 @@ class _ContentInput extends StatelessWidget {
287
286
288
287
@override
289
288
Widget build (BuildContext context) {
290
- ColorScheme colorScheme = Theme .of (context).colorScheme;
291
-
292
- return InputDecorator (
293
- decoration: const InputDecoration (),
294
- child: ConstrainedBox (
295
- constraints: const BoxConstraints (
296
- // TODO constrain this adaptively (i.e. not hard-coded 200)
297
- maxHeight: 200 ,
298
- ),
299
- child: ComposeAutocomplete (
300
- narrow: narrow,
301
- controller: controller,
302
- focusNode: focusNode,
303
- fieldViewBuilder: (context) {
304
- return TextField (
289
+ final designVariables = DesignVariables .of (context);
290
+ const verticalPadding = 8.0 ;
291
+ const contentLineHeight = 22.0 ;
292
+
293
+ return ConstrainedBox (
294
+ constraints: const BoxConstraints (
295
+ // The minimum height fits a little more than 2 lines to match the spec
296
+ // of 54 logical pixels. The bottom padding is not added because it
297
+ // is not supposed to extend the compose box.
298
+ minHeight: verticalPadding + contentLineHeight * 2.091 ,
299
+ // Reserve space to fully show the first 7th lines and just partially
300
+ // clip the 8th line, where the height matches the spec of 178 logical
301
+ // pixels. The partial line hints that the content input is scrollable.
302
+ // The bottom padding is not added because it is not supposed to extend
303
+ // the compose box.
304
+ maxHeight: verticalPadding + contentLineHeight * 7 + contentLineHeight * 0.727 ),
305
+ child: ClipRect (
306
+ child: ComposeAutocomplete (
307
+ narrow: narrow,
308
+ controller: controller,
309
+ focusNode: focusNode,
310
+ fieldViewBuilder: (context) => TextField (
305
311
controller: controller,
306
312
focusNode: focusNode,
307
- style: TextStyle (color: colorScheme.onSurface),
308
- decoration: InputDecoration .collapsed (hintText: hintText),
313
+ // Not clipping content input with [TextField] gives us fine
314
+ // control over the clipping behavior. Otherwise, the non-zero
315
+ // vertical `contentPadding` would cause the text to be clipped
316
+ // by a rectangle shorter than the compose box.
317
+ clipBehavior: Clip .none,
318
+ style: TextStyle (
319
+ fontSize: 17 ,
320
+ height: (contentLineHeight / 17 ),
321
+ color: designVariables.textInput),
309
322
maxLines: null ,
310
323
textCapitalization: TextCapitalization .sentences,
311
- );
312
- }),
313
- ));
324
+ decoration: InputDecoration (
325
+ contentPadding: const EdgeInsets .symmetric (vertical: verticalPadding),
326
+ hintText: hintText,
327
+ hintStyle: TextStyle (
328
+ color: designVariables.textInput.withValues (alpha: 0.5 )))))));
314
329
}
315
330
}
316
331
0 commit comments