ontimehaulers/lib/screens/setup_screen.dart

55 lines
1.5 KiB
Dart
Raw Normal View History

2024-11-05 12:29:06 +00:00
import 'package:flutter/material.dart';
import 'package:ontime_haulers/widgets/custom_navigation_bar.dart';
import 'package:pdfx/pdfx.dart';
import 'package:internet_file/internet_file.dart';
import 'package:url_launcher/url_launcher.dart';
Uri _url1 = Uri.parse('https://ontimehaulers.com.au/wp-content/uploads/2024/05/OTH-Credit-Account-Application.pdf');
class SetupScreen extends StatelessWidget {
final int selectedIndex;
final void Function(int) onItemTapped;
final pdfPinchController = PdfControllerPinch(
document: PdfDocument.openData(InternetFile.get('https://ontimehaulers.com.au/wp-content/uploads/2024/05/OTH-Credit-Account-Application.pdf')),
);
SetupScreen({
super.key,
required this.selectedIndex,
required this.onItemTapped,
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Set Up An Account'),
actions: [
IconButton(
onPressed: _launchUrl1,
icon: Icon(Icons.download)
)
],
backgroundColor: Colors.red,
foregroundColor: Colors.white,
),
body: Center(
child: PdfViewPinch(
controller: pdfPinchController,
),
),
bottomNavigationBar: CustomNavigationBar(
selectedIndex: selectedIndex,
onItemTapped: onItemTapped,
),
);
}
}
Future<void> _launchUrl1() async {
if (!await launchUrl(_url1)) {
throw Exception('Could not launch $_url1');
}
}