-
Notifications
You must be signed in to change notification settings - Fork 12
/
emergency_view.dart
50 lines (44 loc) · 1.77 KB
/
emergency_view.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:webview_flutter/webview_flutter.dart';
// Project imports:
import 'package:notredame/features/app/presentation/webview_controller_extension.dart';
import 'package:notredame/utils/utils.dart';
import 'package:notredame/utils/app_theme.dart';
class EmergencyView extends StatefulWidget {
final String title;
final String description;
const EmergencyView(this.title, this.description);
@override
_EmergencyViewState createState() => _EmergencyViewState();
}
class _EmergencyViewState extends State<EmergencyView> {
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: Text(widget.title)),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
Utils.launchURL(
'tel:${AppIntl.of(context)!.security_emergency_number}',
AppIntl.of(context)!)
.catchError((error) {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(error.toString())));
});
},
label: Text(
AppIntl.of(context)!.security_reach_security,
style: const TextStyle(color: Colors.white, fontSize: 20),
),
icon: const Icon(Icons.phone, size: 30, color: Colors.white),
backgroundColor: AppTheme.etsLightRed,
),
body: WebViewWidget(
controller: WebViewControllerExtension(WebViewController())
..loadHtmlFromAssets(
widget.description, Theme.of(context).brightness)),
);
}