@@ -22,6 +22,59 @@ import 'store.dart';
2222import 'text.dart' ;
2323import 'theme.dart' ;
2424
25+ /// Compose-box styles that differ between light and dark theme.
26+ ///
27+ /// These styles will animate on theme changes (with help from [lerp] ).
28+ class ComposeBoxTheme extends ThemeExtension <ComposeBoxTheme > {
29+ static final light = ComposeBoxTheme ._(
30+ boxShadow: null ,
31+ );
32+
33+ static final dark = ComposeBoxTheme ._(
34+ boxShadow: [BoxShadow (
35+ color: DesignVariables .dark.bgTopBar,
36+ offset: const Offset (0 , - 4 ),
37+ blurRadius: 16 ,
38+ spreadRadius: 0 ,
39+ )],
40+ );
41+
42+ ComposeBoxTheme ._({
43+ required this .boxShadow,
44+ });
45+
46+ /// The [ComposeBoxTheme] from the context's active theme.
47+ ///
48+ /// The [ThemeData] must include [ComposeBoxTheme] in [ThemeData.extensions] .
49+ static ComposeBoxTheme of (BuildContext context) {
50+ final theme = Theme .of (context);
51+ final extension = theme.extension < ComposeBoxTheme > ();
52+ assert (extension != null );
53+ return extension ! ;
54+ }
55+
56+ final List <BoxShadow >? boxShadow;
57+
58+ @override
59+ ComposeBoxTheme copyWith ({
60+ List <BoxShadow >? boxShadow,
61+ }) {
62+ return ComposeBoxTheme ._(
63+ boxShadow: boxShadow ?? this .boxShadow,
64+ );
65+ }
66+
67+ @override
68+ ComposeBoxTheme lerp (ComposeBoxTheme other, double t) {
69+ if (identical (this , other)) {
70+ return this ;
71+ }
72+ return ComposeBoxTheme ._(
73+ boxShadow: BoxShadow .lerpList (boxShadow, other.boxShadow, t)! ,
74+ );
75+ }
76+ }
77+
2578const double _composeButtonSize = 44 ;
2679
2780/// A [TextEditingController] for use in the compose box.
@@ -1090,7 +1143,9 @@ class _ComposeBoxContainer extends StatelessWidget {
10901143 // the message list itself; if so, remember to update ComposeBox's dartdoc.
10911144 return Container (width: double .infinity,
10921145 decoration: BoxDecoration (
1093- border: Border (top: BorderSide (color: designVariables.borderBar))),
1146+ border: Border (top: BorderSide (color: designVariables.borderBar)),
1147+ boxShadow: ComposeBoxTheme .of (context).boxShadow,
1148+ ),
10941149 // TODO(#720) try a Stack for the overlaid linear progress indicator
10951150 child: Material (
10961151 color: designVariables.composeBoxBg,
0 commit comments