123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- ///
- /// 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.
- import 'package:flutter/material.dart';
- class CPDFActions {
- static CPDFActionWidget thumbnail({CPDFActionOnPressedCallback? onPressed}) {
- return CPDFActionWidget(
- image: 'assets/images/ic_thumbnail.png',
- package: 'compdfkit_flutter',
- onPressed: onPressed,
- );
- }
- static CPDFActionWidget search({CPDFActionOnPressedCallback? onPressed}) {
- return CPDFActionWidget(
- image: 'assets/images/ic_search.png',
- package: 'compdfkit_flutter',
- onPressed: onPressed,
- );
- }
- static CPDFActionWidget bota({CPDFActionOnPressedCallback? onPressed}) {
- return CPDFActionWidget(
- image: 'assets/images/ic_book.png',
- package: 'compdfkit_flutter',
- onPressed: onPressed,
- );
- }
- static CPDFActionWidget more({CPDFActionOnPressedCallback? onPressed}) {
- return CPDFActionWidget(
- image: 'assets/images/ic_more.png',
- package: 'compdfkit_flutter',
- onPressed: onPressed,
- );
- }
- }
- typedef CPDFActionOnPressedCallback = Function(BuildContext context);
- class CPDFActionWidget extends StatelessWidget {
- final String image;
- final String package;
- final CPDFActionOnPressedCallback? onPressed;
- const CPDFActionWidget(
- {Key? key,
- required this.image,
- this.package = 'compdfkit_flutter',
- this.onPressed})
- : super(key: key);
- @override
- Widget build(BuildContext context) {
- return IconButton(
- splashRadius: 24,
- onPressed: () {
- if (onPressed != null) {
- onPressed!(context);
- }
- },
- icon: Image.asset(
- image,
- package: package,
- width: 24,
- height: 24,
- color: Theme.of(context).colorScheme.onBackground,
- ));
- }
- }
|