fix accessibility issues (#1224)

wow-support
Serhii 6 months ago committed by GitHub
parent faf151a4dc
commit 049e4def27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,7 +76,7 @@ class DisplaySettingsPage extends BasePage {
}, },
), ),
if (responsiveLayoutUtil.shouldRenderMobileUI && DeviceInfo.instance.isMobile) if (responsiveLayoutUtil.shouldRenderMobileUI && DeviceInfo.instance.isMobile)
SettingsThemeChoicesCell(_displaySettingsViewModel), Semantics(label: S.current.color_theme, child: SettingsThemeChoicesCell(_displaySettingsViewModel)),
], ],
), ),
); );

@ -54,57 +54,61 @@ class SettingsThemeChoicesCell extends StatelessWidget {
return Padding( return Padding(
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: GestureDetector( child: Semantics(
onTap: () { label: e.toString(),
_displaySettingsViewModel.setTheme(e); selected: isSelected,
}, child: GestureDetector(
child: Container( onTap: () {
padding: EdgeInsets.all(5), _displaySettingsViewModel.setTheme(e);
decoration: BoxDecoration( },
borderRadius: BorderRadius.circular(cellRadius), child: Container(
border: isSelected padding: EdgeInsets.all(5),
? Border.all( decoration: BoxDecoration(
color: Theme.of(context).primaryColor) borderRadius: BorderRadius.circular(cellRadius),
: null, border: isSelected
color: Theme.of(context) ? Border.all(
.extension<CakeTextTheme>()! color: Theme.of(context).primaryColor)
.secondaryTextColor : null,
.withOpacity( color: Theme.of(context)
currentTheme.brightness == Brightness.light .extension<CakeTextTheme>()!
? 0.1 .secondaryTextColor
: 0.3), .withOpacity(
), currentTheme.brightness == Brightness.light
child: Row( ? 0.1
mainAxisAlignment: MainAxisAlignment.center, : 0.3),
children: [ ),
Container( child: Row(
padding: EdgeInsets.symmetric( mainAxisAlignment: MainAxisAlignment.center,
horizontal: cellWidth, vertical: cellHeight), children: [
decoration: BoxDecoration( Container(
borderRadius: BorderRadius.only( padding: EdgeInsets.symmetric(
topLeft: Radius.circular(cellRadius), horizontal: cellWidth, vertical: cellHeight),
bottomLeft: Radius.circular(cellRadius)), decoration: BoxDecoration(
color: e.themeData.primaryColor, borderRadius: BorderRadius.only(
topLeft: Radius.circular(cellRadius),
bottomLeft: Radius.circular(cellRadius)),
color: e.themeData.primaryColor,
),
), ),
), Container(
Container( padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: cellWidth, vertical: cellHeight),
horizontal: cellWidth, vertical: cellHeight), decoration: BoxDecoration(
decoration: BoxDecoration( color: e.themeData.colorScheme.background,
color: e.themeData.colorScheme.background, ),
), ),
), Container(
Container( padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: cellWidth, vertical: cellHeight),
horizontal: cellWidth, vertical: cellHeight), decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.only(
borderRadius: BorderRadius.only( topRight: Radius.circular(cellRadius),
topRight: Radius.circular(cellRadius), bottomRight: Radius.circular(cellRadius)),
bottomRight: Radius.circular(cellRadius)), color: e.themeData.cardColor,
color: e.themeData.cardColor, ),
), ),
), ],
], ),
), ),
), ),
), ),

@ -14,25 +14,29 @@ class StandardSwitch extends StatefulWidget {
class StandardSwitchState extends State<StandardSwitch> { class StandardSwitchState extends State<StandardSwitch> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector(
onTap: widget.onTaped, return Semantics(
child: AnimatedContainer( toggled: widget.value,
padding: EdgeInsets.only(left: 2.0, right: 2.0), child: GestureDetector(
alignment: widget.value ? Alignment.centerRight : Alignment.centerLeft, onTap: widget.onTaped,
duration: Duration(milliseconds: 250), child: AnimatedContainer(
width: 50, padding: EdgeInsets.only(left: 2.0, right: 2.0),
height: 28, alignment: widget.value ? Alignment.centerRight : Alignment.centerLeft,
decoration: BoxDecoration( duration: Duration(milliseconds: 250),
color: widget.value width: 50,
? Theme.of(context).primaryColor height: 28,
: Theme.of(context).disabledColor,
borderRadius: BorderRadius.all(Radius.circular(14.0))),
child: Container(
width: 24.0,
height: 24.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: widget.value
shape: BoxShape.circle), ? Theme.of(context).primaryColor
: Theme.of(context).disabledColor,
borderRadius: BorderRadius.all(Radius.circular(14.0))),
child: Container(
width: 24.0,
height: 24.0,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle),
),
), ),
), ),
); );

Loading…
Cancel
Save