Skip to content

Instantly share code, notes, and snippets.

View Classy-Bear's full-sized avatar
🎩
Doing magic, speaking to goblins

David Acevedo Classy-Bear

🎩
Doing magic, speaking to goblins
  • Scotiabank
  • Dominican Republic
  • 07:52 (UTC -04:00)
View GitHub Profile
Future<void> _listaAutenticacionesDisponibles() async {
List<BiometricType> listaAutenticacion;
try {
listaAutenticacion = await _autenticacion.getAvailableBiometrics();
} on PlatformException catch (e) {
print(e);
}
if (!mounted) return;
Future<void> _autorizar() async {
bool isAuthorized = false;
try {
isAuthorized = await _autenticacion.authenticateWithBiometrics(
localizedReason: "Autentíquese para completar su transacción",
useErrorDialogs: true,
stickyAuth: true,
);
} on PlatformException catch (e) {
print(e);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Hala para refrescar"),
),
body: RefreshIndicator(
key: refreshKey,
child: ListView.builder(
itemCount: lista.length,
import 'dart:math';
final random = Random();
final refreshKey = GlobalKey<RefreshIndicatorState>();
var lista = [];
Future<Null> refreshList() async {
refreshKey.currentState?.show(atTop: false);
await Future.delayed(Duration(seconds: 1));
setState(() {
@override
void initState() {
refreshList();
super.initState();
}
Future<File> getFileFromAsset(String asset) async {
try {
var data = await rootBundle.load(asset);
var bytes = data.buffer.asUint8List();
var dir = await getApplicationDocumentsDirectory();
File file = File("${dir.path}/mi_archivo.pdf");
File assetFile = await file.writeAsBytes(bytes);
return assetFile;
} catch (e) {
throw Exception("Error al abrir el archivo");
String assetPDFPath = "";
String urlPDFPath = "";
@override
void initState() {
super.initState();
getFileFromAsset("assets/mypdf.pdf").then((f) {
setState(() {
assetPDFPath = f.path;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Abrir pdf"),
),
body: Center(
child: Builder(
builder: (context) => Column(
class PdfViewPage extends StatefulWidget {
final String path;
const PdfViewPage({Key key, this.path}) : super(key: key);
@override
_PdfViewPageState createState() => _PdfViewPageState();
}
class _PdfViewPageState extends State<PdfViewPage> {
int _total_de_paginas = 0;
import 'dart:math';
var list;
var random;
var refreshKey = GlobalKey<RefreshIndicatorState>();