mirror of
https://github.com/gskinnerTeam/flutter-wonderous-app.git
synced 2025-05-19 22:06:36 +08:00
Merge branch 'accessability-pass' into accessibility-pass-semanticslabels
This commit is contained in:
@ -7,6 +7,7 @@ class AppColors {
|
||||
/// Common
|
||||
final Color accent1 = Color(0xFFE4935D);
|
||||
final Color accent2 = Color(0xFFBEABA1);
|
||||
final Color accent3 = Color(0xFFC47642);
|
||||
final Color offWhite = Color(0xFFF8ECE5);
|
||||
final Color caption = const Color(0xFF7D7873);
|
||||
final Color body = const Color(0xFF514F4D);
|
||||
|
@ -155,7 +155,7 @@ class AppBtn extends StatelessWidget {
|
||||
),
|
||||
if (focus.hasFocus)
|
||||
Positioned.fill(
|
||||
child: IgnorePointerWithSemantics(
|
||||
child: IgnorePointerKeepSemantics(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular($styles.corners.md),
|
||||
|
@ -65,7 +65,7 @@ class ScrollDecorator extends StatefulWidget {
|
||||
bgBuilder = null;
|
||||
fgBuilder = (controller) {
|
||||
final double ratio = controller.hasClients ? min(1, controller.position.extentBefore / 60) : 0;
|
||||
return IgnorePointerWithSemantics(
|
||||
return IgnorePointerKeepSemantics(
|
||||
child: Container(
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
|
@ -24,25 +24,23 @@ class GradientContainer extends StatelessWidget {
|
||||
final BorderRadius? borderRadius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ExcludeSemantics(
|
||||
child: IgnorePointerWithSemantics(
|
||||
child: Container(
|
||||
width: width,
|
||||
height: height,
|
||||
alignment: alignment,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: begin ?? Alignment.centerLeft,
|
||||
end: end ?? Alignment.centerRight,
|
||||
colors: colors,
|
||||
stops: stops,
|
||||
),
|
||||
backgroundBlendMode: blendMode,
|
||||
borderRadius: borderRadius,
|
||||
Widget build(BuildContext context) => IgnorePointerAndSemantics(
|
||||
child: Container(
|
||||
width: width,
|
||||
height: height,
|
||||
alignment: alignment,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: begin ?? Alignment.centerLeft,
|
||||
end: end ?? Alignment.centerRight,
|
||||
colors: colors,
|
||||
stops: stops,
|
||||
),
|
||||
child: child,
|
||||
backgroundBlendMode: blendMode,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
)
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,32 @@
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:wonders/common_libs.dart';
|
||||
|
||||
class IgnorePointerWithSemantics extends SingleChildRenderObjectWidget {
|
||||
const IgnorePointerWithSemantics({super.key, super.child});
|
||||
class IgnorePointerKeepSemantics extends SingleChildRenderObjectWidget {
|
||||
const IgnorePointerKeepSemantics({super.key, super.child});
|
||||
|
||||
@override
|
||||
RenderIgnorePointerWithSemantics createRenderObject(BuildContext context) {
|
||||
return RenderIgnorePointerWithSemantics();
|
||||
RenderIgnorePointerKeepSemantics createRenderObject(BuildContext context) {
|
||||
return RenderIgnorePointerKeepSemantics();
|
||||
}
|
||||
}
|
||||
|
||||
class RenderIgnorePointerWithSemantics extends RenderProxyBox {
|
||||
RenderIgnorePointerWithSemantics();
|
||||
class RenderIgnorePointerKeepSemantics extends RenderProxyBox {
|
||||
RenderIgnorePointerKeepSemantics();
|
||||
|
||||
@override
|
||||
bool hitTest(BoxHitTestResult result, { required Offset position }) => false;
|
||||
}
|
||||
|
||||
class IgnorePointerAndSemantics extends StatelessWidget {
|
||||
final Widget child;
|
||||
const IgnorePointerAndSemantics({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ExcludeSemantics(
|
||||
child: IgnorePointer(
|
||||
child: child
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ class _BottomTextContent extends StatelessWidget {
|
||||
Gap($styles.insets.md),
|
||||
Column(
|
||||
children: [
|
||||
IgnorePointerWithSemantics(
|
||||
IgnorePointerKeepSemantics(
|
||||
child: Semantics(
|
||||
button: true,
|
||||
onIncrease: () => state._handleArtifactTap(_currentPage + 1),
|
||||
|
@ -131,19 +131,19 @@ class _SearchInput extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Gap($styles.insets.xs * 1.5),
|
||||
Icon(Icons.search, color: $styles.colors.caption),
|
||||
Icon(Icons.search, color: captionColor),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
onSubmitted: onSubmit,
|
||||
controller: textController,
|
||||
focusNode: focusNode,
|
||||
style: TextStyle(color: captionColor, ),
|
||||
style: TextStyle(color: $styles.colors.greyStrong),
|
||||
textAlignVertical: TextAlignVertical.top,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.all($styles.insets.xs),
|
||||
labelStyle: TextStyle(color: captionColor),
|
||||
hintStyle: TextStyle(color: captionColor.withOpacity(0.5)),
|
||||
hintStyle: TextStyle(color: $styles.colors.body),
|
||||
prefixStyle: TextStyle(color: captionColor),
|
||||
focusedBorder: OutlineInputBorder(borderSide: BorderSide.none),
|
||||
enabledBorder: UnderlineInputBorder(borderSide: BorderSide.none),
|
||||
|
@ -133,7 +133,7 @@ class _AnimatedCircleWithTextState extends State<_AnimatedCircleWithText> with S
|
||||
Widget _buildCircularText(String title) {
|
||||
final textStyle = $styles.text.monoTitleFont.copyWith(
|
||||
fontSize: 22 * $styles.scale,
|
||||
color: $styles.colors.accent1,
|
||||
color: $styles.colors.accent3,
|
||||
);
|
||||
return CircularText(
|
||||
position: CircularTextPosition.inside,
|
||||
|
@ -18,7 +18,7 @@ class _LargeSimpleQuote extends StatelessWidget {
|
||||
child: Text(
|
||||
'“',
|
||||
style: $styles.text.quote1.copyWith(
|
||||
color: $styles.colors.accent1,
|
||||
color: $styles.colors.accent3,
|
||||
fontSize: 90 * $styles.scale,
|
||||
height: .7,
|
||||
),
|
||||
@ -32,7 +32,7 @@ class _LargeSimpleQuote extends StatelessWidget {
|
||||
Gap($styles.insets.md),
|
||||
Text(
|
||||
'- $author',
|
||||
style: $styles.text.quote2Sub.copyWith(color: $styles.colors.accent1),
|
||||
style: $styles.text.quote2Sub.copyWith(color: $styles.colors.accent3),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -43,7 +43,7 @@ class _ScrollingContent extends StatelessWidget {
|
||||
dropChar,
|
||||
overflow: TextOverflow.visible,
|
||||
style: $styles.text.dropCase.copyWith(
|
||||
color: $styles.colors.accent1,
|
||||
color: $styles.colors.accent3,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
@ -52,7 +52,7 @@ class _ScrollingContent extends StatelessWidget {
|
||||
style: $styles.text.body,
|
||||
dropCapPadding: EdgeInsets.only(right: 6),
|
||||
dropCapStyle: $styles.text.dropCase.copyWith(
|
||||
color: $styles.colors.accent1,
|
||||
color: $styles.colors.accent3,
|
||||
height: 1,
|
||||
),
|
||||
)
|
||||
@ -242,7 +242,7 @@ class _MapsThumbnailState extends State<_MapsThumbnail> {
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(child: ColoredBox(color: Colors.transparent)),
|
||||
IgnorePointerWithSemantics(
|
||||
IgnorePointerKeepSemantics(
|
||||
child: GoogleMap(
|
||||
markers: {getMapsMarker(startPos.target)},
|
||||
zoomControlsEnabled: false,
|
||||
|
@ -213,7 +213,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
Widget _buildFgAndGradients() {
|
||||
Widget buildSwipeableBgGradient(Color fgColor) {
|
||||
return _swipeController.buildListener(builder: (swipeAmt, isPointerDown, _) {
|
||||
return IgnorePointerWithSemantics(
|
||||
return IgnorePointerKeepSemantics(
|
||||
child: FractionallySizedBox(
|
||||
heightFactor: .6,
|
||||
child: Container(
|
||||
@ -251,7 +251,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
return Animate(
|
||||
effects: const [FadeEffect()],
|
||||
onPlay: _handleFadeAnimInit,
|
||||
child: IgnorePointerWithSemantics(child: WonderIllustration(e.type, config: config)));
|
||||
child: IgnorePointerKeepSemantics(child: WonderIllustration(e.type, config: config)));
|
||||
});
|
||||
}),
|
||||
|
||||
@ -280,7 +280,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
||||
|
||||
/// Title Content
|
||||
LightText(
|
||||
child: IgnorePointerWithSemantics(
|
||||
child: IgnorePointerKeepSemantics(
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, 30),
|
||||
child: Column(
|
||||
|
@ -114,7 +114,7 @@ class _IntroScreenState extends State<IntroScreen> {
|
||||
),
|
||||
),
|
||||
|
||||
IgnorePointerWithSemantics(
|
||||
IgnorePointerKeepSemantics(
|
||||
child: Column(children: [
|
||||
Spacer(),
|
||||
|
||||
|
@ -292,7 +292,7 @@ class _PhotoGalleryState extends State<PhotoGallery> {
|
||||
Positioned.fill(
|
||||
child: AnimatedOpacity(
|
||||
duration: $styles.times.med,
|
||||
opacity: isSelected ? 0 : .7,
|
||||
opacity: isSelected ? 0 : ($styles.highContrast ? 0.4 : 0.7),
|
||||
child: ColoredBox(color: $styles.colors.black),
|
||||
),
|
||||
),
|
||||
|
@ -31,7 +31,7 @@ class _AnimatedCutoutOverlay extends StatelessWidget {
|
||||
effects: [CustomEffect(builder: _buildAnimatedCutout, curve: Curves.easeOut, duration: duration)],
|
||||
key: animationKey,
|
||||
onComplete: (c) => c.reverse(),
|
||||
child: IgnorePointerWithSemantics(child: Container(color: Colors.black.withOpacity(opacity))),
|
||||
child: IgnorePointerKeepSemantics(child: Container(color: Colors.black.withOpacity(opacity))),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -54,7 +54,7 @@ class _EventMarkersState extends State<_EventMarkers> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointerWithSemantics(
|
||||
return IgnorePointerKeepSemantics(
|
||||
child: LayoutBuilder(builder: (_, constraints) {
|
||||
/// Figure out which event is "selected"
|
||||
_updateSelectedEvent(constraints.maxHeight);
|
||||
|
@ -35,7 +35,7 @@ class _EventPopupsState extends State<_EventPopups> {
|
||||
final evt = _eventToShow;
|
||||
return TopCenter(
|
||||
child: ClipRect(
|
||||
child: IgnorePointerWithSemantics(
|
||||
child: IgnorePointerKeepSemantics(
|
||||
child: AnimatedSwitcher(
|
||||
duration: $styles.times.fast,
|
||||
child: evt == null
|
||||
|
@ -69,7 +69,7 @@ class _ScalingViewportState extends State<_ScrollingViewport> {
|
||||
_buildScrollingArea(context).maybeAnimate().fadeIn(),
|
||||
|
||||
// Dashed line with a year that changes as we scroll
|
||||
IgnorePointerWithSemantics(
|
||||
IgnorePointerKeepSemantics(
|
||||
child: AnimatedBuilder(
|
||||
animation: controller.scroller,
|
||||
builder: (_, __) {
|
||||
|
@ -20,7 +20,7 @@ class TimelineSection extends StatelessWidget {
|
||||
StringUtils.formatYr(data.startYr),
|
||||
StringUtils.formatYr(data.endYr),
|
||||
)}',
|
||||
child: IgnorePointerWithSemantics(
|
||||
child: IgnorePointerKeepSemantics(
|
||||
child: Container(
|
||||
alignment: Alignment(0, -1 + fraction * 2),
|
||||
padding: EdgeInsets.all($styles.insets.xs),
|
||||
|
@ -13,7 +13,7 @@ class _YearMarkers extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointerWithSemantics(
|
||||
return IgnorePointerKeepSemantics(
|
||||
child: LayoutBuilder(builder: (_, constraints) {
|
||||
int interval = 100;
|
||||
if (constraints.maxHeight < 800) {
|
||||
|
@ -64,7 +64,7 @@ class _EventsListState extends State<_EventsList> {
|
||||
key: PageStorageKey('eventsList'),
|
||||
child: Column(
|
||||
children: [
|
||||
IgnorePointerWithSemantics(child: Gap(widget.topHeight)),
|
||||
IgnorePointerKeepSemantics(child: Gap(widget.topHeight)),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: $styles.colors.black,
|
||||
@ -120,7 +120,7 @@ class _EventsListState extends State<_EventsList> {
|
||||
if (showBackdrop) ...[
|
||||
AppBackdrop(
|
||||
strength: backdropAmt,
|
||||
child: IgnorePointerWithSemantics(
|
||||
child: IgnorePointerKeepSemantics(
|
||||
child: Container(
|
||||
color: $styles.colors.black.withOpacity(backdropAmt * .6),
|
||||
),
|
||||
|
Reference in New Issue
Block a user