-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced the ability to save, load, delete, and organize presets that remember which views were on screen, in what order, and their sizes. ![image](https://github.com/user-attachments/assets/9d262071-11b5-450e-b8c2-06045198ffbd) --------- Co-authored-by: Gold87 <[email protected]> Co-authored-by: aidan ahram <[email protected]> Co-authored-by: Levi Lesches <[email protected]>
- Loading branch information
1 parent
e0beabe
commit 362a2da
Showing
19 changed files
with
442 additions
and
138 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import "package:rover_dashboard/data.dart"; | ||
import "package:rover_dashboard/pages.dart"; | ||
|
||
/// Preset for the dashboard. | ||
class ViewPreset { | ||
/// Preset name. | ||
final String name; | ||
|
||
/// List of views that comes with the views name (and if it is a camera view, its camera name). | ||
final List<DashboardView> views; | ||
|
||
/// Ratio of the controller for the resizable row on top. | ||
final List<double> horizontal1; | ||
|
||
/// Ratio of the controller for resizable row on bottom. | ||
final List<double> horizontal2; | ||
|
||
/// Ratio of the controller for screen 2's first row. | ||
final List<double> horizontal3; | ||
|
||
/// Ratio of the controller for screen 2's second row. | ||
final List<double> horizontal4; | ||
|
||
/// Ratio of the controller for the resizable column. | ||
final List<double> vertical1; | ||
|
||
/// The vertical controller for screen 2. | ||
final List<double> vertical2; | ||
|
||
/// A const constructor. | ||
ViewPreset({ | ||
required this.name, | ||
required this.views, | ||
required this.horizontal1, | ||
required this.horizontal2, | ||
required this.vertical1, | ||
required this.vertical2, | ||
required this.horizontal3, | ||
required this.horizontal4, | ||
}); | ||
|
||
/// Parses a view preset from JSON. | ||
ViewPreset.fromJson(Json? json) : | ||
name = json?["name"] ?? "No Name", | ||
views = [ | ||
for (final viewJson in json?["views"] ?? []) | ||
DashboardView.fromJson(viewJson) ?? DashboardView.blank, | ||
], | ||
horizontal1 = List<double>.from(json?["horizontal1"] ?? []), | ||
horizontal2 = List<double>.from(json?["horizontal2"] ?? []), | ||
horizontal3 = List<double>.from(json?["horizontal3"] ?? []), | ||
horizontal4 = List<double>.from(json?["horizontal4"] ?? []), | ||
vertical1 = List<double>.from(json?["vertical1"] ?? []), | ||
vertical2 = List<double>.from(json?["vertical2"] ?? []); | ||
|
||
/// Serializes a view preset to JSON. | ||
Json toJson() => { | ||
"name": name, | ||
"views" : views, | ||
"horizontal1" : horizontal1, | ||
"horizontal2" : horizontal2, | ||
"horizontal3" : horizontal3, | ||
"horizontal4" : horizontal4, | ||
"vertical1" : vertical1, | ||
"vertical2" : vertical2, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.