Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.x'
channel: 'stable'

- name: Get dependencies
run: flutter pub get

- name: Check formatting
run: dart format --output=none --set-exit-if-changed .

- name: Analyze code
run: flutter analyze --fatal-infos

- name: Run tests
run: flutter test
2 changes: 1 addition & 1 deletion example/lib/examples/asset_pdf_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _AssetPdfExampleState extends State<AssetPdfExample> {
// Load PDF from assets
final ByteData data = await rootBundle.load('assets/sample.pdf');
final Uint8List bytes = data.buffer.asUint8List();

await _controller.loadFromBytes(bytes);
setState(() {
_isLoading = false;
Expand Down
13 changes: 7 additions & 6 deletions example/lib/examples/custom_controls_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class CustomControlsExample extends StatefulWidget {
class _CustomControlsExampleState extends State<CustomControlsExample> {
final PdfController _controller = PdfController();
final TextEditingController _urlController = TextEditingController(
text: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
text:
'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
);

@override
Expand All @@ -33,7 +34,7 @@ class _CustomControlsExampleState extends State<CustomControlsExample> {
final timestamp = DateTime.now().millisecondsSinceEpoch;
final filename = 'pdf_$timestamp.pdf';
final path = await _controller.downloadPdf(filename);

if (path != null && mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
Expand Down Expand Up @@ -127,9 +128,8 @@ class _CustomControlsExampleState extends State<CustomControlsExample> {
children: [
// Previous page button
ElevatedButton.icon(
onPressed: _controller.currentPage > 0
? _controller.previousPage
: null,
onPressed:
_controller.currentPage > 0 ? _controller.previousPage : null,
icon: const Icon(Icons.chevron_left),
label: const Text('Previous'),
style: ElevatedButton.styleFrom(
Expand All @@ -154,7 +154,8 @@ class _CustomControlsExampleState extends State<CustomControlsExample> {
// Next page button
ElevatedButton.icon(
onPressed: _controller.document != null &&
_controller.currentPage < _controller.document!.pageCount - 1
_controller.currentPage <
_controller.document!.pageCount - 1
? _controller.nextPage
: null,
icon: const Icon(Icons.chevron_right),
Expand Down
3 changes: 2 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class PdfViewerDemo extends StatefulWidget {
class _PdfViewerDemoState extends State<PdfViewerDemo> {
final PdfController _controller = PdfController();
final TextEditingController _urlController = TextEditingController(
text: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
text:
'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
);

@override
Expand Down
Loading