Skip to content

Commit

Permalink
fix: Correctly position the video status overlay on limited screens
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Apr 7, 2024
1 parent b0f14c0 commit f24dd1b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 0 additions & 1 deletion lib/screens/layouts/mobile/device_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import 'package:bluecherry_client/api/api.dart';
import 'package:bluecherry_client/models/device.dart';
import 'package:bluecherry_client/providers/mobile_view_provider.dart';
import 'package:bluecherry_client/providers/settings_provider.dart';
Expand Down
38 changes: 20 additions & 18 deletions lib/screens/layouts/video_status_label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,27 @@ class _VideoStatusLabelState extends State<VideoStatusLabel> {
event: widget.event,
);
final minHeight = label.buildTextSpans(context).length * 15;

final willLeftOverflow =
position.dx + _DeviceVideoInfo.minWidth > constraints.maxWidth;

final left = willLeftOverflow
? (constraints.maxWidth - _DeviceVideoInfo.minWidth - 8.0)
: position.dx;
final top = position.dy > minHeight + 8.0
? null
: position.dy + boxSize.height + 8.0;
final bottom = position.dy > minHeight + 8.0
? constraints.maxHeight - position.dy + 8.0
: null;

return Stack(children: [
if (position.dy > minHeight + 8.0)
Positioned(
bottom: constraints.maxHeight - position.dy + 8.0,
right: constraints.maxWidth - position.dx - boxSize.width,
child: label,
)
else
() {
final willLeftOverflow = position.dx + _DeviceVideoInfo.minWidth >
constraints.maxWidth;
return Positioned(
top: position.dy + boxSize.height + 8.0,
left: willLeftOverflow
? (constraints.maxWidth - _DeviceVideoInfo.minWidth - 8.0)
: position.dx,
child: label,
);
}(),
Positioned(
left: left,
top: top,
bottom: bottom,
child: label,
),
]);
});
});
Expand Down

0 comments on commit f24dd1b

Please sign in to comment.