Skip to content

Commit 198a5ec

Browse files
authored
feat: added layout for the Wave Generator screen (#2803)
1 parent 1d6b806 commit 198a5ec

12 files changed

+896
-0
lines changed

assets/icons/ic_sin.png

1 KB
Loading

assets/icons/ic_triangular.png

1.09 KB
Loading

lib/l10n/app_en.arb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@
9999
"pinPV2": "PV2",
100100
"pinPV3": "PV3",
101101
"pinPCS": "PCS",
102+
"analog": "Analog",
103+
"digital": "Digital",
104+
"wave1": "Wave 1",
105+
"wave2": "Wave 2",
106+
"sqr1": "sqr1",
107+
"sqr2": "sqr2",
108+
"sqr3": "sqr3",
109+
"sqr4": "sqr4",
110+
"freq": "Freq",
111+
"phase": "Phase",
112+
"duty": "Duty",
113+
"produceSound": "Produce Sound",
102114
"analyze": "Analyze",
103115
"settings": "Settings",
104116
"autoStart": "Auto Start",

lib/l10n/app_localizations.dart

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,78 @@ abstract class AppLocalizations {
688688
/// **'PCS'**
689689
String get pinPCS;
690690

691+
/// No description provided for @analog.
692+
///
693+
/// In en, this message translates to:
694+
/// **'Analog'**
695+
String get analog;
696+
697+
/// No description provided for @digital.
698+
///
699+
/// In en, this message translates to:
700+
/// **'Digital'**
701+
String get digital;
702+
703+
/// No description provided for @wave1.
704+
///
705+
/// In en, this message translates to:
706+
/// **'Wave 1'**
707+
String get wave1;
708+
709+
/// No description provided for @wave2.
710+
///
711+
/// In en, this message translates to:
712+
/// **'Wave 2'**
713+
String get wave2;
714+
715+
/// No description provided for @sqr1.
716+
///
717+
/// In en, this message translates to:
718+
/// **'sqr1'**
719+
String get sqr1;
720+
721+
/// No description provided for @sqr2.
722+
///
723+
/// In en, this message translates to:
724+
/// **'sqr2'**
725+
String get sqr2;
726+
727+
/// No description provided for @sqr3.
728+
///
729+
/// In en, this message translates to:
730+
/// **'sqr3'**
731+
String get sqr3;
732+
733+
/// No description provided for @sqr4.
734+
///
735+
/// In en, this message translates to:
736+
/// **'sqr4'**
737+
String get sqr4;
738+
739+
/// No description provided for @freq.
740+
///
741+
/// In en, this message translates to:
742+
/// **'Freq'**
743+
String get freq;
744+
745+
/// No description provided for @phase.
746+
///
747+
/// In en, this message translates to:
748+
/// **'Phase'**
749+
String get phase;
750+
751+
/// No description provided for @duty.
752+
///
753+
/// In en, this message translates to:
754+
/// **'Duty'**
755+
String get duty;
756+
757+
/// No description provided for @produceSound.
758+
///
759+
/// In en, this message translates to:
760+
/// **'Produce Sound'**
761+
String get produceSound;
762+
691763
/// No description provided for @analyze.
692764
///
693765
/// In en, this message translates to:

lib/l10n/app_localizations_en.dart

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,42 @@ class AppLocalizationsEn extends AppLocalizations {
316316
@override
317317
String get pinPCS => 'PCS';
318318

319+
@override
320+
String get analog => 'Analog';
321+
322+
@override
323+
String get digital => 'Digital';
324+
325+
@override
326+
String get wave1 => 'Wave 1';
327+
328+
@override
329+
String get wave2 => 'Wave 2';
330+
331+
@override
332+
String get sqr1 => 'sqr1';
333+
334+
@override
335+
String get sqr2 => 'sqr2';
336+
337+
@override
338+
String get sqr3 => 'sqr3';
339+
340+
@override
341+
String get sqr4 => 'sqr4';
342+
343+
@override
344+
String get freq => 'Freq';
345+
346+
@override
347+
String get phase => 'Phase';
348+
349+
@override
350+
String get duty => 'Duty';
351+
352+
@override
353+
String get produceSound => 'Produce Sound';
354+
319355
@override
320356
String get analyze => 'Analyze';
321357

lib/main.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import 'package:pslab/view/about_us_screen.dart';
2020
import 'package:pslab/view/software_licenses_screen.dart';
2121
import 'package:pslab/theme/app_theme.dart';
2222
import 'package:pslab/view/soundmeter_screen.dart';
23+
import 'package:pslab/view/wave_generator_screen.dart';
2324
import 'constants.dart';
2425

2526
void main() {
@@ -60,6 +61,7 @@ class MyApp extends StatelessWidget {
6061
'/': (context) => const InstrumentsScreen(),
6162
'/oscilloscope': (context) => const OscilloscopeScreen(),
6263
'/multimeter': (context) => const MultimeterScreen(),
64+
'/waveGenerator': (context) => const WaveGeneratorScreen(),
6365
'/logicAnalyzer': (context) => const LogicAnalyzerScreen(),
6466
'/powerSource': (context) => const PowerSourceScreen(),
6567
'/connectDevice': (context) => const ConnectDeviceScreen(),

lib/view/instruments_screen.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ class _InstrumentsScreenState extends State<InstrumentsScreen> {
141141
);
142142
}
143143
break;
144+
case 4:
145+
if (Navigator.canPop(context) &&
146+
ModalRoute.of(context)?.settings.name == '/waveGenerator') {
147+
Navigator.popUntil(context, ModalRoute.withName('/waveGenerator'));
148+
} else {
149+
Navigator.pushNamedAndRemoveUntil(
150+
context,
151+
'/waveGenerator',
152+
(route) => route.isFirst,
153+
);
154+
}
144155
default:
145156
break;
146157
}

lib/view/wave_generator_screen.dart

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:pslab/l10n/app_localizations.dart';
3+
import 'package:pslab/providers/locator.dart';
4+
import 'package:pslab/theme/colors.dart';
5+
import 'package:pslab/view/widgets/common_scaffold_widget.dart';
6+
import 'package:pslab/view/widgets/analog_waveform_controls.dart';
7+
import 'package:pslab/view/widgets/wave_generator_graph.dart';
8+
import 'package:pslab/view/widgets/wave_generator_main_controls.dart';
9+
10+
class WaveGeneratorScreen extends StatefulWidget {
11+
const WaveGeneratorScreen({super.key});
12+
13+
@override
14+
State<StatefulWidget> createState() => _WaveGeneratorScreenState();
15+
}
16+
17+
class _WaveGeneratorScreenState extends State<WaveGeneratorScreen> {
18+
AppLocalizations appLocalizations = getIt.get<AppLocalizations>();
19+
@override
20+
Widget build(BuildContext context) {
21+
return CommonScaffold(
22+
title: 'Wave Generator',
23+
body: Container(
24+
margin: const EdgeInsets.all(8.0),
25+
child: Column(
26+
children: [
27+
Expanded(
28+
flex: 30,
29+
child: Container(
30+
color: chartBackgroundColor,
31+
child: WaveGeneratorGraph(),
32+
),
33+
),
34+
Expanded(
35+
flex: 30,
36+
child: Column(
37+
children: [
38+
Expanded(
39+
flex: 70,
40+
child: AnalogWaveformControls(),
41+
),
42+
Expanded(
43+
flex: 30,
44+
child: Row(
45+
crossAxisAlignment: CrossAxisAlignment.stretch,
46+
children: [
47+
Expanded(
48+
child: TextButton(
49+
style: TextButton.styleFrom(
50+
backgroundColor: primaryRed,
51+
shape: RoundedRectangleBorder(
52+
borderRadius: BorderRadius.circular(6),
53+
),
54+
),
55+
child: Text(
56+
appLocalizations.produceSound,
57+
textAlign: TextAlign.center,
58+
style: TextStyle(
59+
color: Colors.white,
60+
fontSize: 14,
61+
),
62+
),
63+
onPressed: () => {},
64+
),
65+
),
66+
const SizedBox(width: 4),
67+
Expanded(
68+
child: TextButton(
69+
style: TextButton.styleFrom(
70+
backgroundColor: primaryRed,
71+
shape: RoundedRectangleBorder(
72+
borderRadius: BorderRadius.circular(6),
73+
),
74+
),
75+
child: Text(
76+
appLocalizations.analog,
77+
style: TextStyle(
78+
color: Colors.white,
79+
fontSize: 14,
80+
),
81+
),
82+
onPressed: () => {},
83+
),
84+
),
85+
const SizedBox(width: 4),
86+
Expanded(
87+
child: TextButton(
88+
style: TextButton.styleFrom(
89+
backgroundColor: primaryRed,
90+
shape: RoundedRectangleBorder(
91+
borderRadius: BorderRadius.circular(6),
92+
),
93+
),
94+
child: Text(
95+
appLocalizations.digital,
96+
style: TextStyle(
97+
color: Colors.white,
98+
fontSize: 14,
99+
),
100+
),
101+
onPressed: () => {},
102+
),
103+
),
104+
],
105+
),
106+
),
107+
],
108+
),
109+
),
110+
Expanded(
111+
flex: 40,
112+
child: WaveGeneratorMainControls(),
113+
),
114+
],
115+
),
116+
),
117+
);
118+
}
119+
}

0 commit comments

Comments
 (0)