SankethBK / diaryvault

A personal diary application written in Flutter
https://play.google.com/store/apps/details?id=me.sankethbk.dairyapp
MIT License
86 stars 59 forks source link

Updated the file by adding pause button functionality and created read_notes.dart in widgets directory. #62

Closed Night-Amber3301 closed 11 months ago

Night-Amber3301 commented 11 months ago

solves: #60

Updated the file by adding pause button functionality and created read_notes.dart in widgets directory

SankethBK commented 11 months ago

I'm sorry that's not what I meant by creating a new widget for the IconButton. There are multiple syntax errors. Feel free to pick easier issues if you need to ramp up with Flutter syntax

Night-Amber3301 commented 11 months ago

Yeah sure, actually I'm new to open-source and learned a lot from your project, thanks for your time and consideration. Will continue my journey with more beginner-friendly issues.

SankethBK commented 11 months ago

No worries, your code is pretty close to a working solution. It's just that you need to encapsulate this widget into a new stateful widget which will hold the state variable isPlaying.

 IconButton(
              icon: isPlaying ? Icon(Icons.pause) : Icon(Icons.play_arrow),
              onPressed: () {
              if (isPlaying) {
                _pause();
              }     
              else  
              {
                _speak(notesBloc.state.title! + ". " + notesBloc.state.controller!.document.toPlainText());
              }
              setState(() {
                isPlaying = !isPlaying;
                });
              },
            )
SankethBK commented 11 months ago

I will refactor your code. I have changed the target branch. You can check this issue for a simpler one

Night-Amber3301 commented 11 months ago

Thank you sir.