Skip to content

Commit

Permalink
Merge pull request erluxman#25 from devj3ns/null_safety
Browse files Browse the repository at this point in the history
Update dependencies and some minor improvements
  • Loading branch information
erluxman authored Mar 4, 2021
2 parents 2c4548e + 9696094 commit bc68c1e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include: package:pedantic/analysis_options.yaml
# Here are some examples:
linter:
rules:
prefer_single_quotes: false
# Good packages document everything
public_member_api_docs: false

Expand Down
22 changes: 11 additions & 11 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PdfApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text("pdf_flutter demo"),
title: const Text('pdf_flutter demo'),
),
body: PDFListBody(),
),
Expand All @@ -33,51 +33,51 @@ class _PDFListBodyState extends State<PDFListBody> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
child: const Text("Pdf from asset"),
onPressed: () {
_navigateToPage(
title: "Pdf from asset",
title: 'Pdf from asset',
child: PDF.asset(
"assets/pdf/demo.pdf",
placeHolder: Image.asset("assets/images/pdf.png",
'assets/pdf/demo.pdf',
placeHolder: Image.asset('assets/images/pdf.png',
height: 200, width: 100),
),
);
},
child: const Text('Pdf from asset'),
),
ElevatedButton(
child: const Text("Pdf from network"),
onPressed: () {
_navigateToPage(
title: "Pdf from networkUrl",
title: 'Pdf from networkUrl',
child: PDF.network(
'https://google-developer-training.github.io/android-developer-fundamentals-course-concepts/en/android-developer-fundamentals-course-concepts-en.pdf',
),
);
},
child: const Text('Pdf from network'),
),
Builder(
builder: (context) {
return ElevatedButton(
child: const Text("PDF from file"),
onPressed: () async {
final file = await FilePicker.platform.pickFiles(
allowedExtensions: ['pdf'], type: FileType.custom);
if (file?.files[0].path != null) {
_navigateToPage(
title: "PDF from file",
title: 'PDF from file',
child: PDF.file(
File(file!.files[0].path!),
),
);
} else {
Scaffold.of(context).showSnackBar(
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Failed to load Picked file"),
content: Text('Failed to load Picked file'),
),
);
}
},
child: const Text('PDF from file'),
);
},
)
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.1

environment:
sdk: '>=2.12.0-0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
sdk: flutter
file_picker: ^3.0.0-nullsafety.2
file_picker: ^3.0.0-nullsafety.4
pdf_flutter:
path: ../

Expand Down
6 changes: 3 additions & 3 deletions lib/pdf_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class _PDFState extends State<PDF> {
'Cannot get filename because networkURL and assetsPath is null.');
}
}
final result = input.replaceAll(RegExp(r'[^a-zA-Z0-9]'), "");
final result = input.replaceAll(RegExp(r'[^a-zA-Z0-9]'), '');
return result;
}

Expand Down Expand Up @@ -165,7 +165,7 @@ class _PDFState extends State<PDF> {
child: PdfViewer(
filePath: path!,
onPdfViewerCreated: () {
debugPrint("PDF view created");
debugPrint('PDF view created');
},
),
)
Expand Down Expand Up @@ -195,8 +195,8 @@ typedef void PdfViewerCreatedCallback();

class PdfViewer extends StatefulWidget {
const PdfViewer({
Key? key,
required this.filePath,
Key? key,
this.onPdfViewerCreated,
}) : super(key: key);

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: 2.0.0
homepage: https://github.com/erluxman/pdf_flutter

environment:
sdk: '>=2.12.0-0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.10.0"

dependencies:
Expand All @@ -17,7 +17,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.10.0
pedantic: ^1.11.0

flutter:
plugin:
Expand Down

0 comments on commit bc68c1e

Please sign in to comment.