binSaed / flutter_cached_pdfview

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

ال pdf لا يستجيب #106

Open tillawiy opened 10 months ago

tillawiy commented 10 months ago

السلام عليكم استاذ عبدالرحمن الزر الموجود فى الappbar ليس له اى تأثير على الرغم انه يعمل ومن المفترض ان يقوم بتغيير الوضع الى الوضع الليلى .. وعند تغيير القيمه يدويا فى الكود لا يحدث تغيير الا بعد الخروج من الصفحه والدخول مجددا هل من حل.. وشكرا

// ignore_for_file: prefer_const_constructors, avoid_print, unused_element, unused_field

import 'package:flutter/material.dart'; import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';

class Z2 extends StatefulWidget { const Z2({Key? key}) : super(key: key);

@override State createState() => _ManzomaState(); }

class _ManzomaState extends State {

bool isValue = false; int _adad = 0; double _currentPage = 0; int _totalPages = 0; PDFViewController? _pdfController;

void _hesab() { setState(() { _adad++; }); }

void _e3adh() { setState(() { _adad = 0; }); }

void onPageChanged(int? page, int? total) { setState(() { _currentPage = page?.toDouble() ?? 0.0; }); }

void jumpToPage(int page) { setState(() { _currentPage = page.toDouble(); _pdfController?.setPage(page); }); }

@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( iconTheme: IconThemeData(color: Colors.white), title: FittedBox( child: Text( "صلوات الأمان ", style: TextStyle( color: Color.fromARGB(249, 243, 246, 245), fontFamily: "a3", fontSize: 22.sp, fontWeight: FontWeight.w700, ), ), ), actions: [ IconButton( icon: Icon( isValue ? Icons.nightlight_round : Icons.sunny, color: Colors.white, ), onPressed: () { setState(() { isValue = !isValue; }); }, ), ], centerTitle: true, backgroundColor: Color.fromARGB(255, 15, 88, 48), elevation: 20, shadowColor: Color.fromARGB(255, 163, 255, 187), ), body: Stack( children: [ Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: MediaQuery.of(context).size.height * 0.02, ), ], ), PDF( pageSnap: false, defaultPage: 0, preventLinkNavigation: true,

        nightMode: isValue,
        fitEachPage: false,
        enableSwipe: true,
        swipeHorizontal: false,

        pageFling: false,
        autoSpacing: false,
        onRender: (pages) {
          setState(() {
            _totalPages = pages!;
          });
          print('Total Pages: $_totalPages');
          _pdfController?.setPage(_currentPage.round());
        },
        onPageChanged: onPageChanged,
      ).fromAsset('assets/pdfs/pdf_zaad/z2.pdf'),