Skip to content

Commit

Permalink
don't show "reversed" generator option in holonomic mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansen4857 committed Oct 22, 2022
1 parent e39f5e0 commit bcd11df
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 27 deletions.
63 changes: 36 additions & 27 deletions lib/widgets/path_editor/cards/generator_settings_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ class GeneratorSettingsCard extends StatefulWidget {
final VoidCallback onShouldSave;
final GlobalKey stackKey;
final SharedPreferences prefs;
final bool holonomicMode;

const GeneratorSettingsCard(
{required this.path,
required this.stackKey,
required this.onShouldSave,
required this.prefs,
required this.holonomicMode,
super.key});

@override
Expand Down Expand Up @@ -88,33 +90,40 @@ class _GeneratorSettingsCardState extends State<GeneratorSettingsCard> {
),
],
),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Row(
children: [
Checkbox(
value: widget.path.isReversed ?? false,
activeColor: colorScheme.primaryContainer,
checkColor: colorScheme.onPrimaryContainer,
onChanged: (val) {
setState(() {
widget.path.isReversed = val;
widget.onShouldSave();
});
},
),
const SizedBox(width: 4),
Text(
'Reversed',
style: TextStyle(color: colorScheme.onSurface),
),
const SizedBox(width: 12),
],
),
],
Visibility(
visible: !widget.holonomicMode,
child: Column(
children: [
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Row(
children: [
Checkbox(
value: widget.path.isReversed ?? false,
activeColor: colorScheme.primaryContainer,
checkColor: colorScheme.onPrimaryContainer,
onChanged: (val) {
setState(() {
widget.path.isReversed = val;
widget.onShouldSave();
});
},
),
const SizedBox(width: 4),
Text(
'Reversed',
style: TextStyle(color: colorScheme.onSurface),
),
const SizedBox(width: 12),
],
),
],
),
],
),
),
],
),
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/path_editor/editors/edit_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ class _EditEditorState extends State<EditEditor> {
visible: widget.showGeneratorSettings,
child: GeneratorSettingsCard(
path: widget.path,
holonomicMode: widget.holonomicMode,
stackKey: _key,
onShouldSave: () {
widget.savePath(widget.path);
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/path_editor/editors/graph_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class _GraphEditorState extends State<GraphEditor> {
Widget _buildGeneratorSettingsCard() {
return GeneratorSettingsCard(
path: widget.path,
holonomicMode: widget.holonomicMode,
stackKey: _key,
onShouldSave: () async {
await widget.path.generateTrajectory();
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/path_editor/editors/preview_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class _PreviewEditorState extends State<PreviewEditor>
Widget _buildGeneratorSettingsCard() {
return GeneratorSettingsCard(
path: widget.path,
holonomicMode: widget.holonomicMode,
stackKey: _key,
onShouldSave: () async {
await widget.path.generateTrajectory();
Expand Down

0 comments on commit bcd11df

Please sign in to comment.