Skip to content

Commit

Permalink
feat(control_tts): audio slider only appears if user is not using scr…
Browse files Browse the repository at this point in the history
…een reader
  • Loading branch information
becooq81 committed May 20, 2024
1 parent a386512 commit c43c030
Showing 1 changed file with 69 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,70 +112,81 @@ class _ControlTTSPageWidgetState extends State<ControlTTSPageWidget> {
child: ExcludeSemantics(
excluding: true,
child: GestureDetector(
onTap: () {
setState(() {
PKBAppState().useScreenReader = !PKBAppState().useScreenReader;
});
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'스크린 리더 사용 여부',
style: TextStyle(
fontSize: 27,
color: PKBAppState().secondaryColor,
fontWeight: FontWeight.bold,
onTap: () {
setState(() {
PKBAppState().useScreenReader = !PKBAppState().useScreenReader;
if (!PKBAppState().useScreenReader) {
TtsService().stop();
TtsService().speak("스크린 리더를 사용하지 않습니다.");
} else {
TtsService().stop();
TtsService().speak("스크린 리더를 사용합니다.");
}
});
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'스크린 리더 사용 여부',
style: TextStyle(
fontSize: 27,
color: PKBAppState().secondaryColor,
fontWeight: FontWeight.bold,
),
),
),
Switch(
value: PKBAppState().useScreenReader,
focusColor: PKBAppState().primaryColor,
activeColor: PKBAppState().primaryColor,
onChanged: (bool value) {
setState(() {
PKBAppState().useScreenReader = value;
});
},
),
],
Switch(
value: PKBAppState().useScreenReader,
focusColor: PKBAppState().primaryColor,
activeColor: PKBAppState().primaryColor,
onChanged: (bool value) {
setState(() {
PKBAppState().useScreenReader = value;
});
},
),
],
),
),
),
),
),
),
const SizedBox(height: 20.0),
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0), // Optional padding
child: Text(
'현재 오디오 속도: $sliderValue',
style: TextStyle(
fontSize: textSize,
color: PKBAppState().secondaryColor,
fontWeight: FontWeight.bold,
),
),
),

ExcludeSemantics(
excluding: true,
child: Slider(
value: selectedIndex.toDouble(),
min: 0,
max: values.length - 1.toDouble(),
divisions: values.length - 1,
label: values[selectedIndex].toString(),
activeColor: PKBAppState().primaryColor,
onChanged: PKBAppState().useScreenReader ? null : (double value) {
setState(() {
selectedIndex = value.toInt();
handleSliderChange(values[selectedIndex]);
});
},
),
if (!PKBAppState().useScreenReader)
Column(
children: [
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10.0), // Optional padding
child: Text(
'현재 오디오 속도: $sliderValue',
style: TextStyle(
fontSize: textSize,
color: PKBAppState().secondaryColor,
fontWeight: FontWeight.bold,
),
),
),
ExcludeSemantics(
excluding: true,
child: Slider(
value: selectedIndex.toDouble(),
min: 0,
max: values.length - 1.toDouble(),
divisions: values.length - 1,
label: values[selectedIndex].toString(),
activeColor: PKBAppState().primaryColor,
onChanged: (double value) {
setState(() {
selectedIndex = value.toInt();
handleSliderChange(values[selectedIndex]);
});
},
),
),
],
),
],
),
Expand Down

0 comments on commit c43c030

Please sign in to comment.