@@ -20,8 +20,6 @@ import 'store.dart';
20
20
import 'text.dart' ;
21
21
import 'theme.dart' ;
22
22
23
- const double _inputVerticalPadding = 8 ;
24
- const double _sendButtonSize = 36 ;
25
23
const double _composeButtonWidth = 44 ;
26
24
const double _composeButtonHeight = 42 ;
27
25
@@ -288,32 +286,46 @@ class _ContentInput extends StatelessWidget {
288
286
289
287
@override
290
288
Widget build (BuildContext context) {
291
- ColorScheme colorScheme = Theme .of (context).colorScheme;
292
-
293
- return InputDecorator (
294
- decoration: const InputDecoration (),
295
- child: ConstrainedBox (
296
- constraints: const BoxConstraints (
297
- minHeight: _sendButtonSize - 2 * _inputVerticalPadding,
298
-
299
- // TODO constrain this adaptively (i.e. not hard-coded 200)
300
- maxHeight: 200 ,
301
- ),
302
- child: ComposeAutocomplete (
303
- narrow: narrow,
304
- controller: controller,
305
- focusNode: focusNode,
306
- fieldViewBuilder: (context) {
307
- 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 (
308
311
controller: controller,
309
312
focusNode: focusNode,
310
- style: TextStyle (color: colorScheme.onSurface),
311
- decoration: InputDecoration .collapsed (hintText: hintText),
313
+ // `contentPadding` causes the text to be clipped by a rect
314
+ // shorter than the compose box, because it shrinks the body of
315
+ // [TextField]. Overriding this gives us fine control
316
+ // over the clipping behavior with [ClipRect].
317
+ clipBehavior: Clip .none,
318
+ style: TextStyle (
319
+ fontSize: 17 ,
320
+ height: (contentLineHeight / 17 ),
321
+ color: designVariables.textInput),
312
322
maxLines: null ,
313
323
textCapitalization: TextCapitalization .sentences,
314
- );
315
- }),
316
- ));
324
+ decoration: InputDecoration (
325
+ contentPadding: const EdgeInsets .symmetric (vertical: verticalPadding),
326
+ hintText: hintText,
327
+ hintStyle: TextStyle (
328
+ color: designVariables.textInput.withValues (alpha: 0.5 )))))));
317
329
}
318
330
}
319
331
0 commit comments