Skip to content

Commit

Permalink
feat(prescribed_result): add tts service to announce result if screen…
Browse files Browse the repository at this point in the history
… reader is not enabled
  • Loading branch information
becooq81 committed May 20, 2024
1 parent 34bc7b3 commit a386512
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:pillkaboo/src/app/tts/tts_service.dart';

import '../../../../styles/pillkaboo_theme.dart';
import '../../../../../core/pillkaboo_util.dart';
import '../../../../widgets/index.dart' as widgets;
Expand All @@ -22,6 +24,7 @@ class PrescribedMedResultPageWidget extends StatefulWidget {

class _CheckRestResultPageWidgetState extends State<PrescribedMedResultPageWidget> {
late PrescribedMedResultPageModel _model;
late String imgPath;

final scaffoldKey = GlobalKey<ScaffoldState>();

Expand All @@ -30,6 +33,18 @@ class _CheckRestResultPageWidgetState extends State<PrescribedMedResultPageWidge
super.initState();
GlobalAudioPlayer().playOnce();
_model = createModel(context, () => PrescribedMedResultPageModel());
if (PKBAppState().slotOfDay == "아침") {
imgPath = 'assets/images/morning.png';
} else if (PKBAppState().slotOfDay == "점심") {
imgPath = 'assets/images/lunch.png';
} else if (PKBAppState().slotOfDay == "저녁") {
imgPath = 'assets/images/night.png';
} else {
imgPath = 'assets/images/warning.svg';
}
if (!PKBAppState().useScreenReader) {
TtsService().speak('이 약은 ${PKBAppState().slotOfDay} 약입니다. ${PKBAppState().infoPrescribedDate}에 처방받은 약입니다.');
}
}

@override
Expand All @@ -51,17 +66,6 @@ class _CheckRestResultPageWidgetState extends State<PrescribedMedResultPageWidge
);
}

String imgPath;
if (PKBAppState().slotOfDay == "아침") {
imgPath = 'assets/images/morning.png';
} else if (PKBAppState().slotOfDay == "점심") {
imgPath = 'assets/images/lunch.png';
} else if (PKBAppState().slotOfDay == "저녁") {
imgPath = 'assets/images/night.png';
} else {
imgPath = 'assets/images/warning.svg';
}


double appBarFontSize = 32.0/892.0 * MediaQuery.of(context).size.height;

Expand Down

0 comments on commit a386512

Please sign in to comment.