Skip to content

Commit

Permalink
remove need for small field images (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansen4857 authored Dec 27, 2023
1 parent e0b1118 commit 2cacd56
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
Binary file removed images/field23small.png
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/services/pplib_telemetry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PPLibTelemetry {
}

Stream<bool> connectionStatusStream() {
return _client.connectionStatusStream();
return _client.connectionStatusStream().asBroadcastStream();
}

Stream<List<num>?> targetPoseStream() {
Expand Down
11 changes: 4 additions & 7 deletions lib/widgets/field_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ enum OfficialField {

class FieldImage {
late final Image image;
Image? imageSmall;
late final ui.Size defaultSize;
ui.Size? defaultSizeSmall;
late num pixelsPerMeter;
Expand All @@ -39,6 +38,7 @@ class FieldImage {
image = Image.asset(
'images/field22.png',
fit: BoxFit.contain,
filterQuality: FilterQuality.medium,
);
defaultSize = const ui.Size(3240, 1620);
pixelsPerMeter = 196.85;
Expand All @@ -49,10 +49,7 @@ class FieldImage {
image = Image.asset(
'images/field23.png',
fit: BoxFit.contain,
);
imageSmall = Image.asset(
'images/field23small.png',
fit: BoxFit.contain,
filterQuality: FilterQuality.medium,
);
defaultSize = const ui.Size(3256, 1578);
defaultSizeSmall = const ui.Size(407, 197);
Expand Down Expand Up @@ -109,11 +106,11 @@ class FieldImage {
int get hashCode => Object.hash(image.hashCode, defaultSize.hashCode,
pixelsPerMeter.hashCode, name.hashCode);

Widget getWidget({bool small = false}) {
Widget getWidget() {
return AspectRatio(
aspectRatio: defaultSize.width / defaultSize.height,
child: SizedBox.expand(
child: (small && imageSmall != null) ? imageSmall : image,
child: image,
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/mini_path_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MiniPathsPreview extends StatelessWidget {
Widget build(BuildContext context) {
return Stack(
children: [
fieldImage.getWidget(small: true),
fieldImage.getWidget(),
Positioned.fill(
child: PathPreviewPainter(
paths: paths,
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ flutter:
assets:
- images/field22.png
- images/field23.png
- images/field23small.png
- images/icon.png
- images/choreo.png
- resources/default_navgrid.json
Expand Down
2 changes: 1 addition & 1 deletion test/widgets/mini_path_preview_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void main() {
));

expect(find.byType(PathPreviewPainter), findsOneWidget);
expect(find.image(fieldImage.imageSmall!.image), findsOneWidget);
expect(find.image(fieldImage.image.image), findsOneWidget);
});

testWidgets('mini preview w/o small image', (widgetTester) async {
Expand Down

0 comments on commit 2cacd56

Please sign in to comment.