Skip to content

Commit

Permalink
Added hardware_text
Browse files Browse the repository at this point in the history
  • Loading branch information
vovagorodok committed Jun 23, 2024
1 parent eb2bfd7 commit 0408e72
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/ADD_NEW_HARDWARE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ General fields:
- required `hardware_name` - string
- required `softwares` - list
- optional `hardware_icon` - string contains path to icon
- optional `hardware_text` - string contains path to text about hardware in markdown

Software fields:
- required `software_name` - string
Expand Down
2 changes: 2 additions & 0 deletions lib/src/core/remote_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ class RemoteInfo {
RemoteInfo({
this.hardwareName = "",
this.hardwareIcon,
this.hardwareText,
this.softwareList = const [],
this.newestSoftware,
this.isHardwareUnregistered = false,
});

String hardwareName;
String? hardwareIcon;
String? hardwareText;
List<Software> softwareList;
Software? newestSoftware;
bool isHardwareUnregistered;
Expand Down
1 change: 1 addition & 0 deletions lib/src/http/http_info_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class HttpInfoReader extends StatefulStream<RemoteInfoState> {
return;
}
_state.info.hardwareIcon = body["hardware_icon"];
_state.info.hardwareText = body["hardware_text"];

final softwares = body["softwares"];
final fullList = softwares.map<Software>(Software.fromJson).toList();
Expand Down
13 changes: 13 additions & 0 deletions lib/src/screens/upload_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ class UploadScreenState extends State<UploadScreen> {
),
],
),
onTap: infoState.status == WorkStatus.success &&
infoState.remoteInfo.hardwareText != null
? () async => await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => InfoScreen(
title: infoState.remoteInfo.hardwareName,
url: infoState.remoteInfo.hardwareText!,
),
),
)
: null,
enabled: _canUpload(),
),
);

Expand Down

0 comments on commit 0408e72

Please sign in to comment.