Skip to content

feat: added About Us screen #2693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,27 @@ String bluetooth = 'BLUETOOTH';
String wifi = 'WIFI';
String whatisPslab = 'What is PSLab Device?';
String pslabUrl = 'https://pslab.io';

String aboutUs = 'About Us';
String pslabDescription =
'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.';
String feedbackNBugs = 'Feedback & Bugs';
String feedbackForm = 'https://goo.gl/forms/sHlmRAPFmzcGQ27u2';
String website = 'https://pslab.io/';
String github = 'https://github.com/fossasia/';
String facebook = 'https://www.facebook.com/pslabio/';
String x = 'https://x.com/pslabio/';
String youtube = 'https://www.youtube.com/channel/UCQprMsG-raCIMlBudm20iLQ/';
String mail = '[email protected]';
String developers =
'https://github.com/fossasia/pslab-android/graphs/contributors';
List<String> connectWithUs = [
'Connect with us',
'Contact us',
'Visit our website',
'Fork us on GitHub',
'Like us on Facebook',
'Follow us on X',
'Watch us on Youtube',
'Developers'
];
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:pslab/view/connect_device_screen.dart';
import 'package:pslab/view/faq_screen.dart';
import 'package:pslab/view/instruments_screen.dart';
import 'package:pslab/view/oscilloscope_screen.dart';
import 'package:pslab/view/about_us_screen.dart';

import 'constants.dart';

Expand Down Expand Up @@ -43,6 +44,7 @@ class MyApp extends StatelessWidget {
'/oscilloscope': (context) => const OscilloscopeScreen(),
'/connectDevice': (context) => const ConnectDeviceScreen(),
'/faq': (context) => const FAQScreen(),
'/aboutUs': (context) => const AboutUsScreen(),
},
);
}
Expand Down
171 changes: 171 additions & 0 deletions lib/view/about_us_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import 'package:flutter/material.dart';
import 'package:pslab/constants.dart';
import 'package:pslab/view/widgets/main_scaffold_widget.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:package_info_plus/package_info_plus.dart';

class AboutUsScreen extends StatefulWidget {
const AboutUsScreen({super.key});

@override
State<StatefulWidget> createState() => _AboutUsScreenState();
}

Widget buildContactList(List<Map<String, dynamic>> items) {
return ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: items.length,
separatorBuilder: (_, __) => const Divider(thickness: 0.5, height: 1),
itemBuilder: (context, index) {
final item = items[index];
return ListTile(
leading: item['icon'] as Icon,
title: Text(
item['title'],
style: const TextStyle(fontSize: 15),
),
onTap: () async {
final uri = Uri.parse(item['url']);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
} else {
debugPrint('Could not launch ${item['url']}');
}
},
);
},
);
}

class _AboutUsScreenState extends State<AboutUsScreen> {
String get iconAboutUs => 'assets/images/logo.png';
final List<Map<String, dynamic>> contactItems = [
{
'icon': const Icon(Icons.mail),
'title': connectWithUs[1],
'url': 'mailto:$mail'
},
{'icon': const Icon(Icons.link), 'title': connectWithUs[2], 'url': website},
{
'icon': const Icon(FontAwesomeIcons.github, size: 20),
'title': connectWithUs[3],
'url': github
},
{
'icon': const Icon(Icons.facebook_sharp),
'title': connectWithUs[4],
'url': facebook
},
{
'icon': const Icon(FontAwesomeIcons.xTwitter, size: 20),
'title': connectWithUs[5],
'url': x
},
{
'icon': const Icon(FontAwesomeIcons.youtube, size: 20),
'title': connectWithUs[6],
'url': youtube
},
{
'icon': const Icon(Icons.person),
'title': connectWithUs[7],
'url': developers
},
];

@override
Widget build(BuildContext context) {
return MainScaffold(
title: aboutUs,
index: 5,
body: SafeArea(
child: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
height: 30,
),
Center(
child: Image.asset(
iconAboutUs,
width: 250,
height: 250,
),
),
Center(
child: Container(
margin: const EdgeInsets.all(20),
child: Text(
pslabDescription,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 15,
),
),
),
),
ListView(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
children: [
ListTile(
leading: const Icon(Icons.link),
title: Text(feedbackNBugs,
style: const TextStyle(
fontSize: 15,
)),
onTap: () async {
await launchUrl(Uri.parse(feedbackForm));
},
),
const Divider(
thickness: 0.5,
height: 1,
),
ListTile(
leading: const Icon(Icons.widgets),
title: FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
builder: (BuildContext context,
AsyncSnapshot<PackageInfo> snapshot) {
if (snapshot.hasData) {
return Text(
snapshot.data!.version,
style: const TextStyle(
fontSize: 15,
),
);
} else {
return const Text(
'Loading...',
style: TextStyle(
fontSize: 15,
),
);
}
}),
)
],
),
Container(
margin: const EdgeInsets.only(left: 15, top: 10, bottom: 10),
alignment: Alignment.centerLeft,
child: Text(
connectWithUs[0],
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w300,
),
),
),
buildContactList(contactItems)
],
),
))),
);
}
}
11 changes: 10 additions & 1 deletion lib/view/widgets/navigation_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,16 @@ class _NavDrawerState extends State<NavDrawer> {
),
),
onTap: () {
/**/
if (Navigator.canPop(context) &&
ModalRoute.of(context)?.settings.name == '/aboutUs') {
Navigator.popUntil(context, ModalRoute.withName('/aboutUs'));
} else {
Navigator.pushNamedAndRemoveUntil(
context,
'/aboutUs',
(route) => route.isFirst,
);
}
},
),
ListTile(
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ dependencies:
permission_handler: ^11.3.1
logger: ^2.5.0
url_launcher: ^6.3.1
font_awesome_flutter: ^10.8.0
package_info_plus: ^8.3.0


dev_dependencies:
flutter_test:
Expand Down