@@ -41,20 +41,20 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
4141 @override
4242 BorderSide? get activeIndicatorBorder => MaterialStateBorderSide.resolveWith((Set<MaterialState> states) {
4343 if (states.contains(MaterialState.error)) {
44+ if (states.contains(MaterialState.focused)) {
45+ return ${mergedBorder ('md.comp.filled-text-field.error.focus.active-indicator' ,'md.comp.filled-text-field.focus.active-indicator' )};
46+ }
4447 if (states.contains(MaterialState.hovered)) {
4548 return ${border ('md.comp.filled-text-field.error.hover.active-indicator' )};
46- }${border ('md.comp.filled-text-field.error.focus.active-indicator' ) == border ('md.comp.filled-text-field.error.active-indicator' ) ? '' : '''
47- if (states.contains(MaterialState.focused)) {
48- return ${border ('md.comp.filled-text-field.error.focus.active-indicator' )};
49- }''' }
49+ }
5050 return ${border ('md.comp.filled-text-field.error.active-indicator' )};
5151 }
52- if (states.contains(MaterialState.hovered)) {
53- return ${border ('md.comp.filled-text-field.hover.active-indicator' )};
54- }
5552 if (states.contains(MaterialState.focused)) {
5653 return ${border ('md.comp.filled-text-field.focus.active-indicator' )};
5754 }
55+ if (states.contains(MaterialState.hovered)) {
56+ return ${border ('md.comp.filled-text-field.hover.active-indicator' )};
57+ }
5858 if (states.contains(MaterialState.disabled)) {
5959 return ${border ('md.comp.filled-text-field.disabled.active-indicator' )};
6060 }
@@ -64,20 +64,20 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
6464 @override
6565 BorderSide? get outlineBorder => MaterialStateBorderSide.resolveWith((Set<MaterialState> states) {
6666 if (states.contains(MaterialState.error)) {
67+ if (states.contains(MaterialState.focused)) {
68+ return ${mergedBorder ('md.comp.outlined-text-field.error.focus.outline' ,'md.comp.outlined-text-field.focus.outline' )};
69+ }
6770 if (states.contains(MaterialState.hovered)) {
6871 return ${border ('md.comp.outlined-text-field.error.hover.outline' )};
69- }${border ('md.comp.outlined-text-field.error.focus.outline' ) == border ('md.comp.outlined-text-field.error.outline' ) ? '' : '''
70- if (states.contains(MaterialState.focused)) {
71- return ${border ('md.comp.outlined-text-field.error.focus.outline' )};
72- }''' }
72+ }
7373 return ${border ('md.comp.outlined-text-field.error.outline' )};
7474 }
75- if (states.contains(MaterialState.hovered)) {
76- return ${border ('md.comp.outlined-text-field.hover.outline' )};
77- }
7875 if (states.contains(MaterialState.focused)) {
7976 return ${border ('md.comp.outlined-text-field.focus.outline' )};
8077 }
78+ if (states.contains(MaterialState.hovered)) {
79+ return ${border ('md.comp.outlined-text-field.hover.outline' )};
80+ }
8181 if (states.contains(MaterialState.disabled)) {
8282 return ${border ('md.comp.outlined-text-field.disabled.outline' )};
8383 }
@@ -90,19 +90,19 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
9090 @override
9191 Color? get prefixIconColor => MaterialStateColor.resolveWith((Set<MaterialState> states) {${componentColor ('md.comp.filled-text-field.error.leading-icon' ) == componentColor ('md.comp.filled-text-field.leading-icon' ) ? '' : '''
9292 if(states.contains(MaterialState.error)) {
93- if (states.contains(MaterialState.hovered)) {
94- return ${componentColor ('md.comp.filled-text-field.error.hover.leading-icon' )};
95- }
9693 if (states.contains(MaterialState.focused)) {
9794 return ${componentColor ('md.comp.filled-text-field.error.focus.leading-icon' )};
9895 }
96+ if (states.contains(MaterialState.hovered)) {
97+ return ${componentColor ('md.comp.filled-text-field.error.hover.leading-icon' )};
98+ }
9999 return ${componentColor ('md.comp.filled-text-field.error.leading-icon' )};
100- }''' }${componentColor ('md.comp.filled-text-field.hover.leading-icon' ) == componentColor ('md.comp.filled-text-field.leading-icon' ) ? '' : '''
101- if (states.contains(MaterialState.hovered)) {
102- return ${componentColor ('md.comp.filled-text-field.hover.leading-icon' )};
103100 }''' }${componentColor ('md.comp.filled-text-field.focus.leading-icon' ) == componentColor ('md.comp.filled-text-field.leading-icon' ) ? '' : '''
104101 if (states.contains(MaterialState.focused)) {
105102 return ${componentColor ('md.comp.filled-text-field.focus.leading-icon' )};
103+ }''' }${componentColor ('md.comp.filled-text-field.hover.leading-icon' ) == componentColor ('md.comp.filled-text-field.leading-icon' ) ? '' : '''
104+ if (states.contains(MaterialState.hovered)) {
105+ return ${componentColor ('md.comp.filled-text-field.hover.leading-icon' )};
106106 }''' }
107107 if (states.contains(MaterialState.disabled)) {
108108 return ${componentColor ('md.comp.filled-text-field.disabled.leading-icon' )};
@@ -112,20 +112,20 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
112112
113113 @override
114114 Color? get suffixIconColor => MaterialStateColor.resolveWith((Set<MaterialState> states) {
115- if(states.contains(MaterialState.error)) {
116- if (states.contains(MaterialState.hovered)) {
117- return ${componentColor ('md.comp.filled-text-field.error.hover.trailing-icon' )};
118- }${componentColor ('md.comp.filled-text-field.error.trailing-icon' ) == componentColor ('md.comp.filled-text-field.error.focus.trailing-icon' ) ? '' : '''
115+ if(states.contains(MaterialState.error)) {${componentColor ('md.comp.filled-text-field.error.trailing-icon' ) == componentColor ('md.comp.filled-text-field.error.focus.trailing-icon' ) ? '' : '''
119116 if (states.contains(MaterialState.focused)) {
120117 return ${componentColor ('md.comp.filled-text-field.error.focus.trailing-icon' )};
121118 }''' }
119+ if (states.contains(MaterialState.hovered)) {
120+ return ${componentColor ('md.comp.filled-text-field.error.hover.trailing-icon' )};
121+ }
122122 return ${componentColor ('md.comp.filled-text-field.error.trailing-icon' )};
123- }${componentColor ('md.comp.filled-text-field.hover.trailing-icon' ) == componentColor ('md.comp.filled-text-field.trailing-icon' ) ? '' : '''
124- if (states.contains(MaterialState.hovered)) {
125- return ${componentColor ('md.comp.filled-text-field.hover.trailing-icon' )};
126- }''' }${componentColor ('md.comp.filled-text-field.focus.trailing-icon' ) == componentColor ('md.comp.filled-text-field.trailing-icon' ) ? '' : '''
123+ }${componentColor ('md.comp.filled-text-field.focus.trailing-icon' ) == componentColor ('md.comp.filled-text-field.trailing-icon' ) ? '' : '''
127124 if (states.contains(MaterialState.focused)) {
128125 return ${componentColor ('md.comp.filled-text-field.focus.trailing-icon' )};
126+ }''' }${componentColor ('md.comp.filled-text-field.hover.trailing-icon' ) == componentColor ('md.comp.filled-text-field.trailing-icon' ) ? '' : '''
127+ if (states.contains(MaterialState.hovered)) {
128+ return ${componentColor ('md.comp.filled-text-field.hover.trailing-icon' )};
129129 }''' }
130130 if (states.contains(MaterialState.disabled)) {
131131 return ${componentColor ('md.comp.filled-text-field.disabled.trailing-icon' )};
@@ -137,20 +137,20 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
137137 TextStyle? get labelStyle => MaterialStateTextStyle.resolveWith((Set<MaterialState> states) {
138138 final TextStyle textStyle= ${textStyle ("md.comp.filled-text-field.label-text" )} ?? const TextStyle();
139139 if(states.contains(MaterialState.error)) {
140- if (states.contains(MaterialState.hovered)) {
141- return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.hover.label-text' )});
142- }
143140 if (states.contains(MaterialState.focused)) {
144141 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.focus.label-text' )});
145142 }
143+ if (states.contains(MaterialState.hovered)) {
144+ return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.hover.label-text' )});
145+ }
146146 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.label-text' )});
147147 }
148- if (states.contains(MaterialState.hovered)) {
149- return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.hover.label-text' )});
150- }
151148 if (states.contains(MaterialState.focused)) {
152149 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.focus.label-text' )});
153150 }
151+ if (states.contains(MaterialState.hovered)) {
152+ return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.hover.label-text' )});
153+ }
154154 if (states.contains(MaterialState.disabled)) {
155155 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.disabled.label-text' )});
156156 }
@@ -161,20 +161,20 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
161161 TextStyle? get floatingLabelStyle => MaterialStateTextStyle.resolveWith((Set<MaterialState> states) {
162162 final TextStyle textStyle= ${textStyle ("md.comp.filled-text-field.label-text" )} ?? const TextStyle();
163163 if(states.contains(MaterialState.error)) {
164- if (states.contains(MaterialState.hovered)) {
165- return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.hover.label-text' )});
166- }
167164 if (states.contains(MaterialState.focused)) {
168165 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.focus.label-text' )});
169166 }
167+ if (states.contains(MaterialState.hovered)) {
168+ return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.hover.label-text' )});
169+ }
170170 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.label-text' )});
171171 }
172- if (states.contains(MaterialState.hovered)) {
173- return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.hover.label-text' )});
174- }
175172 if (states.contains(MaterialState.focused)) {
176173 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.focus.label-text' )});
177174 }
175+ if (states.contains(MaterialState.hovered)) {
176+ return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.hover.label-text' )});
177+ }
178178 if (states.contains(MaterialState.disabled)) {
179179 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.disabled.label-text' )});
180180 }
@@ -183,12 +183,12 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
183183
184184 @override
185185 TextStyle? get helperStyle => MaterialStateTextStyle.resolveWith((Set<MaterialState> states) {
186- final TextStyle textStyle= ${textStyle ("md.comp.filled-text-field.supporting-text" )} ?? const TextStyle();${componentColor ('md.comp.filled-text-field.hover.supporting-text' ) == componentColor ('md.comp.filled-text-field.supporting-text' ) ? '' : '''
187- if (states.contains(MaterialState.hovered)) {
188- return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.hover.supporting-text' )});
189- }''' }${componentColor ('md.comp.filled-text-field.focus.supporting-text' ) == componentColor ('md.comp.filled-text-field.supporting-text' ) ? '' : '''
186+ final TextStyle textStyle= ${textStyle ("md.comp.filled-text-field.supporting-text" )} ?? const TextStyle();${componentColor ('md.comp.filled-text-field.focus.supporting-text' ) == componentColor ('md.comp.filled-text-field.supporting-text' ) ? '' : '''
190187 if (states.contains(MaterialState.focused)) {
191188 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.focus.supporting-text' )});
189+ }''' }${componentColor ('md.comp.filled-text-field.hover.supporting-text' ) == componentColor ('md.comp.filled-text-field.supporting-text' ) ? '' : '''
190+ if (states.contains(MaterialState.hovered)) {
191+ return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.hover.supporting-text' )});
192192 }''' }
193193 if (states.contains(MaterialState.disabled)) {
194194 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.disabled.supporting-text' )});
@@ -198,15 +198,29 @@ class _${blockName}DefaultsM3 extends InputDecorationTheme {
198198
199199 @override
200200 TextStyle? get errorStyle => MaterialStateTextStyle.resolveWith((Set<MaterialState> states) {
201- final TextStyle textStyle= ${textStyle ("md.comp.filled-text-field.supporting-text" )} ?? const TextStyle();${componentColor ('md.comp.filled-text-field.error.hover.supporting-text' ) == componentColor ('md.comp.filled-text-field.error.supporting-text' ) ? '' : '''
202- if (states.contains(MaterialState.hovered)) {
203- return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.hover.supporting-text' )});
204- }''' }${componentColor ('md.comp.filled-text-field.error.focus.supporting-text' ) == componentColor ('md.comp.filled-text-field.error.supporting-text' ) ? '' : '''
201+ final TextStyle textStyle= ${textStyle ("md.comp.filled-text-field.supporting-text" )} ?? const TextStyle();${componentColor ('md.comp.filled-text-field.error.focus.supporting-text' ) == componentColor ('md.comp.filled-text-field.error.supporting-text' ) ? '' : '''
205202 if (states.contains(MaterialState.focused)) {
206203 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.focus.supporting-text' )});
204+ }''' }${componentColor ('md.comp.filled-text-field.error.hover.supporting-text' ) == componentColor ('md.comp.filled-text-field.error.supporting-text' ) ? '' : '''
205+ if (states.contains(MaterialState.hovered)) {
206+ return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.hover.supporting-text' )});
207207 }''' }
208208 return textStyle.copyWith(color:${componentColor ('md.comp.filled-text-field.error.supporting-text' )});
209209 });
210210}
211211''' ;
212+
213+ /// Generate a [BorderSide] for the given components.
214+ String mergedBorder (String componentToken1, String componentToken2) {
215+ final String borderColor = componentColor (componentToken1)!= 'null'
216+ ? componentColor (componentToken1)
217+ : componentColor (componentToken2);
218+ final double width = (
219+ tokens['$componentToken1 .width' ] ??
220+ tokens['$componentToken1 .height' ] ??
221+ tokens['$componentToken2 .width' ] ??
222+ tokens['$componentToken2 .height' ] ??
223+ 1.0 ) as double ;
224+ return 'BorderSide(color: $borderColor ${width != 1.0 ? ", width: $width " : "" })' ;
225+ }
212226}
0 commit comments