Comments (4)
hi @pheromone
today I don't have I time to debugging to detect the issue
but send to me an example of your code and I will help you as fast
from flutter_cached_pdfview.
好的,这是我的完整代码。
Okay, here's my complete code.
import 'dart:typed_data';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_drag_scale/core/drag_scale_widget.dart';
import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart';
import 'package:nav_router/nav_router.dart';
import 'package:oktoast/oktoast.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart';
class LookPdfFile extends StatefulWidget {
@override
_LookPdfFileState createState() => _LookPdfFileState();
}
class _LookPdfFileState extends State<LookPdfFile> {
GlobalKey _rootWidgetKey = GlobalKey();
List<Uint8List> _images = List();
/*
* 截图 + 保存
* */
_capturePng() async {
try {
RenderRepaintBoundary boundary =
_rootWidgetKey.currentContext.findRenderObject();
var image = await boundary.toImage(pixelRatio: 3.0);
ByteData byteData = await image.toByteData(format: ImageByteFormat.png);
final result =
await ImageGallerySaver.saveImage(byteData.buffer.asUint8List());
showToast('图片已经保存至相册');
} catch (e) {
print(e);
}
return null;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Stack(
children: [
// pdf + 截屏
SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: RepaintBoundary(
key: _rootWidgetKey,
child: Stack(
children: [
DragScaleContainer(
doubleTapStillScale: true,
child: PDF().cachedFromUrl(
'http://africau.edu/images/default/sample.pdf',
placeholder: (progress) =>
Center(child: Text('$progress %')),
errorWidget: (error) =>
Center(child: Text(error.toString())),
),
),
Positioned(
top: MediaQuery.of(context).size.height / 2,
left: MediaQuery.of(context).size.width / 2,
child: Icon(
Icons.arrow_downward,
color: Colors.blue,
),
),
],
),
),
),
Positioned(
top: 0,
left: 0,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.only(left: 10),
child: InkWell(
onTap: () {
pop(_images);
},
child: Text(
'< 返回',
style: TextStyle(
fontSize: 18,
color: Colors.blue,
),
),
),
),
Padding(
padding: EdgeInsets.only(right: 10),
child: InkWell(
onTap: _capturePng,
child: Icon(
Icons.camera_alt,
color: Colors.blue,
),
),
),
],
),
),
],
),
),
);
}
}
from flutter_cached_pdfview.
This will help https://www.youtube.com/watch?v=gAUVz0U7eyA
from flutter_cached_pdfview.
@okbye123 thank you~
from flutter_cached_pdfview.
Related Issues (20)
- Error: 'Uint8List' isn't a type. HOT 2
- Memory leak HOT 3
- Feature Request: Choose Pages to Display from External PDFs
- How to increase zoom level
- Progress on placeholder not work on small file size
- Connection closed before full header was received
- ال pdf لا يستجيب
- Handshake Error
- initial zoom at the PDF document in IOS HOT 3
- Failed to build IOS HOT 2
- package can't swipe vertical in only android. CASE : more than one page Pdf. HOT 1
- How to use controller options? HOT 1
- Thanks for this great library. 🙏❤️ HOT 1
- How to open link inside the pdf in webviewinstead of opening in external browser (Chrome)
- Pdf page search by number
- PDF preview fails for release mode - No implementation found for long com.shockwave.pdfium.PdfiumCore.o
- Execution failed for task ':flutter_pdfview:verifyReleaseResources'. HOT 4
- navbar and appbar become white after opening the view on iOS
- Upgrade http dependency to support latest version HOT 3
- Adding scroll to number and bookmarking
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_cached_pdfview.