Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import 'package:pslab/view/soundmeter_screen.dart';
import 'package:pslab/view/thermometer_screen.dart';
import 'package:pslab/view/wave_generator_screen.dart';
import 'package:pslab/view/experiments_screen.dart';
import 'package:pslab/view/gas_sensor_screen.dart';
import 'package:pslab/view/dust_sensor_screen.dart';
import 'constants.dart';

void main() {
Expand Down Expand Up @@ -99,6 +101,8 @@ class MyApp extends StatelessWidget {
'/soundmeter': (context) => const SoundMeterScreen(),
'/thermometer': (context) => const ThermometerScreen(),
'/sensors': (context) => const SensorsScreen(),
'/gasSensor': (context) => const GasSensorScreen(),
'/dustSensor': (context) => const DustSensorScreen(),
'/experiments': (context) => const ExperimentsScreen(),
'/loggedData': (context) => LoggedDataScreen(
instrumentNames: instrumentNames,
Expand Down
116 changes: 116 additions & 0 deletions lib/view/dust_sensor_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pslab/l10n/app_localizations.dart';
import 'package:pslab/providers/locator.dart';
import 'package:pslab/view/widgets/common_scaffold_widget.dart';

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

@override
State<DustSensorScreen> createState() => _DustSensorScreenState();
}

class _DustSensorScreenState extends State<DustSensorScreen> {
AppLocalizations appLocalizations = getIt.get<AppLocalizations>();

@override
void initState() {
super.initState();
_setPortraitOrientation();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
}

@override
void didChangeDependencies() {
_setPortraitOrientation();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
super.didChangeDependencies();
}

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_setPortraitOrientation() and SystemChrome.setEnabledSystemUIMode(...) are invoked in both initState and didChangeDependencies, which is redundant and makes lifecycle behavior harder to reason about. Consider keeping this logic in a single lifecycle method (typically initState or a post-frame callback) unless there is a specific dependency-change scenario you need to handle.

Suggested change
@override
void didChangeDependencies() {
_setPortraitOrientation();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
super.didChangeDependencies();
}

Copilot uses AI. Check for mistakes.
void _setPortraitOrientation() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}

@override
Widget build(BuildContext context) {
return CommonScaffold(
title: appLocalizations.dustSensor,
body: Center(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DustSensorScreen duplicates the same placeholder layout used by GasSensorScreen. Consider extracting a shared reusable placeholder widget (title/description/icon/accent color) so future style or copy changes don't need to be made in multiple files.

Copilot uses AI. Check for mistakes.
children: [
Icon(
Icons.blur_on,
size: 120,
color: Colors.grey.shade400,
),
const SizedBox(height: 32),
Text(
appLocalizations.dustSensor,
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 16),
Text(
appLocalizations.screenNotImplemented,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: Colors.grey.shade600,
),
),
const SizedBox(height: 24),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.orange.shade50,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.orange.shade200),
),
child: Column(
children: [
Icon(
Icons.info_outline,
color: Colors.orange.shade700,
size: 32,
),
const SizedBox(height: 8),
Text(
appLocalizations.dustSensorDesc,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.orange.shade900,
fontSize: 14,
),
),
],
),
),
const SizedBox(height: 32),
ElevatedButton.icon(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(Icons.arrow_back),
label: Text(appLocalizations.back),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 24,
vertical: 12,
),
),
),
],
),
),
),
);
}
}
116 changes: 116 additions & 0 deletions lib/view/gas_sensor_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pslab/l10n/app_localizations.dart';
import 'package:pslab/providers/locator.dart';
import 'package:pslab/view/widgets/common_scaffold_widget.dart';

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

@override
State<GasSensorScreen> createState() => _GasSensorScreenState();
}

class _GasSensorScreenState extends State<GasSensorScreen> {
AppLocalizations appLocalizations = getIt.get<AppLocalizations>();

@override
void initState() {
super.initState();
_setPortraitOrientation();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
}

@override
void didChangeDependencies() {
_setPortraitOrientation();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
super.didChangeDependencies();
}

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_setPortraitOrientation() and SystemChrome.setEnabledSystemUIMode(...) are invoked in both initState and didChangeDependencies, which is redundant and makes lifecycle behavior harder to reason about. Consider keeping this logic in a single lifecycle method (typically initState or a post-frame callback) unless there is a specific dependency-change scenario you need to handle.

Suggested change
@override
void didChangeDependencies() {
_setPortraitOrientation();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
super.didChangeDependencies();
}

Copilot uses AI. Check for mistakes.
void _setPortraitOrientation() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}

@override
Widget build(BuildContext context) {
return CommonScaffold(
title: appLocalizations.gasSensor,
body: Center(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.air,
size: 120,
color: Colors.grey.shade400,
),
const SizedBox(height: 32),
Text(
appLocalizations.gasSensor,
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
const SizedBox(height: 16),
Text(
appLocalizations.screenNotImplemented,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: Colors.grey.shade600,
),
),
const SizedBox(height: 24),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.blue.shade50,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.blue.shade200),
),
child: Column(
children: [
Icon(
Icons.info_outline,
color: Colors.blue.shade700,
size: 32,
),
const SizedBox(height: 8),
Text(
appLocalizations.gasSensorDesc,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.blue.shade900,
fontSize: 14,
),
),
],
),
),
const SizedBox(height: 32),
ElevatedButton.icon(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(Icons.arrow_back),
label: Text(appLocalizations.back),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 24,
vertical: 12,
),
),
),
],
),
),
),
);
}
}
6 changes: 4 additions & 2 deletions lib/view/instruments_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ class _InstrumentsScreenState extends State<InstrumentsScreen> {
_InstrumentData(appLocalizations.roboticArm,
appLocalizations.roboticArmDesc, '/roboticArm'),
// Instruments below are not yet implemented.
//_InstrumentData(appLocalizations.gasSensor, appLocalizations.gasSensorDesc, '/gassensor'),
//_InstrumentData(appLocalizations.dustSensor, appLocalizations.dustSensorDesc, '/dustsensor'),
_InstrumentData(appLocalizations.gasSensor,
appLocalizations.gasSensorDesc, '/gasSensor'),
_InstrumentData(appLocalizations.dustSensor,
appLocalizations.dustSensorDesc, '/dustSensor'),
_InstrumentData(appLocalizations.soundMeter,
appLocalizations.soundMeterDesc, '/soundmeter'),
];
Expand Down
Loading