212 lines
7.9 KiB
Dart
212 lines
7.9 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:ontime_haulers/widgets/custom_navigation_bar.dart';
|
||
|
import 'package:url_launcher/url_launcher.dart';
|
||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||
|
|
||
|
Uri _url1 = Uri.parse('https://ontimehaulers.com.au/');
|
||
|
Uri _url2 = Uri.parse('https://www.facebook.com/ontime.haulers');
|
||
|
Uri _url3 = Uri.parse('https://www.instagram.com/ontime.haulers/');
|
||
|
Uri _url4 = Uri.parse('https://twitter.com/ontimehaulers');
|
||
|
Uri _url5 = Uri.parse('https://www.linkedin.com/company/ontime-haulers-pty-ltd/');
|
||
|
Uri _url6 = Uri.parse('https://www.pinterest.com/ontimehaulers');
|
||
|
Uri _url7 = Uri.parse('tel:+61734969510');
|
||
|
Uri _url8 = Uri.parse('mailto:contact@ontimehaulers.com.au');
|
||
|
|
||
|
|
||
|
class HomeScreen extends StatelessWidget {
|
||
|
final int selectedIndex;
|
||
|
final void Function(int) onItemTapped;
|
||
|
const HomeScreen({
|
||
|
super.key,
|
||
|
required this.selectedIndex,
|
||
|
required this.onItemTapped,
|
||
|
});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: const Text('Home'),
|
||
|
actions: [
|
||
|
IconButton(onPressed: (){
|
||
|
showDialog(
|
||
|
context: context,
|
||
|
builder: (BuildContext context) {
|
||
|
return AlertDialog(
|
||
|
title: const Center(child: Text("Useful Links", style: TextStyle(fontWeight: FontWeight.bold))),
|
||
|
content: SizedBox(
|
||
|
child: Column(
|
||
|
mainAxisSize: MainAxisSize.min,
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
children: [
|
||
|
const Row(mainAxisAlignment: MainAxisAlignment.center, children: [IconButton(onPressed: _launchUrl1, icon: Row(children: [Icon(Icons.language, color: Colors.blue), Text(' Official Website', style: TextStyle(color: Colors.blue))]))]),
|
||
|
const Text('\nGet Help', style: TextStyle(fontWeight: FontWeight.bold)),
|
||
|
const Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: [
|
||
|
IconButton(onPressed: _launchUrl7, icon: Row(children: [Icon(Icons.call, color: Colors.blue), Text(' Call', style: TextStyle(color: Colors.blue))])),
|
||
|
IconButton(onPressed: _launchUrl8, icon: Row(children: [Icon(Icons.email, color: Colors.blue), Text(' Email', style: TextStyle(color: Colors.blue))])),
|
||
|
],
|
||
|
),
|
||
|
const Text('\nSocials', style: TextStyle(fontWeight: FontWeight.bold)),
|
||
|
Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: [
|
||
|
const IconButton(onPressed: _launchUrl2, icon: FaIcon(FontAwesomeIcons.facebook, color: Colors.blue)),
|
||
|
const IconButton(onPressed: _launchUrl3, icon: FaIcon(FontAwesomeIcons.instagram, color: Colors.blue)),
|
||
|
const IconButton(onPressed: _launchUrl4, icon: FaIcon(FontAwesomeIcons.xTwitter, color: Colors.blue)),
|
||
|
],
|
||
|
),
|
||
|
const Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: [
|
||
|
IconButton(onPressed: _launchUrl5, icon: FaIcon(FontAwesomeIcons.linkedin, color: Colors.blue)),
|
||
|
IconButton(onPressed: _launchUrl6, icon: FaIcon(FontAwesomeIcons.pinterest, color: Colors.blue)),
|
||
|
],
|
||
|
)
|
||
|
],
|
||
|
)
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
);
|
||
|
},
|
||
|
icon: Icon(Icons.info))
|
||
|
],
|
||
|
backgroundColor: Colors.red,
|
||
|
foregroundColor: Colors.white,
|
||
|
),
|
||
|
body: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||
|
children: [
|
||
|
Align(
|
||
|
alignment: Alignment.center,
|
||
|
child: SizedBox(height: 80.0, child: Image(image: AssetImage('assets/ontime-haulers-logo-final.png'), fit: BoxFit.contain,))
|
||
|
),
|
||
|
Align(
|
||
|
alignment: Alignment.center,
|
||
|
child: ElevatedButton(
|
||
|
style: ElevatedButton.styleFrom(
|
||
|
foregroundColor: Colors.white,
|
||
|
backgroundColor: Colors.red,
|
||
|
minimumSize: Size(300, 80),
|
||
|
textStyle: TextStyle(fontSize: 20),
|
||
|
elevation: 20,
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.circular(10),
|
||
|
),
|
||
|
),
|
||
|
child: const Text('Get A Quote'),
|
||
|
onPressed: () {
|
||
|
onItemTapped(1);
|
||
|
},
|
||
|
)
|
||
|
),
|
||
|
Align(
|
||
|
alignment: Alignment.center,
|
||
|
child: ElevatedButton(
|
||
|
style: ElevatedButton.styleFrom(
|
||
|
foregroundColor: Colors.white,
|
||
|
backgroundColor: Colors.red,
|
||
|
minimumSize: Size(300, 80),
|
||
|
textStyle: TextStyle(fontSize: 20),
|
||
|
elevation: 20,
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.circular(10),
|
||
|
),
|
||
|
),
|
||
|
child: const Text('Tracking'),
|
||
|
onPressed: () {
|
||
|
onItemTapped(2);
|
||
|
},
|
||
|
)
|
||
|
),
|
||
|
Align(
|
||
|
alignment: Alignment.center,
|
||
|
child: ElevatedButton(
|
||
|
style: ElevatedButton.styleFrom(
|
||
|
foregroundColor: Colors.white,
|
||
|
backgroundColor: Colors.red,
|
||
|
minimumSize: Size(300, 80),
|
||
|
textStyle: TextStyle(fontSize: 20),
|
||
|
elevation: 20,
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.circular(10),
|
||
|
),
|
||
|
),
|
||
|
child: const Text('Customer Login'),
|
||
|
onPressed: () {
|
||
|
onItemTapped(3);
|
||
|
},
|
||
|
)
|
||
|
),
|
||
|
Align(
|
||
|
alignment: Alignment.center,
|
||
|
child: ElevatedButton(
|
||
|
style: ElevatedButton.styleFrom(
|
||
|
foregroundColor: Colors.white,
|
||
|
backgroundColor: Colors.red,
|
||
|
minimumSize: Size(300, 80),
|
||
|
textStyle: TextStyle(fontSize: 20),
|
||
|
elevation: 20,
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.circular(10),
|
||
|
),
|
||
|
),
|
||
|
child: const Text('Set Up An Account'),
|
||
|
onPressed: () {
|
||
|
onItemTapped(4);
|
||
|
},
|
||
|
)
|
||
|
)
|
||
|
]
|
||
|
),
|
||
|
bottomNavigationBar: CustomNavigationBar(
|
||
|
selectedIndex: selectedIndex,
|
||
|
onItemTapped: onItemTapped,
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Future<void> _launchUrl1() async {
|
||
|
if (!await launchUrl(_url1)) {
|
||
|
throw Exception('Could not launch $_url1');
|
||
|
}
|
||
|
}
|
||
|
Future<void> _launchUrl2() async {
|
||
|
if (!await launchUrl(_url2)) {
|
||
|
throw Exception('Could not launch $_url2');
|
||
|
}
|
||
|
}
|
||
|
Future<void> _launchUrl3() async {
|
||
|
if (!await launchUrl(_url3)) {
|
||
|
throw Exception('Could not launch $_url3');
|
||
|
}
|
||
|
}
|
||
|
Future<void> _launchUrl4() async {
|
||
|
if (!await launchUrl(_url4)) {
|
||
|
throw Exception('Could not launch $_url4');
|
||
|
}
|
||
|
}
|
||
|
Future<void> _launchUrl5() async {
|
||
|
if (!await launchUrl(_url5)) {
|
||
|
throw Exception('Could not launch $_url5');
|
||
|
}
|
||
|
}
|
||
|
Future<void> _launchUrl6() async {
|
||
|
if (!await launchUrl(_url6)) {
|
||
|
throw Exception('Could not launch $_url6');
|
||
|
}
|
||
|
}
|
||
|
Future<void> _launchUrl7() async {
|
||
|
if (!await launchUrl(_url7)) {
|
||
|
throw Exception('Could not launch $_url7');
|
||
|
}
|
||
|
}
|
||
|
Future<void> _launchUrl8() async {
|
||
|
if (!await launchUrl(_url8)) {
|
||
|
throw Exception('Could not launch $_url8');
|
||
|
}
|
||
|
}
|