/
about_button.dart
138 lines (133 loc) · 4.25 KB
/
about_button.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ip_notices/services/locator.dart';
import 'package:ip_notices/services/theme_service.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutButton extends StatelessWidget {
const AboutButton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final _themeService = locator<ThemeService>();
return Card(
elevation: 0,
color: Colors.transparent,
child: IconButton(
padding: const EdgeInsets.only(bottom: 2),
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
splashColor: Colors.transparent,
onPressed: () {
showCupertinoDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) => const AboutDialog());
},
icon: const Icon(
// NeumorphicTheme.isUsingDark(context)
// ? CupertinoIcons.info
// :
CupertinoIcons.info,
),
color: _themeService.onBackground(context),
iconSize: 20,
),
);
}
}
class AboutDialog extends StatelessWidget {
const AboutDialog({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final _themeService = locator<ThemeService>();
return CupertinoAlertDialog(
title: const Text("GGSIPU Notices v1.2.0-beta+14"),
content: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const Padding(
padding: EdgeInsets.only(top: 20),
child: Text("Developed and Maintained by"),
),
Padding(
padding: const EdgeInsets.fromLTRB(10, 20, 10, 20),
child: Material(
elevation: 0,
color: _themeService.onBackground(context).withOpacity(0.1),
borderRadius: BorderRadius.circular(20),
child: ListTile(
leading: Container(
padding: const EdgeInsets.only(right: 12.0),
decoration: BoxDecoration(
border: Border(
right: BorderSide(
width: 1.0,
color: _themeService
.onBackground(context)
.withOpacity(0.24),
),
),
),
child: const CircleAvatar(
backgroundImage: AssetImage("assets/images/dev.png"),
)),
title: Text(
"Abhay Maurya",
style: TextStyle(
color:
_themeService.onBackground(context).withOpacity(0.9),
fontWeight: FontWeight.bold),
),
subtitle: Text(
"ECE, USICT",
style: TextStyle(
color:
_themeService.onBackground(context).withOpacity(0.9)),
),
),
),
),
const Text(
"This is an unofficial app.\nPlease give the repository a star if you like this app. 👍",
style: TextStyle(fontSize: 12),
),
],
),
actions: <Widget>[
CupertinoDialogAction(
child: const Text("Github"),
onPressed: () {
Navigator.of(context).pop();
String link = "https://www.github.com/LiquidatorCoder";
_launchURL(link);
},
),
CupertinoDialogAction(
child: const Text("LinkedIn"),
onPressed: () {
Navigator.of(context).pop();
String link = "https://www.linkedin.com/in/liquidatorcoder/";
_launchURL(link);
},
),
CupertinoDialogAction(
isDestructiveAction: true,
child: const Text("Back"),
onPressed: () {
Navigator.of(context).pop();
},
)
],
);
}
_launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
}