Last active
February 24, 2019 16:27
-
-
Save piedcipher/407966623c6c5bc7ae4bf912192b802d to your computer and use it in GitHub Desktop.
Project 1 - ABND Projects with Flutter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:url_launcher/url_launcher.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
final String _busniessUrl = "http://www.piedpiper.com"; | |
final String _businessLocation = "https://goo.gl/maps/Lnh3S5x82VG2"; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: "Pied Piper", | |
color: Colors.green[800], | |
home: Scaffold( | |
body: Container( | |
color: Colors.green[800], | |
child: ListView( | |
children: <Widget>[ | |
// Business Photo - Image | |
Image.asset("assets/piedpiper_header.png"), | |
// Business Tagline 1 - Text | |
aboutBusiness( | |
text: "Go Small or Go Home", | |
textSize: 24, | |
fontWeight: FontWeight.bold), | |
// Business Tageline 2 - Text | |
aboutBusiness( | |
text: | |
"A Middle-out Compression Solution to make Data Storage Problems smaller. We take compression to a new level with Weissman Score of 5.2", | |
textSize: 20, | |
fontStyle: FontStyle.italic), | |
// Divider | |
Container( | |
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 4), | |
child: Divider( | |
color: Colors.white, | |
), | |
), | |
// Business Contact 1 - ListTile | |
contactBusiness( | |
text: "piedpiper.com", url: _busniessUrl, icon: Icons.public), | |
// Busniss Contact 2 - ListTile | |
contactBusiness( | |
text: "5230 Penfield Ave, Woodland Hills, CA", | |
url: _businessLocation, | |
icon: Icons.location_on), | |
], | |
), | |
), | |
), | |
); | |
} | |
// Returns a widget, used to display Business Taglines | |
Widget aboutBusiness( | |
{@required String text, | |
@required double textSize, | |
FontWeight fontWeight, | |
FontStyle fontStyle}) { | |
return Container( | |
margin: EdgeInsets.all(16), | |
child: Text( | |
text, | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: textSize, | |
fontWeight: fontWeight, | |
fontStyle: fontStyle, | |
), | |
textAlign: TextAlign.center, | |
), | |
); | |
} | |
// Returns a widget, used to display Business Contacts | |
Widget contactBusiness( | |
{@required String text, @required String url, @required IconData icon}) { | |
return Container( | |
margin: EdgeInsets.all(8), | |
child: ListTile( | |
leading: Icon( | |
icon, | |
color: Colors.white, | |
), | |
onTap: () => launchUrl(url), | |
title: Text( | |
text, | |
style: TextStyle( | |
color: Colors.white, | |
fontWeight: FontWeight.bold, | |
fontSize: 19, | |
), | |
), | |
), | |
); | |
} | |
// Helper method to launch a URL | |
void launchUrl(String url) async { | |
if (await canLaunch(url)) { | |
await launch(url); | |
} else { | |
throw 'Can\'t launch $url'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment