Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame information #143

Merged
merged 8 commits into from Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/l10n/app_en.arb
Expand Up @@ -49,6 +49,9 @@
"switchCamera": "Switch camera",
"online": "Online",
"offline": "Offline",
"live": "LIVE",
"timedOut": "TIMED OUT",
"loading": "LOADING",
"removeFromView": "Remove from view",
"addToView": "Add to view",
"eventBrowser": "Events History",
Expand All @@ -59,6 +62,7 @@
"priority": "Priority",
"next": "Next",
"previous": "Previous",
"lastImageUpdate": "Last Image Update",
"date": "Date",
"lastUpdate": "Last Update",
"theme": "Theme",
Expand Down Expand Up @@ -137,7 +141,7 @@
"refresh": "Refresh",
"view": "View",
"cycle": "Cycle",
"cycleTogglePeriod": "Cycle toggle period",
"cycleTogglePeriod": "Layout cycle toggle period",
"newLayout": "New layout",
"editLayout": "Edit layout",
"singleView": "Single view",
Expand Down Expand Up @@ -236,6 +240,7 @@
"deletePreset": "Delete preset",
"refreshPresets": "Refresh presets",
"@Resolution": {},
"resolution": "Resolution",
"selectResolution": "Select resolution",
"setResolution": "Set resolution",
"setResolutionDescription": "The resolution of the video stream can highly impact the performance of the app. Set the resolution to a lower value to improve performance, or to a higher value to improve quality. You can set the default resolution to every camera in the settings",
Expand Down
24 changes: 14 additions & 10 deletions lib/widgets/collapsable_sidebar.dart
Expand Up @@ -21,10 +21,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

const kSidebarConstraints = BoxConstraints(maxWidth: 220.0);
const kCompactSidebarConstraints = BoxConstraints(maxWidth: 50.0);
const kCompactSidebarConstraints = BoxConstraints(maxWidth: 46.0);

typedef SidebarBuilder = Widget Function(
BuildContext context,
bool collapsed,
Widget collapseButton,
);

Expand Down Expand Up @@ -85,20 +86,21 @@ class _CollapsableSidebarState extends State<CollapsableSidebar>

@override
Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context);
final loc = AppLocalizations.of(context);

return AnimatedBuilder(
animation: collapseAnimation,
builder: (context, child) {
final collapsed = collapseController.isCompleted;
final collapseButton = Padding(
padding: widget.left
? const EdgeInsetsDirectional.only(start: 5.0)
: const EdgeInsetsDirectional.only(end: 5.0),
padding: collapsed
? EdgeInsets.zero
: widget.left
? const EdgeInsetsDirectional.only(start: 5.0)
: const EdgeInsetsDirectional.only(end: 5.0),
child: IconButton(
key: collapseButtonKey,
tooltip: collapseController.isCompleted
? localizations.open
: localizations.close,
tooltip: collapsed ? loc.open : loc.close,
icon: RotationTransition(
turns: (widget.left
? Tween(
Expand All @@ -123,6 +125,7 @@ class _CollapsableSidebarState extends State<CollapsableSidebar>
},
),
);

return ConstrainedBox(
constraints: BoxConstraintsTween(
begin: kSidebarConstraints,
Expand All @@ -134,11 +137,12 @@ class _CollapsableSidebarState extends State<CollapsableSidebar>
alignment: widget.left
? AlignmentDirectional.topStart
: AlignmentDirectional.topEnd,
child: collapseButton,
padding: const EdgeInsetsDirectional.symmetric(horizontal: 4.0),
child: widget.builder(context, true, collapseButton),
);
}

return widget.builder(context, collapseButton);
return widget.builder(context, false, collapseButton);
}(),
);
},
Expand Down