@@ -300,22 +300,82 @@ class _ContentInput extends StatelessWidget {
300
300
narrow: narrow,
301
301
controller: controller,
302
302
focusNode: focusNode,
303
- fieldViewBuilder: (context) => TextField (
304
- controller: controller,
305
- focusNode: focusNode,
306
- decoration: InputDecoration .collapsed (
307
- hintText: hintText,
308
- hintStyle: TextStyle (color: designVariables.textInput.withOpacity (0.5 ))),
309
- minLines: 2 ,
310
- maxLines: null ,
311
- textCapitalization: TextCapitalization .sentences,
312
- style: TextStyle (
313
- fontSize: 17 ,
314
- height: (contentLineHeight / 17 ),
315
- color: designVariables.textInput))));
303
+ fieldViewBuilder: (context) => _ShadowBox (
304
+ color: designVariables.bgComposeBox,
305
+ child: TextField (
306
+ controller: controller,
307
+ focusNode: focusNode,
308
+ decoration: InputDecoration .collapsed (
309
+ hintText: hintText,
310
+ hintStyle: TextStyle (color: designVariables.textInput.withOpacity (0.5 ))),
311
+ minLines: 2 ,
312
+ maxLines: null ,
313
+ textCapitalization: TextCapitalization .sentences,
314
+ style: TextStyle (
315
+ fontSize: 17 ,
316
+ height: (contentLineHeight / 17 ),
317
+ color: designVariables.textInput)),
318
+ )));
319
+ }
320
+ }
321
+
322
+ /// Overlay inset shadows on the child from all scrollable directions.
323
+ class _ShadowBox extends StatefulWidget {
324
+ const _ShadowBox ({required this .color, required this .child});
325
+
326
+ final Color color;
327
+ final Widget child;
328
+
329
+ @override
330
+ State <_ShadowBox > createState () => _ShadowBoxState ();
331
+ }
332
+
333
+ class _ShadowBoxState extends State <_ShadowBox > {
334
+ bool showTopShadow = false ; bool showBottomShadow = false ;
335
+ bool showLeftShadow = false ; bool showRightShadow = false ;
336
+
337
+ bool handleScroll (ScrollNotification notification) {
338
+ final metrics = notification.metrics;
339
+ setState (() {
340
+ switch (metrics.axisDirection) {
341
+ case AxisDirection .up:
342
+ case AxisDirection .down:
343
+ showTopShadow = metrics.extentBefore != 0 ;
344
+ showBottomShadow = metrics.extentAfter != 0 ;
345
+ case AxisDirection .right:
346
+ case AxisDirection .left:
347
+ showLeftShadow = metrics.extentBefore != 0 ;
348
+ showRightShadow = metrics.extentAfter != 0 ;
349
+ }
350
+ });
351
+ return false ;
352
+ }
353
+
354
+ @override
355
+ Widget build (BuildContext context) {
356
+ BoxDecoration shadowFrom (AlignmentGeometry begin) =>
357
+ BoxDecoration (gradient: LinearGradient (begin: begin, end: - begin,
358
+ colors: [widget.color, widget.color.withOpacity (0 )]));
359
+
360
+ return NotificationListener <ScrollNotification >(
361
+ onNotification: handleScroll,
362
+ child: Stack (
363
+ children: [
364
+ widget.child,
365
+ if (showTopShadow) Positioned (top: 0 , left: 0 , right: 0 ,
366
+ child: Container (height: 8 , decoration: shadowFrom (Alignment .topCenter))),
367
+ if (showBottomShadow) Positioned (bottom: 0 , left: 0 , right: 0 ,
368
+ child: Container (height: 8 , decoration: shadowFrom (Alignment .bottomCenter))),
369
+ if (showLeftShadow) Positioned (left: 0 , top: 0 , bottom: 0 ,
370
+ child: Container (width: 8 , decoration: shadowFrom (Alignment .centerLeft))),
371
+ if (showRightShadow) Positioned (right: 0 , top: 0 , bottom: 0 ,
372
+ child: Container (width: 8 , decoration: shadowFrom (Alignment .centerRight))),
373
+ ],
374
+ ));
316
375
}
317
376
}
318
377
378
+
319
379
/// The content input for _StreamComposeBox.
320
380
class _StreamContentInput extends StatefulWidget {
321
381
const _StreamContentInput ({
0 commit comments