123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import 'package:flutter/material.dart';
- import 'package:kmpdfkit_demo/widgets/compdfkit/compdfkit_widget.dart';
- import 'package:kmpdfkit_demo/widgets/events.dart';
- import 'package:kmpdfkit_demo/widgets/page_routes.dart';
- import '../function/annot_tool_list_widget.dart';
- /// pdf_page_widget.dart
- ///
- /// Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
- ///
- /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
- /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
- /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
- /// This notice may not be removed from this file.
- class PDFPageWidget extends StatefulWidget {
- final String? documentPath;
- final dynamic configuration;
- const PDFPageWidget({
- Key? key,
- this.documentPath,
- this.configuration,
- }) : super(key: key);
- @override
- State<PDFPageWidget> createState() => _PDFPageWidgetState();
- }
- class _PDFPageWidgetState extends State<PDFPageWidget> {
- bool _fullScreen = false;
- bool isInit = false;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Stack(
- children: [
- SafeArea(
- child: ComPDFKitWidget(
- documentPath: widget.documentPath,
- configuration: widget.configuration,
- onComPDFKitWidgetCreate: () {
- setState(() {
- isInit = true;
- });
- setReaderViewCallbackListener(onTapMainDocArea: () {
- setState(() {
- _fullScreen = !_fullScreen;
- });
- });
- },
- )),
- Builder(builder: (context) {
- return Positioned(
- top: 0,
- left: 0,
- right: 0,
- child: AnimatedOpacity(
- opacity: _fullScreen ? 0.0 : 1.0,
- duration: const Duration(milliseconds: 200),
- child: AppBar(
- actions: [
- IconButton(
- onPressed: () {
- Navigator.pushNamed(context, PageRoutes.settings);
- },
- icon: const Icon(Icons.more_vert))
- ],
- )));
- }),
- Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: AnimatedOpacity(
- opacity: _fullScreen ? 0.0 : 1.0,
- duration: const Duration(milliseconds: 200),
- child: isInit
- ? const PDFBottomAnnotFunWidget()
- : Container(
- color: const Color(0xFFEFF4FD),
- width: double.infinity,
- height: 60))),
- ],
- ),
- );
- }
- }
|