Unverified Commit 793e2efe authored by Viren Khatri's avatar Viren Khatri Committed by GitHub

Use curly_braces_in_flow_control_structures for gen_defaults (#104921)

parent c2e10541
...@@ -17,8 +17,9 @@ class ButtonTemplate extends TokenTemplate { ...@@ -17,8 +17,9 @@ class ButtonTemplate extends TokenTemplate {
return ''' return '''
MaterialStateProperty.resolveWith((Set<MaterialState> states) { MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) if (states.contains(MaterialState.disabled)) {
return ${componentColor('$tokenGroup.disabled.container')}; return ${componentColor('$tokenGroup.disabled.container')};
}
return ${componentColor('$tokenGroup.container')}; return ${componentColor('$tokenGroup.container')};
})'''; })''';
} }
...@@ -32,14 +33,18 @@ class ButtonTemplate extends TokenTemplate { ...@@ -32,14 +33,18 @@ class ButtonTemplate extends TokenTemplate {
return ''' return '''
MaterialStateProperty.resolveWith((Set<MaterialState> states) { MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) if (states.contains(MaterialState.disabled)) {
return ${elevation("$tokenGroup.disabled.container")}; return ${elevation("$tokenGroup.disabled.container")};
if (states.contains(MaterialState.hovered)) }
if (states.contains(MaterialState.hovered)) {
return ${elevation("$tokenGroup.hover.container")}; return ${elevation("$tokenGroup.hover.container")};
if (states.contains(MaterialState.focused)) }
if (states.contains(MaterialState.focused)) {
return ${elevation("$tokenGroup.focus.container")}; return ${elevation("$tokenGroup.focus.container")};
if (states.contains(MaterialState.pressed)) }
if (states.contains(MaterialState.pressed)) {
return ${elevation("$tokenGroup.pressed.container")}; return ${elevation("$tokenGroup.pressed.container")};
}
return ${elevation("$tokenGroup.container")}; return ${elevation("$tokenGroup.container")};
})'''; })''';
} }
...@@ -72,20 +77,24 @@ class _TokenDefaultsM3 extends ButtonStyle { ...@@ -72,20 +77,24 @@ class _TokenDefaultsM3 extends ButtonStyle {
@override @override
MaterialStateProperty<Color?>? get foregroundColor => MaterialStateProperty<Color?>? get foregroundColor =>
MaterialStateProperty.resolveWith((Set<MaterialState> states) { MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) if (states.contains(MaterialState.disabled)) {
return ${componentColor('$tokenGroup.disabled.label-text')}; return ${componentColor('$tokenGroup.disabled.label-text')};
}
return ${componentColor('$tokenGroup.label-text')}; return ${componentColor('$tokenGroup.label-text')};
}); });
@override @override
MaterialStateProperty<Color?>? get overlayColor => MaterialStateProperty<Color?>? get overlayColor =>
MaterialStateProperty.resolveWith((Set<MaterialState> states) { MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.hovered)) if (states.contains(MaterialState.hovered)) {
return ${componentColor('$tokenGroup.hover.state-layer')}; return ${componentColor('$tokenGroup.hover.state-layer')};
if (states.contains(MaterialState.focused)) }
if (states.contains(MaterialState.focused)) {
return ${componentColor('$tokenGroup.focus.state-layer')}; return ${componentColor('$tokenGroup.focus.state-layer')};
if (states.contains(MaterialState.pressed)) }
if (states.contains(MaterialState.pressed)) {
return ${componentColor('$tokenGroup.pressed.state-layer')}; return ${componentColor('$tokenGroup.pressed.state-layer')};
}
return null; return null;
}); });
...@@ -122,8 +131,9 @@ ${tokens.containsKey("$tokenGroup.outline.color") ? ''' ...@@ -122,8 +131,9 @@ ${tokens.containsKey("$tokenGroup.outline.color") ? '''
@override @override
MaterialStateProperty<BorderSide>? get side => MaterialStateProperty<BorderSide>? get side =>
MaterialStateProperty.resolveWith((Set<MaterialState> states) { MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) if (states.contains(MaterialState.disabled)) {
return ${border("$tokenGroup.disabled.outline")}; return ${border("$tokenGroup.disabled.outline")};
}
return ${border("$tokenGroup.outline")}; return ${border("$tokenGroup.outline")};
});''' : ''' });''' : '''
// No default side'''} // No default side'''}
...@@ -135,8 +145,9 @@ ${tokens.containsKey("$tokenGroup.outline.color") ? ''' ...@@ -135,8 +145,9 @@ ${tokens.containsKey("$tokenGroup.outline.color") ? '''
@override @override
MaterialStateProperty<MouseCursor?>? get mouseCursor => MaterialStateProperty<MouseCursor?>? get mouseCursor =>
MaterialStateProperty.resolveWith((Set<MaterialState> states) { MaterialStateProperty.resolveWith((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) if (states.contains(MaterialState.disabled)) {
return SystemMouseCursors.basic; return SystemMouseCursors.basic;
}
return SystemMouseCursors.click; return SystemMouseCursors.click;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment