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

Latest from dev #517

Merged
merged 166 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
4a47f61
chore: account for latest Flutter:master
GroovinChip Feb 6, 2023
411d00d
fix(example): incorrect variable usage
GroovinChip Feb 6, 2023
96ea16c
Merge branch 'dev' into customer_testing
GroovinChip Feb 13, 2023
2d5a7e0
Version 1.11.1 (#366)
GroovinChip Feb 21, 2023
7afb196
Merge pull request #378 from macosui/stable
GroovinChip Mar 2, 2023
079b51f
When toolbar item is clicked, first pop the route and then call its c…
whiplashoo Mar 3, 2023
3e78c92
Merge branch 'stable' into dev
GroovinChip Mar 3, 2023
fc6a26b
feat: add support for `routerConfig` to `MacosApp.router` (#390)
jtdLab Mar 20, 2023
fcf6ea1
DCM lint updates and related fixes (#393)
GroovinChip Mar 21, 2023
aa82a08
Fix the online gallery link
rxlabz Mar 26, 2023
a52b616
Fix for invalid dates (#402)
eliasyishak Mar 31, 2023
ebf1d06
Merge branch 'customer_testing' into dev
GroovinChip Apr 6, 2023
7de5419
Revert "Merge branch 'customer_testing' into dev"
GroovinChip Apr 6, 2023
5fc566c
Fix: use the `sidebar` and `endSidebar` key parameter (#400)
Maksimka101 Apr 6, 2023
a77d86f
Migrate to macos_window_utils (#377)
Adrian-Samoticha Apr 11, 2023
5269fcd
support flutter 3.10 minimum dart3 (#426)
the-best-is-best May 16, 2023
e99a19b
Update dart_code_metrics.yaml
GroovinChip May 16, 2023
f7e0333
Update dart_code_metrics.yaml
GroovinChip May 17, 2023
b64e2e4
Update dart_code_metrics.yaml
GroovinChip May 17, 2023
f1053fc
Fix EnumProperty test. (#419)
bernaferrari May 17, 2023
15fb991
update dependencies
GroovinChip Jul 3, 2023
3af34b1
update changelog
GroovinChip Jul 3, 2023
a56544a
fix dart version constraint
GroovinChip Jul 3, 2023
2988b94
Rewritten `MacosSwitch` (#409)
GroovinChip Jul 3, 2023
46eb9ca
fix: UX of the click on the calendar elements in `MacosDatePicker` (#…
rklos Jul 3, 2023
32fa64c
fix minor formatting fix
GroovinChip Jul 3, 2023
1df03cb
feat: Added support for `startWeekOnMonday` to `MacosDatePicker` (#414)
rklos Jul 4, 2023
37db0c3
feat: Added support for `dateFormat` to `MacosDatePicker` (#415)
rklos Jul 4, 2023
044af12
feat: Added support for `weekdayAbbreviations` and `monthAbbreviation…
rklos Jul 4, 2023
057b1b8
fix: `ToolBar` title not avoiding traffic lights when no sidebar is p…
GroovinChip Jul 5, 2023
2b9c084
feat: implement `ControlSize` for `PushButton` (#447)
GroovinChip Jul 5, 2023
d85ab84
fix: checkbox appearance (#448)
GroovinChip Jul 5, 2023
331895a
Reorganize gallery, add `MacosTypography.of(context)`, and update `Ma…
GroovinChip Jul 10, 2023
7343ee3
More gallery improvements (#457)
GroovinChip Jul 10, 2023
ebcd257
Typography improvments (#459)
GroovinChip Jul 11, 2023
de3e35c
Non-scrollable `ResizablePane` (#420)
stMerlHin Jul 12, 2023
64472fe
chore: add missing trailing commas & format
GroovinChip Jul 19, 2023
0e8231f
Fix broken web support, platform theming issues, and typography updat…
GroovinChip Jul 19, 2023
d7eaf5b
gallery: remove commented & deprecated code from `main.dart`
GroovinChip Jul 19, 2023
be20db0
2.0: Readme updates (#461)
GroovinChip Jul 19, 2023
34fad11
feat: version `2.0.0` (#462)
GroovinChip Jul 19, 2023
e4d3645
Update CHANGELOG.md
GroovinChip Jul 19, 2023
f7dc715
Update CONTRIBUTING.md
Piinks Jul 31, 2023
8c250ed
Alter copy of mock_canvas to unblock moving to flutter_test
Piinks Jul 31, 2023
a5e8532
Fix compilation errors from mock canvas copy (#468)
Piinks Aug 3, 2023
aae8eb9
automatic changes
Adrian-Samoticha Aug 4, 2023
968cd31
imitate macOS’ push button look
Adrian-Samoticha Aug 6, 2023
b93084c
make push button appear secondary when window resigns main state
Adrian-Samoticha Aug 6, 2023
b4d22f1
migrate to stream builder
Adrian-Samoticha Aug 6, 2023
afc3a9c
fix incorrect text color in push button when window resigns main state
Adrian-Samoticha Aug 6, 2023
ab3092e
add missing comma
Adrian-Samoticha Aug 7, 2023
cb70113
implement `AccentColorListener`
Adrian-Samoticha Aug 7, 2023
6e77ab9
make push button listen to accent color changes
Adrian-Samoticha Aug 7, 2023
ba42d75
add missing comma
Adrian-Samoticha Aug 7, 2023
a549bca
deprecate `PushButtonTheme`
Adrian-Samoticha Aug 7, 2023
ba3d7ce
mimic macOS’ push button click effect
Adrian-Samoticha Aug 7, 2023
07490f0
do not init `WindowMainStateListener` if platform isn’t macOS
Adrian-Samoticha Aug 7, 2023
aa8f90d
do not init `AccentColorListener` if platform isn’t macOS
Adrian-Samoticha Aug 7, 2023
9b95a43
remove unused imports
Adrian-Samoticha Aug 7, 2023
0f52aaa
remove reference to deprecated API in documentation
Adrian-Samoticha Aug 7, 2023
85fe22f
deprecate `pressedOpacity`
Adrian-Samoticha Aug 7, 2023
856bfb0
remove deprecated `pressedOpacity` from `debugFillProperties`
Adrian-Samoticha Aug 7, 2023
3ca7e81
document `AccentColor`
Adrian-Samoticha Aug 7, 2023
3c96252
document `AccentColor` values
Adrian-Samoticha Aug 7, 2023
3d06510
increment version number
Adrian-Samoticha Aug 7, 2023
80bcf9a
add changelog entry for version 2.0.1
Adrian-Samoticha Aug 7, 2023
1c405dc
run pub get
GroovinChip Aug 7, 2023
db6088b
upgrade to macos_window_utils 1.2.0
Adrian-Samoticha Aug 11, 2023
2423822
initialize `_isWindowMain` properly
Adrian-Samoticha Aug 11, 2023
1ef31a8
rename `isWindowMain` to `isMainWindow`
Adrian-Samoticha Aug 11, 2023
f064102
replace `print` with `debugPrint`
Adrian-Samoticha Aug 11, 2023
9040eb9
deprecate properties of `PushButtonThemeData` rather than `PushButton…
Adrian-Samoticha Aug 11, 2023
0df03af
fix typo in `AccentColor` documentation
Adrian-Samoticha Aug 11, 2023
bc32402
fix typo in `AccentColorListener` docs
Adrian-Samoticha Aug 11, 2023
ea6a7e5
automatic changes
Adrian-Samoticha Aug 4, 2023
f01d422
imitate macOS’ push button look
Adrian-Samoticha Aug 6, 2023
d0255e1
make push button appear secondary when window resigns main state
Adrian-Samoticha Aug 6, 2023
5e90519
migrate to stream builder
Adrian-Samoticha Aug 6, 2023
08727e0
fix incorrect text color in push button when window resigns main state
Adrian-Samoticha Aug 6, 2023
0c75ce2
add missing comma
Adrian-Samoticha Aug 7, 2023
7e9e602
implement `AccentColorListener`
Adrian-Samoticha Aug 7, 2023
6a31e1c
make push button listen to accent color changes
Adrian-Samoticha Aug 7, 2023
3eaab39
add missing comma
Adrian-Samoticha Aug 7, 2023
5d230a5
deprecate `PushButtonTheme`
Adrian-Samoticha Aug 7, 2023
c99b3f0
mimic macOS’ push button click effect
Adrian-Samoticha Aug 7, 2023
8196267
do not init `WindowMainStateListener` if platform isn’t macOS
Adrian-Samoticha Aug 7, 2023
555bae6
do not init `AccentColorListener` if platform isn’t macOS
Adrian-Samoticha Aug 7, 2023
b8b22d7
remove unused imports
Adrian-Samoticha Aug 7, 2023
04f2a11
remove reference to deprecated API in documentation
Adrian-Samoticha Aug 7, 2023
7e0f365
deprecate `pressedOpacity`
Adrian-Samoticha Aug 7, 2023
f27803d
remove deprecated `pressedOpacity` from `debugFillProperties`
Adrian-Samoticha Aug 7, 2023
cfacc99
document `AccentColor`
Adrian-Samoticha Aug 7, 2023
5cf616f
document `AccentColor` values
Adrian-Samoticha Aug 7, 2023
23ab438
increment version number
Adrian-Samoticha Aug 7, 2023
4aa2296
add changelog entry for version 2.0.1
Adrian-Samoticha Aug 7, 2023
c39ba50
upgrade to macos_window_utils 1.2.0
Adrian-Samoticha Aug 11, 2023
6a5dbe6
initialize `_isWindowMain` properly
Adrian-Samoticha Aug 11, 2023
6aa9d8a
rename `isWindowMain` to `isMainWindow`
Adrian-Samoticha Aug 11, 2023
db655a7
replace `print` with `debugPrint`
Adrian-Samoticha Aug 11, 2023
2058812
deprecate properties of `PushButtonThemeData` rather than `PushButton…
Adrian-Samoticha Aug 11, 2023
c017df4
fix typo in `AccentColor` documentation
Adrian-Samoticha Aug 11, 2023
5757632
fix typo in `AccentColorListener` docs
Adrian-Samoticha Aug 11, 2023
f767d4d
Merge branch 'macosui-dev' into dev
Adrian-Samoticha Aug 11, 2023
c97b901
remove push button theme test
Adrian-Samoticha Aug 11, 2023
ce55875
Update CHANGELOG.md
Adrian-Samoticha Aug 12, 2023
3c1d16f
change documentation of `WindowMainStateListener`
Adrian-Samoticha Aug 12, 2023
ad79ce5
update documentation
Adrian-Samoticha Aug 12, 2023
a90c980
update documentation
Adrian-Samoticha Aug 12, 2023
d229e15
update documentation
Adrian-Samoticha Aug 12, 2023
7d2ec54
change `var` to `final`
Adrian-Samoticha Aug 12, 2023
a3183b5
update deprecation message
Adrian-Samoticha Aug 12, 2023
92658d9
improve formatting
Adrian-Samoticha Aug 12, 2023
7b81123
improve formatting
Adrian-Samoticha Aug 12, 2023
fb22efa
fix grammatical error in debug print message
Adrian-Samoticha Aug 12, 2023
040b4a0
improve formatting
Adrian-Samoticha Aug 13, 2023
3a8aecb
rename `deinit` methods to `dispose`
Adrian-Samoticha Aug 15, 2023
48c2c26
move `utils.dart` into `utils` directory
Adrian-Samoticha Aug 15, 2023
ce94aa9
move `WindowMainStateListener` to separate file
Adrian-Samoticha Aug 15, 2023
ef8c156
move `AccentColorListener` to separate file
Adrian-Samoticha Aug 15, 2023
7fa0f23
move `MacOSBrightnessOverrideHandler` to separate file
Adrian-Samoticha Aug 15, 2023
3e50ae4
add example to `AccentColorListener`
Adrian-Samoticha Aug 15, 2023
47e6974
rename `isWindowMain` to `isMainWindow`
Adrian-Samoticha Aug 15, 2023
7b9b1b6
add example to `WindowMainStateListener`
Adrian-Samoticha Aug 15, 2023
a4b6c45
replace `child: ...` with `child: …` to avoid confusing the dots with…
Adrian-Samoticha Aug 19, 2023
4bd7d33
Update lib/src/utils/accent_color_listener.dart
Adrian-Samoticha Aug 19, 2023
21ebe83
Update lib/src/utils/accent_color_listener.dart
Adrian-Samoticha Aug 19, 2023
053befb
Update lib/src/utils/accent_color_listener.dart
Adrian-Samoticha Aug 19, 2023
9394422
rename `onChangedStream` to `onChanged`
Adrian-Samoticha Aug 19, 2023
76caa07
move `AccentColorListener` constructor to top of class
Adrian-Samoticha Aug 19, 2023
e8190d6
move `WindowMainStateListener` to top of class
Adrian-Samoticha Aug 19, 2023
673c720
add “Updated” heading to changelog entry for version 2.0.1
Adrian-Samoticha Aug 19, 2023
e78cd55
migrate to `ExcludeSemantics` in popup button
Adrian-Samoticha Aug 19, 2023
9f006f2
Resolve #445 (#471)
Adrian-Samoticha Aug 19, 2023
a74b207
Merge branch 'macosui:dev' into dev
Adrian-Samoticha Sep 30, 2023
523cb67
update `LastUpgradeVersion` and `LastUpgradeCheck` in example
Adrian-Samoticha Sep 30, 2023
4d4519c
fix typo
Adrian-Samoticha Sep 30, 2023
02d504e
format `window.dart`
Adrian-Samoticha Sep 30, 2023
6557d05
improve formatting for `window.dart`
Adrian-Samoticha Sep 30, 2023
97751dc
fix sidebar appearing too dark
Adrian-Samoticha Oct 3, 2023
873807a
make sidebar items adapt their color based on the user’s selected sys…
Adrian-Samoticha Oct 7, 2023
2b1dba1
update changelog entry for version 2.0.1
Adrian-Samoticha Oct 7, 2023
c6d37d8
Remove usages of '@image' directive (#483)
srawlins Oct 12, 2023
328f9cb
Run `pub get`
GroovinChip Oct 12, 2023
b3a8e53
Merge branch 'stable' into dev
GroovinChip Oct 12, 2023
5ec00bc
Added initialTime parameter to MacosTimePicker
Abbas1Hussein Oct 19, 2023
908bb8b
Added a void return type to OnDateChanged
Abbas1Hussein Oct 19, 2023
5e49ad6
automatic changes
Adrian-Samoticha Oct 30, 2023
a2b0656
Merge branch 'dev' of https://github.com/macosui/macos_ui into macosu…
Adrian-Samoticha Oct 30, 2023
73a56fb
Merge branch 'macosui-dev' into dev
Adrian-Samoticha Oct 30, 2023
1f563c0
bump version to 2.0.3
Adrian-Samoticha Oct 30, 2023
ec4a63b
Fix incorrect sidebar and sidebar item color (#484)
Adrian-Samoticha Jan 17, 2024
e0899a6
Merge branch 'macosui:dev' into dev
Adrian-Samoticha Jan 21, 2024
7be94be
Merge branch 'dev' into time_picker
Adrian-Samoticha Jan 21, 2024
cb35862
Merge branch 'time_picker' of https://github.com/Abbas1Hussein/macos_…
Adrian-Samoticha Jan 21, 2024
77f9246
increment version to 2.0.4
Adrian-Samoticha Jan 21, 2024
051bfff
Merge pull request #490 from Abbas1Hussein/time_picker
Adrian-Samoticha Jan 21, 2024
6d24751
Merge pull request #503 from Adrian-Samoticha/Abbas1Hussein-time_picker
Adrian-Samoticha Jan 21, 2024
e2ae2c4
increment version to 2.0.5
Adrian-Samoticha Jan 21, 2024
e9da375
Fix radio button issue (#497)
Abbas1Hussein Jan 21, 2024
37c95be
Issue #505 (#509)
Adrian-Samoticha May 3, 2024
de31bfe
Version 2.0.7 (#511)
Adrian-Samoticha May 5, 2024
e35fdab
fixed text overflow on sidebar item (#513)
faisalansari0367 Aug 13, 2024
7f13dfd
Allow initial expansion of SidebarItem disclosure items (#514)
nu11ptr Aug 31, 2024
715bb24
chore: Update dependencies (#515)
GroovinChip Sep 19, 2024
8b03ef8
Merge branch 'stable' into dev
GroovinChip Sep 19, 2024
6313ee5
chore: remove straggling import
GroovinChip Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix: use the sidebar and endSidebar key parameter (#400)
* Fix: use the `sidebard` and `endSidebar` key parameter

- pass sidebar key to the sidebar root widget (`AnimatedPositioned`)
- create a new sidebar `ScrollController` when the key is change

* Increment version and update changelog

* Apply suggestions from code review

* Update pubspec.lock file in example

---------

Co-authored-by: Reuben Turner <[email protected]>
  • Loading branch information
Maksimka101 and GroovinChip authored Apr 6, 2023
commit 5fc566cb5b2e199e1b08103a7a26f29649f8b4d9
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.12.5]
* Fixed a bug where the `Sidebar.key` parameter wasn't used, which caused certain layouts to be unachievable.

## [1.12.4]
* Default the `_selectedDay` state variable to be 1 when selecting the previous/next month from widget to ensure new date is valid for `_formatAsDateTime()` method (https://github.com/flutter/flutter/issues/123669 & https://github.com/macosui/macos_ui/pull/402)

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.12.3"
version: "1.12.5"
matcher:
dependency: transitive
description:
Expand Down
158 changes: 90 additions & 68 deletions lib/src/layout/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class MacosWindow extends StatefulWidget {
}

class _MacosWindowState extends State<MacosWindow> {
final _sidebarScrollController = ScrollController();
final _endSidebarScrollController = ScrollController();
var _sidebarScrollController = ScrollController();
var _endSidebarScrollController = ScrollController();
double _sidebarWidth = 0.0;
double _sidebarDragStartWidth = 0.0;
double _sidebarDragStartPosition = 0.0;
Expand All @@ -74,39 +74,59 @@ class _MacosWindowState extends State<MacosWindow> {
_endSidebarWidth =
(widget.endSidebar?.startWidth ?? widget.endSidebar?.minWidth) ??
_endSidebarWidth;
if (widget.sidebar?.builder != null) {
_sidebarScrollController.addListener(() => setState(() {}));
}
if (widget.endSidebar?.builder != null) {
_endSidebarScrollController.addListener(() => setState(() {}));
}
_addSidebarScrollControllerListenerIfNeeded();
_addEndSidebarScrollControllerListenerIfNeeded();
}

@override
void didUpdateWidget(covariant MacosWindow old) {
super.didUpdateWidget(old);
if (widget.sidebar == null) {
final sidebar = widget.sidebar;
if (sidebar == null) {
_sidebarWidth = 0.0;
} else if (widget.sidebar!.minWidth != old.sidebar!.minWidth ||
widget.sidebar!.maxWidth != old.sidebar!.maxWidth) {
if (widget.sidebar!.minWidth > _sidebarWidth) {
_sidebarWidth = widget.sidebar!.minWidth;
} else if (sidebar.minWidth != old.sidebar!.minWidth ||
sidebar.maxWidth != old.sidebar!.maxWidth) {
if (sidebar.minWidth > _sidebarWidth) {
_sidebarWidth = sidebar.minWidth;
}
if (widget.sidebar!.maxWidth! < _sidebarWidth) {
_sidebarWidth = widget.sidebar!.maxWidth!;
if (sidebar.maxWidth! < _sidebarWidth) {
_sidebarWidth = sidebar.maxWidth!;
}
}
if (widget.endSidebar == null) {
if (sidebar?.key != old.sidebar?.key) {
_sidebarScrollController.dispose();
_sidebarScrollController = ScrollController();
_addSidebarScrollControllerListenerIfNeeded();
}
final endSidebar = widget.endSidebar;
if (endSidebar == null) {
_endSidebarWidth = 0.0;
} else if (widget.endSidebar!.minWidth != old.endSidebar!.minWidth ||
widget.endSidebar!.maxWidth != old.endSidebar!.maxWidth) {
if (widget.endSidebar!.minWidth > _endSidebarWidth) {
_endSidebarWidth = widget.endSidebar!.minWidth;
} else if (endSidebar.minWidth != old.endSidebar!.minWidth ||
endSidebar.maxWidth != old.endSidebar!.maxWidth) {
if (endSidebar.minWidth > _endSidebarWidth) {
_endSidebarWidth = endSidebar.minWidth;
}
if (widget.endSidebar!.maxWidth! < _endSidebarWidth) {
_endSidebarWidth = widget.endSidebar!.maxWidth!;
if (endSidebar.maxWidth! < _endSidebarWidth) {
_endSidebarWidth = endSidebar.maxWidth!;
}
}
if (endSidebar?.key != old.endSidebar?.key) {
_endSidebarScrollController.dispose();
_endSidebarScrollController = ScrollController();
_addEndSidebarScrollControllerListenerIfNeeded();
}
}

void _addSidebarScrollControllerListenerIfNeeded() {
if (widget.sidebar?.builder != null) {
_sidebarScrollController.addListener(() => setState(() {}));
}
}

void _addEndSidebarScrollControllerListenerIfNeeded() {
if (widget.endSidebar?.builder != null) {
_endSidebarScrollController.addListener(() => setState(() {}));
}
}

@override
Expand All @@ -120,13 +140,15 @@ class _MacosWindowState extends State<MacosWindow> {
// ignore: code-metrics
Widget build(BuildContext context) {
assert(debugCheckHasMacosTheme(context));
if (widget.sidebar?.startWidth != null) {
assert((widget.sidebar!.startWidth! >= widget.sidebar!.minWidth) &&
(widget.sidebar!.startWidth! <= widget.sidebar!.maxWidth!));
final sidebar = widget.sidebar;
final endSidebar = widget.endSidebar;
if (sidebar?.startWidth != null) {
assert((sidebar!.startWidth! >= sidebar.minWidth) &&
(sidebar.startWidth! <= sidebar.maxWidth!));
}
if (widget.endSidebar?.startWidth != null) {
assert((widget.endSidebar!.startWidth! >= widget.endSidebar!.minWidth) &&
(widget.endSidebar!.startWidth! <= widget.endSidebar!.maxWidth!));
if (endSidebar?.startWidth != null) {
assert((endSidebar!.startWidth! >= endSidebar.minWidth) &&
(endSidebar.startWidth! <= endSidebar.maxWidth!));
}
final MacosThemeData theme = MacosTheme.of(context);
late Color backgroundColor = widget.backgroundColor ?? theme.canvasColor;
Expand All @@ -137,8 +159,8 @@ class _MacosWindowState extends State<MacosWindow> {
final isMac = !kIsWeb && defaultTargetPlatform == TargetPlatform.macOS;

// Respect the sidebar color override from parent if one is given
if (widget.sidebar?.decoration?.color != null) {
sidebarBackgroundColor = widget.sidebar!.decoration!.color!;
if (sidebar?.decoration?.color != null) {
sidebarBackgroundColor = sidebar!.decoration!.color!;
} else if (isMac &&
MediaQuery.of(context).platformBrightness.isDark ==
theme.brightness.isDark) {
Expand All @@ -154,8 +176,8 @@ class _MacosWindowState extends State<MacosWindow> {
}

// Respect the end sidebar color override from parent if one is given
if (widget.endSidebar?.decoration?.color != null) {
endSidebarBackgroundColor = widget.endSidebar!.decoration!.color!;
if (endSidebar?.decoration?.color != null) {
endSidebarBackgroundColor = endSidebar!.decoration!.color!;
} else if (isMac &&
MediaQuery.of(context).platformBrightness.isDark ==
theme.brightness.isDark) {
Expand All @@ -173,9 +195,8 @@ class _MacosWindowState extends State<MacosWindow> {
builder: (context, constraints) {
final width = constraints.maxWidth;
final height = constraints.maxHeight;
final isAtBreakpoint = width <= (widget.sidebar?.windowBreakpoint ?? 0);
final isAtEndBreakpoint =
width <= (widget.endSidebar?.windowBreakpoint ?? 0);
final isAtBreakpoint = width <= (sidebar?.windowBreakpoint ?? 0);
final isAtEndBreakpoint = width <= (endSidebar?.windowBreakpoint ?? 0);
final canShowSidebar = _showSidebar && !isAtBreakpoint;
final canShowEndSidebar = _showEndSidebar && !isAtEndBreakpoint;
final visibleSidebarWidth = canShowSidebar ? _sidebarWidth : 0.0;
Expand All @@ -195,8 +216,9 @@ class _MacosWindowState extends State<MacosWindow> {
),

// Sidebar
if (widget.sidebar != null)
if (sidebar != null)
AnimatedPositioned(
key: sidebar.key,
curve: curve,
duration: duration,
height: height,
Expand All @@ -206,39 +228,39 @@ class _MacosWindowState extends State<MacosWindow> {
curve: Curves.easeInOut,
color: sidebarBackgroundColor,
constraints: BoxConstraints(
minWidth: widget.sidebar!.minWidth,
maxWidth: widget.sidebar!.maxWidth!,
minWidth: sidebar.minWidth,
maxWidth: sidebar.maxWidth!,
minHeight: height,
maxHeight: height,
).normalize(),
child: Column(
children: [
if ((widget.sidebar?.topOffset ?? 0) > 0)
SizedBox(height: widget.sidebar?.topOffset),
if (sidebar.topOffset > 0)
SizedBox(height: sidebar.topOffset),
if (_sidebarScrollController.hasClients &&
_sidebarScrollController.offset > 0.0)
Divider(thickness: 1, height: 1, color: dividerColor),
if (widget.sidebar!.top != null &&
constraints.maxHeight > 81)
if (sidebar.top != null && constraints.maxHeight > 81)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: widget.sidebar!.top!,
child: sidebar.top!,
),
Expanded(
child: MacosScrollbar(
controller: _sidebarScrollController,
child: Padding(
padding: widget.sidebar?.padding ?? EdgeInsets.zero,
child: widget.sidebar!
.builder(context, _sidebarScrollController),
padding: sidebar.padding,
child: sidebar.builder(
context,
_sidebarScrollController,
),
),
),
),
if (widget.sidebar?.bottom != null &&
constraints.maxHeight > 141)
if (sidebar.bottom != null && constraints.maxHeight > 141)
Padding(
padding: const EdgeInsets.all(16.0),
child: widget.sidebar!.bottom!,
child: sidebar.bottom!,
),
],
),
Expand Down Expand Up @@ -273,7 +295,7 @@ class _MacosWindowState extends State<MacosWindow> {
),

// Sidebar resizer
if (widget.sidebar?.isResizable ?? false)
if (sidebar?.isResizable ?? false)
AnimatedPositioned(
curve: curve,
duration: duration,
Expand All @@ -287,13 +309,12 @@ class _MacosWindowState extends State<MacosWindow> {
_sidebarDragStartPosition = details.globalPosition.dx;
},
onHorizontalDragUpdate: (details) {
final sidebar = widget.sidebar!;
setState(() {
var newWidth = _sidebarDragStartWidth +
details.globalPosition.dx -
_sidebarDragStartPosition;

if (sidebar.startWidth != null &&
if (sidebar!.startWidth != null &&
sidebar.snapToStartBuffer != null &&
(newWidth - sidebar.startWidth!).abs() <=
sidebar.snapToStartBuffer!) {
Expand Down Expand Up @@ -338,8 +359,9 @@ class _MacosWindowState extends State<MacosWindow> {
),

// End sidebar
if (widget.endSidebar != null)
if (endSidebar != null)
AnimatedPositioned(
key: endSidebar.key,
left: width - visibleEndSidebarWidth,
curve: curve,
duration: duration,
Expand All @@ -350,46 +372,47 @@ class _MacosWindowState extends State<MacosWindow> {
curve: Curves.easeInOut,
color: endSidebarBackgroundColor,
constraints: BoxConstraints(
minWidth: widget.endSidebar!.minWidth,
maxWidth: widget.endSidebar!.maxWidth!,
minWidth: endSidebar.minWidth,
maxWidth: endSidebar.maxWidth!,
minHeight: height,
maxHeight: height,
).normalize(),
child: Column(
children: [
if ((widget.endSidebar?.topOffset ?? 0) > 0)
SizedBox(height: widget.endSidebar?.topOffset),
if (endSidebar.topOffset > 0)
SizedBox(height: endSidebar.topOffset),
if (_endSidebarScrollController.hasClients &&
_endSidebarScrollController.offset > 0.0)
Divider(thickness: 1, height: 1, color: dividerColor),
if (widget.endSidebar!.top != null)
if (endSidebar.top != null)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: widget.endSidebar!.top!,
child: endSidebar.top!,
),
Expanded(
child: MacosScrollbar(
controller: _endSidebarScrollController,
child: Padding(
padding:
widget.endSidebar?.padding ?? EdgeInsets.zero,
child: widget.endSidebar!
.builder(context, _endSidebarScrollController),
padding: endSidebar.padding,
child: endSidebar.builder(
context,
_endSidebarScrollController,
),
),
),
),
if (widget.endSidebar?.bottom != null)
if (endSidebar.bottom != null)
Padding(
padding: const EdgeInsets.all(16.0),
child: widget.endSidebar!.bottom!,
child: endSidebar.bottom!,
),
],
),
),
),

// End sidebar resizer
if (widget.endSidebar?.isResizable ?? false)
if (endSidebar?.isResizable ?? false)
AnimatedPositioned(
curve: curve,
duration: duration,
Expand All @@ -403,13 +426,12 @@ class _MacosWindowState extends State<MacosWindow> {
_endSidebarDragStartPosition = details.globalPosition.dx;
},
onHorizontalDragUpdate: (details) {
final endSidebar = widget.endSidebar!;
setState(() {
var newWidth = _endSidebarDragStartWidth -
details.globalPosition.dx +
_endSidebarDragStartPosition;

if (endSidebar.startWidth != null &&
if (endSidebar!.startWidth != null &&
endSidebar.snapToStartBuffer != null &&
(newWidth + endSidebar.startWidth!).abs() <=
endSidebar.snapToStartBuffer!) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: macos_ui
description: Flutter widgets and themes implementing the current macOS design language.
version: 1.12.4
version: 1.12.5
homepage: "https://macosui.dev"
repository: "https://github.com/GroovinChip/macos_ui"

Expand Down