Skip to content

Commit ac37438

Browse files
authored
feat: added About Us screen (#2693)
1 parent bbbebce commit ac37438

File tree

6 files changed

+210
-1
lines changed

6 files changed

+210
-1
lines changed

assets/images/logo.png

7.43 KB
Loading

lib/constants.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,27 @@ String bluetooth = 'BLUETOOTH';
100100
String wifi = 'WIFI';
101101
String whatisPslab = 'What is PSLab Device?';
102102
String pslabUrl = 'https://pslab.io';
103+
104+
String aboutUs = 'About Us';
105+
String pslabDescription =
106+
'The goal of PSLab is to create an Open Source hardware device (open on all layers) that can be used for experiments by teachers, students and citizen scientists. Our tiny pocket lab provides an array of sensors for doing science and engineering experiments. It provides functions of numerous measurement devices including an oscilloscope, a waveform generator, a frequency generator, a frequency counter, a programmable voltage, current source and as a data logger.';
107+
String feedbackNBugs = 'Feedback & Bugs';
108+
String feedbackForm = 'https://goo.gl/forms/sHlmRAPFmzcGQ27u2';
109+
String website = 'https://pslab.io/';
110+
String github = 'https://github.com/fossasia/';
111+
String facebook = 'https://www.facebook.com/pslabio/';
112+
String x = 'https://x.com/pslabio/';
113+
String youtube = 'https://www.youtube.com/channel/UCQprMsG-raCIMlBudm20iLQ/';
114+
String mail = '[email protected]';
115+
String developers =
116+
'https://github.com/fossasia/pslab-android/graphs/contributors';
117+
List<String> connectWithUs = [
118+
'Connect with us',
119+
'Contact us',
120+
'Visit our website',
121+
'Fork us on GitHub',
122+
'Like us on Facebook',
123+
'Follow us on X',
124+
'Watch us on Youtube',
125+
'Developers'
126+
];

lib/main.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:pslab/view/connect_device_screen.dart';
66
import 'package:pslab/view/faq_screen.dart';
77
import 'package:pslab/view/instruments_screen.dart';
88
import 'package:pslab/view/oscilloscope_screen.dart';
9+
import 'package:pslab/view/about_us_screen.dart';
910

1011
import 'constants.dart';
1112

@@ -43,6 +44,7 @@ class MyApp extends StatelessWidget {
4344
'/oscilloscope': (context) => const OscilloscopeScreen(),
4445
'/connectDevice': (context) => const ConnectDeviceScreen(),
4546
'/faq': (context) => const FAQScreen(),
47+
'/aboutUs': (context) => const AboutUsScreen(),
4648
},
4749
);
4850
}

