@@ -22,6 +22,59 @@ import 'store.dart';
22
22
import 'text.dart' ;
23
23
import 'theme.dart' ;
24
24
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
+
25
78
const double _composeButtonSize = 44 ;
26
79
27
80
/// A [TextEditingController] for use in the compose box.
@@ -1090,7 +1143,9 @@ class _ComposeBoxContainer extends StatelessWidget {
1090
1143
// the message list itself; if so, remember to update ComposeBox's dartdoc.
1091
1144
return Container (width: double .infinity,
1092
1145
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
+ ),
1094
1149
// TODO(#720) try a Stack for the overlaid linear progress indicator
1095
1150
child: Material (
1096
1151
color: designVariables.composeBoxBg,
0 commit comments