Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
safer/lib/screens/safer_main_menu/stay_in_touch.dart
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
238 lines (232 sloc)
8.33 KB
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/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:url_launcher/url_launcher.dart'; | |
import 'package:safer/configs/config.dart'; | |
import 'package:safer/utils/utils.dart'; | |
class StayInTouch extends StatefulWidget { | |
final String title; | |
StayInTouch({Key key, this.title}) : super(key: key); | |
@override | |
_StayInTouchState createState() { | |
return _StayInTouchState(); | |
} | |
} | |
class _StayInTouchState extends State<StayInTouch> { | |
String location = UtilPreferences.getString(Preferences.location); | |
Map<String, String> townEmergencyLink = { | |
"Bridgeport": | |
"https://www.bridgeportct.gov/content/341307/341425/342901/342995.aspx", | |
"Milford": "https://www.ci.milford.ct.us/emergency-management-services", | |
"New Haven": | |
"https://www.newhavenct.gov/government/departments-divisions/office-of-emergency-management/resources-information-links", | |
"New London": | |
"https://newlondonct.org/content/8251/13617/default.aspx", | |
"Norwalk": "https://www.norwalkct.org/461/Important-Numbers", | |
}; | |
@override | |
void initState() { | |
super.initState(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
centerTitle: true, | |
title: Text( | |
widget.title, | |
), | |
), | |
body: ListView( | |
children: <Widget>[ | |
Card( | |
clipBehavior: Clip.antiAlias, | |
child: Column( | |
children: [ | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
ListTile( | |
leading: CircleAvatar( | |
backgroundImage: | |
AssetImage('assets/images/social_media.png')), | |
title: const Text('Social Media'), | |
subtitle: RichText( | |
text: TextSpan( | |
style: TextStyle( | |
color: Colors.blue.withOpacity(1), | |
fontFamily: 'Raleway', | |
height: 1.5), | |
text: 'Facebook', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch('https://www.facebook.com'); | |
}, | |
children: [ | |
TextSpan( | |
text: '\nTwitter', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch('https://www.twitter.com'); | |
}, | |
), | |
TextSpan( | |
text: '\nInstagram', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch('https://www.instagram.com'); | |
}, | |
), | |
TextSpan( | |
text: '\nReddit', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch('https://www.reddit.com'); | |
}, | |
), | |
TextSpan( | |
text: '\nTikTok', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch('https://www.tiktok.com'); | |
}, | |
) | |
], | |
), | |
)), | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
], | |
), | |
), | |
Card( | |
clipBehavior: Clip.antiAlias, | |
child: Column( | |
children: [ | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
ListTile( | |
leading: CircleAvatar( | |
backgroundImage: AssetImage('assets/images/police.png')), | |
title: const Text('Police, Fire, and Medical Emergency:'), | |
subtitle: Text( | |
'Call 911', | |
style: TextStyle( | |
color: Colors.blue.withOpacity(1), | |
fontFamily: 'Raleway'), | |
), | |
onTap: () { | |
launch('tel://911'); | |
}, | |
), | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
], | |
), | |
), | |
Card( | |
clipBehavior: Clip.antiAlias, | |
child: Column( | |
children: [ | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
ListTile( | |
leading: CircleAvatar( | |
backgroundImage: | |
AssetImage('assets/images/emergency.png')), | |
title: const Text('Emergency Needs'), | |
subtitle: Text( | |
'Call 211', | |
style: TextStyle( | |
color: Colors.blue.withOpacity(1), | |
fontFamily: 'Raleway'), | |
), | |
onTap: () { | |
launch('http://www.211ct.org/'); | |
}, | |
), | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
], | |
), | |
), | |
Card( | |
clipBehavior: Clip.antiAlias, | |
child: Column( | |
children: [ | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
ListTile( | |
leading: CircleAvatar( | |
backgroundImage: | |
AssetImage('assets/images/emergency-service.png')), | |
title: const Text('Emergency Service Center'), | |
subtitle: RichText( | |
text: TextSpan( | |
style: TextStyle( | |
color: Colors.blue.withOpacity(1), | |
fontFamily: 'Raleway'), | |
text: 'City of $location', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch(townEmergencyLink[location]); | |
}, | |
), | |
)), | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
], | |
), | |
), | |
Card( | |
clipBehavior: Clip.antiAlias, | |
child: Column( | |
children: [ | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
ListTile( | |
leading: CircleAvatar( | |
backgroundImage: | |
AssetImage('assets/images/resources.png')), | |
title: const Text('Resources'), | |
subtitle: RichText( | |
text: TextSpan( | |
style: TextStyle( | |
color: Colors.blue.withOpacity(1), | |
fontFamily: 'Raleway', | |
height: 1.5), | |
text: 'Get in Contact with FEMA', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch('https://www.fema.gov/about/contact'); | |
}, | |
children: [ | |
TextSpan( | |
text: '\nRed Cross Relief', | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
launch( | |
'https://www.redcross.org/get-help/disaster-relief-and-recovery-services.html'); | |
}, | |
) | |
], | |
), | |
)), | |
Padding( | |
padding: const EdgeInsets.all(8), | |
), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |