Skip to content

Commit

Permalink
Fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioLuciani committed Jul 20, 2020
1 parent 81db5bc commit dd6e673
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 210 deletions.
48 changes: 28 additions & 20 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.2

* Code formatting has been improved and minor issues solved.

## 0.2.1

* The support for password-encrypted PDF documents has been added.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Add this to your package's `pubspec.yaml` file:

```yaml
dependencies:
pdf_text: ^0.2.1
pdf_text: ^0.2.2
```
## Usage
Expand Down
113 changes: 58 additions & 55 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {

PDFDoc _pdfDoc;
String _text = "";

Expand All @@ -26,63 +25,67 @@ class _MyAppState extends State<MyApp> {
super.initState();
}



@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('PDF Text Example'),
),
body: Container(
alignment: Alignment.center,
padding: EdgeInsets.all(10),
child: ListView(
children: <Widget>[
FlatButton(
child: Text("Pick PDF document",
style: TextStyle(color: Colors.white),),
color: Colors.blueAccent,
onPressed: _pickPDFText,
padding: EdgeInsets.all(5),
),
FlatButton(
child: Text("Read random page",
style: TextStyle(color: Colors.white),),
color: Colors.blueAccent,
onPressed: _buttonsEnabled ? _readRandomPage : () {},
padding: EdgeInsets.all(5),
),
FlatButton(
child: Text("Read whole document",
style: TextStyle(color: Colors.white),),
color: Colors.blueAccent,
onPressed: _buttonsEnabled ? _readWholeDoc : () {},
padding: EdgeInsets.all(5),
),

Padding(
child: Text(_pdfDoc == null ? "Pick a new PDF document and wait for it to load..."
: "PDF document loaded, ${_pdfDoc.length} pages\n",
style: TextStyle(fontSize: 18),
textAlign: TextAlign.center,),
padding: EdgeInsets.all(15),
),
Padding(
child: Text(_text == "" ? "" : "Text:",
style: TextStyle(fontSize: 18),
textAlign: TextAlign.center,),
padding: EdgeInsets.all(15),
),
Text(_text),


],
appBar: AppBar(
title: const Text('PDF Text Example'),
),
)

),
body: Container(
alignment: Alignment.center,
padding: EdgeInsets.all(10),
child: ListView(
children: <Widget>[
FlatButton(
child: Text(
"Pick PDF document",
style: TextStyle(color: Colors.white),
),
color: Colors.blueAccent,
onPressed: _pickPDFText,
padding: EdgeInsets.all(5),
),
FlatButton(
child: Text(
"Read random page",
style: TextStyle(color: Colors.white),
),
color: Colors.blueAccent,
onPressed: _buttonsEnabled ? _readRandomPage : () {},
padding: EdgeInsets.all(5),
),
FlatButton(
child: Text(
"Read whole document",
style: TextStyle(color: Colors.white),
),
color: Colors.blueAccent,
onPressed: _buttonsEnabled ? _readWholeDoc : () {},
padding: EdgeInsets.all(5),
),
Padding(
child: Text(
_pdfDoc == null
? "Pick a new PDF document and wait for it to load..."
: "PDF document loaded, ${_pdfDoc.length} pages\n",
style: TextStyle(fontSize: 18),
textAlign: TextAlign.center,
),
padding: EdgeInsets.all(15),
),
Padding(
child: Text(
_text == "" ? "" : "Text:",
style: TextStyle(fontSize: 18),
textAlign: TextAlign.center,
),
padding: EdgeInsets.all(15),
),
Text(_text),
],
),
)),
);
}

Expand All @@ -102,7 +105,8 @@ class _MyAppState extends State<MyApp> {
_buttonsEnabled = false;
});

String text = await _pdfDoc.pageAt(Random().nextInt(_pdfDoc.length)+1).text;
String text =
await _pdfDoc.pageAt(Random().nextInt(_pdfDoc.length) + 1).text;

setState(() {
_text = text;
Expand All @@ -126,5 +130,4 @@ class _MyAppState extends State<MyApp> {
_buttonsEnabled = true;
});
}

}
76 changes: 17 additions & 59 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
# 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.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
Expand All @@ -36,34 +22,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
collection:
clock:
dependency: transitive
description:
name: collection
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.12"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
version: "1.0.1"
collection:
dependency: transitive
description:
name: crypto
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "1.14.12"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
file_picker:
dependency: "direct main"
description:
Expand Down Expand Up @@ -102,13 +88,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
matcher:
dependency: transitive
description:
Expand All @@ -129,7 +108,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
path_provider:
dependency: transitive
description:
Expand Down Expand Up @@ -157,21 +136,14 @@ packages:
path: ".."
relative: true
source: path
version: "0.2.1"
version: "0.2.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
Expand All @@ -186,13 +158,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -239,7 +204,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.16"
typed_data:
dependency: transitive
description:
Expand All @@ -254,13 +219,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.6.0 <3.0.0"
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
Loading

0 comments on commit dd6e673

Please sign in to comment.