lib/view/about_us_screen.dart

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:pslab/constants.dart';
3+
import 'package:pslab/view/widgets/main_scaffold_widget.dart';
4+
import 'package:url_launcher/url_launcher.dart';
5+
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
6+
import 'package:package_info_plus/package_info_plus.dart';
7+
8+
class AboutUsScreen extends StatefulWidget {
9+
const AboutUsScreen({super.key});
10+
11+
@override
12+
State<StatefulWidget> createState() => _AboutUsScreenState();
13+
}
14+
15+
Widget buildContactList(List<Map<String, dynamic>> items) {
16+
return ListView.separated(
17+
physics: const NeverScrollableScrollPhysics(),
18+
shrinkWrap: true,
19+
itemCount: items.length,
20+
separatorBuilder: (_, __) => const Divider(thickness: 0.5, height: 1),
21+
itemBuilder: (context, index) {
22+
final item = items[index];
23+
return ListTile(
24+
leading: item['icon'] as Icon,
25+
title: Text(
26+
item['title'],
27+
style: const TextStyle(fontSize: 15),
28+
),
29+
onTap: () async {
30+
final uri = Uri.parse(item['url']);
31+
if (await canLaunchUrl(uri)) {
32+
await launchUrl(uri);
33+
} else {
34+
debugPrint('Could not launch ${item['url']}');
35+
}
36+
},
37+
);
38+
},
39+
);
40+
}
41+
42+
class _AboutUsScreenState extends State<AboutUsScreen> {
43+
String get iconAboutUs => 'assets/images/logo.png';
44+
final List<Map<String, dynamic>> contactItems = [
45+
{
46+
'icon': const Icon(Icons.mail),
47+
'title': connectWithUs[1],
48+
'url': 'mailto:$mail'
49+
},
50+
{'icon': const Icon(Icons.link), 'title': connectWithUs[2], 'url': website},
51+
{
52+
'icon': const Icon(FontAwesomeIcons.github, size: 20),
53+
'title': connectWithUs[3],
54+
'url': github
55+
},
56+
{
57+
'icon': const Icon(Icons.facebook_sharp),
58+
'title': connectWithUs[4],
59+
'url': facebook
60+
},
61+
{
62+
'icon': const Icon(FontAwesomeIcons.xTwitter, size: 20),
63+
'title': connectWithUs[5],
64+
'url': x
65+
},
66+
{
67+
'icon': const Icon(FontAwesomeIcons.youtube, size: 20),
68+
'title': connectWithUs[6],
69+
'url': youtube
70+
},
71+
{
72+
'icon': const Icon(Icons.person),
73+
'title': connectWithUs[7],
74+
'url': developers
75+
},
76+
];
77+
78+
@override
79+
Widget build(BuildContext context) {
80+
return MainScaffold(
81+
title: aboutUs,
82+
index: 5,
83+
body: SafeArea(
84+
child: Center(
85+
child: SingleChildScrollView(
86+
child: Column(
87+
mainAxisAlignment: MainAxisAlignment.center,
88+
children: [
89+
const SizedBox(
90+
height: 30,
91+
),
92+
Center(
93+
child: Image.asset(
94+
iconAboutUs,
95+
width: 250,
96+
height: 250,
97+
),
98+
),
99+
Center(
100+
child: Container(
101+
margin: const EdgeInsets.all(20),
102+
child: Text(
103+
pslabDescription,
104+
textAlign: TextAlign.center,
105+
style: const TextStyle(
106+
fontSize: 15,
107+
),
108+
),
109+
),
110+
),
111+
ListView(
112+
physics: const NeverScrollableScrollPhysics(),
113+
shrinkWrap: true,
114+
children: [
115+
ListTile(
116+
leading: const Icon(Icons.link),
117+
title: Text(feedbackNBugs,
118+
style: const TextStyle(
119+
fontSize: 15,
120+
)),
121+
onTap: () async {
122+
await launchUrl(Uri.parse(feedbackForm));
123+
},
124+
),
125+
const Divider(
126+
thickness: 0.5,
127+
height: 1,
128+
),
129+
ListTile(
130+
leading: const Icon(Icons.widgets),
131+
title: FutureBuilder<PackageInfo>(
132+
future: PackageInfo.fromPlatform(),
133+
builder: (BuildContext context,
134+
AsyncSnapshot<PackageInfo> snapshot) {
135+
if (snapshot.hasData) {
136+
return Text(
137+
snapshot.data!.version,
138+
style: const TextStyle(
139+
fontSize: 15,
140+
),
141+
);
142+
} else {
143+
return const Text(
144+
'Loading...',
145+
style: TextStyle(
146+
fontSize: 15,
147+
),
148+
);
149+
}
150+
}),
151+
)
152+
],
153+
),
154+
Container(
155+
margin: const EdgeInsets.only(left: 15, top: 10, bottom: 10),
156+
alignment: Alignment.centerLeft,
157+
child: Text(
158+
connectWithUs[0],
159+
style: const TextStyle(
160+
fontSize: 16,
161+
fontWeight: FontWeight.w300,
162+
),
163+
),
164+
),
165+
buildContactList(contactItems)
166+
],
167+
),
168+
))),
169+
);
170+
}
171+
}

lib/view/widgets/navigation_drawer.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,16 @@ class _NavDrawerState extends State<NavDrawer> {
191191
),
192192
),
193193
onTap: () {
194-
/**/
194+
if (Navigator.canPop(context) &&
195+
ModalRoute.of(context)?.settings.name == '/aboutUs') {
196+
Navigator.popUntil(context, ModalRoute.withName('/aboutUs'));
197+
} else {
198+
Navigator.pushNamedAndRemoveUntil(
199+
context,
200+
'/aboutUs',
201+
(route) => route.isFirst,
202+
);
203+
}
195204
},
196205
),
197206
ListTile(

pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ dependencies:
5252
permission_handler: ^11.3.1
5353
logger: ^2.5.0
5454
url_launcher: ^6.3.1
55+
font_awesome_flutter: ^10.8.0
56+
package_info_plus: ^8.3.0
57+
5558

5659
dev_dependencies:
5760
flutter_test:

0 commit comments

Comments
 (0)