binSaed / flutter_cached_pdfview

Enhanced PDF view for Flutter.
https://pub.dev/packages/flutter_cached_pdfview
MIT License
121 stars 70 forks source link

Nightmode only Changing on rebuild #41

Open isiko opened 3 years ago

isiko commented 3 years ago

Describe the bug I can only change the Nightmode Setting only if I rebuild the complete App, if I do a hot Restart or Reload it does not change. I can also not set it to a variable and change that. (not by hardcoding it and also not with setState({})

To Reproduce My Widget:

class PDFViewerPage extends StatefulWidget {

  PDFViewerPage(this.url);
  final url;

  @override
  _PDFViewerPageState createState() => _PDFViewerPageState(url);
}

class _PDFViewerPageState extends State<PDFViewerPage> {
  _PDFViewerPageState(this.url);
  final url;
  final bool nightmode = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.transparent,
      body: PDF(
        nightMode: nightmode,
      ).cachedFromUrl(
        url,
        placeholder: (progress) => Center(
          child: SpinKitWave(
            color: thomaeumRot,
          ),
        ),
        errorWidget: (error) => ErrorMessageWidget(),
      ),
    );
  }
}

Desktop (please complete the following information):

Smartphone (please complete the following information):