Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/navigation color #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_plugin_pdf_viewer","dependencies":["path_provider"]},{"name":"path_provider","dependencies":[]},{"name":"sqflite","dependencies":[]}]}
10 changes: 10 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/bezzo/Mobile/flutter-sdk"
export "FLUTTER_APPLICATION_PATH=/Users/bezzo/Mobile/Product/Flutter/flutter_plugin_pdf_viewer/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/bezzo/Mobile/flutter-sdk/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
47 changes: 34 additions & 13 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
charcode:
dependency: transitive
description:
Expand Down Expand Up @@ -42,7 +56,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.1.3"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -102,6 +116,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
infinite_listview:
dependency: transitive
description:
Expand All @@ -115,14 +136,14 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.1.8"
numberpicker:
dependency: transitive
description:
Expand All @@ -136,7 +157,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
version: "1.6.4"
path_drawing:
dependency: transitive
description:
Expand Down Expand Up @@ -164,21 +185,21 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.5"
rxdart:
dependency: transitive
description:
Expand Down Expand Up @@ -225,7 +246,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
synchronized:
dependency: transitive
description:
Expand All @@ -246,7 +267,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.11"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -274,7 +295,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1"
version: "3.5.0"
sdks:
dart: ">=2.2.2 <3.0.0"
dart: ">=2.4.0 <3.0.0"
flutter: ">=1.6.0 <2.0.0"
22 changes: 16 additions & 6 deletions lib/src/viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class PDFViewer extends StatefulWidget {
final bool showPicker;
final bool showNavigation;
final PDFViewerTooltip tooltip;
final Color backgroundNavigation;
final Color iconNavigation;
final Color backgorundPickPage;
final Color iconPickPage;

PDFViewer(
{Key key,
Expand All @@ -24,7 +28,11 @@ class PDFViewer extends StatefulWidget {
this.showPicker = true,
this.showNavigation = true,
this.tooltip = const PDFViewerTooltip(),
this.indicatorPosition = IndicatorPosition.topRight})
this.indicatorPosition = IndicatorPosition.topRight,
this.backgroundNavigation = Colors.white,
this.iconNavigation = Colors.black,
this.backgorundPickPage,
this.iconPickPage})
: super(key: key);

_PDFViewerState createState() => _PDFViewerState();
Expand Down Expand Up @@ -131,9 +139,10 @@ class _PDFViewerState extends State<PDFViewer> {
),
floatingActionButton: widget.showPicker
? FloatingActionButton(
backgroundColor: (widget.backgorundPickPage != null) ? widget.backgorundPickPage : Theme.of(context).primaryColor,
elevation: 4.0,
tooltip: widget.tooltip.jump,
child: Icon(Icons.view_carousel),
child: Icon(Icons.view_carousel, color: (widget.iconPickPage != null) ? widget.iconPickPage : Colors.white),
onPressed: () {
_pickPage();
},
Expand All @@ -142,12 +151,13 @@ class _PDFViewerState extends State<PDFViewer> {
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: (widget.showNavigation || widget.document.count > 1)
? BottomAppBar(
color: widget.backgroundNavigation,
child: new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: IconButton(
icon: Icon(Icons.first_page),
icon: Icon(Icons.first_page, color: widget.iconNavigation),
tooltip: widget.tooltip.first,
onPressed: () {
_pageNumber = 1;
Expand All @@ -157,7 +167,7 @@ class _PDFViewerState extends State<PDFViewer> {
),
Expanded(
child: IconButton(
icon: Icon(Icons.chevron_left),
icon: Icon(Icons.chevron_left, color: widget.iconNavigation),
tooltip: widget.tooltip.previous,
onPressed: () {
_pageNumber--;
Expand All @@ -173,7 +183,7 @@ class _PDFViewerState extends State<PDFViewer> {
: SizedBox(width: 1),
Expanded(
child: IconButton(
icon: Icon(Icons.chevron_right),
icon: Icon(Icons.chevron_right, color: widget.iconNavigation),
tooltip: widget.tooltip.next,
onPressed: () {
_pageNumber++;
Expand All @@ -186,7 +196,7 @@ class _PDFViewerState extends State<PDFViewer> {
),
Expanded(
child: IconButton(
icon: Icon(Icons.last_page),
icon: Icon(Icons.last_page, color: widget.iconNavigation),
tooltip: widget.tooltip.last,
onPressed: () {
_pageNumber = widget.document.count;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.1.8"
numberpicker:
dependency: "direct main"
description:
Expand Down