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

Non-scrollable ResizablePane #420

Merged
merged 25 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
728bfae
add `ResizablePane.noScrollBar` constructor
stMerlHin Apr 27, 2023
6963fed
update test file
stMerlHin Apr 27, 2023
4ac878e
include ResizablePane.noScrollBar in buttons_page example file
stMerlHin Apr 27, 2023
40cfee7
incremented the package version as appropriate and updated `CHANGELOG…
stMerlHin Apr 27, 2023
284c6a0
Merge branch 'dev' into non-scrollable-resizable-pane
stMerlHin May 19, 2023
9faa2b5
Update lib/src/layout/resizable_pane.dart
stMerlHin Jul 11, 2023
456f849
Update example/lib/pages/buttons_page.dart
stMerlHin Jul 11, 2023
4997362
Update lib/src/layout/resizable_pane.dart
stMerlHin Jul 11, 2023
9b4cc8b
Update CHANGELOG.md
stMerlHin Jul 11, 2023
7721946
Update lib/src/layout/resizable_pane.dart
stMerlHin Jul 11, 2023
321020d
Merge pull request #2 from macosui/dev
stMerlHin Jul 11, 2023
96c2007
Update resizable pane widget.
stMerlHin Jul 11, 2023
2a163f1
Update buttons_page.dart file to follow dart code metrics
stMerlHin Jul 11, 2023
5453636
update CHANGELOG.md file
stMerlHin Jul 11, 2023
8b3c794
run `dart format` on project
stMerlHin Jul 11, 2023
ef98be5
update docs
stMerlHin Jul 11, 2023
b46ad8e
Update resizable pane constructors docs
stMerlHin Jul 11, 2023
e71f506
update CHANGELOG.md file
stMerlHin Jul 11, 2023
063b359
Apply suggestions from code review
GroovinChip Jul 11, 2023
93e8828
Update right ResizablePanePage to be non-scrollable
stMerlHin Jul 11, 2023
e95df60
Update right ResizablePanePage to be non-scrollable
stMerlHin Jul 11, 2023
fcbcb4b
Merge branch 'macosui:dev' into dev
stMerlHin Jul 11, 2023
db27c0d
update CHANGELOG.md file
stMerlHin Jul 11, 2023
82801d2
update pubspec.yaml file
stMerlHin Jul 11, 2023
5efa234
run pub get
stMerlHin Jul 12, 2023
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [2.0.0-beta.9]
* `ResizablePane` can now disallow the usage of its internal scrollbar via the `ReziablePane.noScrollBar` constructor.

## [2.0.0-beta.8]
✨ New ✨
* `MacosFontWeight` allows using Apple-specific font weights like `w510`, `w590`, and `w860`.
Expand Down
12 changes: 4 additions & 8 deletions example/lib/pages/resizable_pane_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,12 @@ class _ResizablePanePageState extends State<ResizablePanePage> {
);
},
),
ResizablePane(
const ResizablePane.noScrollBar(
minSize: 180,
startSize: 200,
// windowBreakpoint: 800,
resizableSide: ResizableSide.left,
builder: (_, __) {
return const Center(
child: Text('Right Resizable Pane'),
);
},
windowBreakpoint: 700,
resizableSide: ResizableSide.right,
child: Center(child: Text('Right non-scrollable Resizable Pane')),
),
],
);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/widgets/widget_text_title1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class WidgetTextTitle1 extends StatelessWidget {
),
);
}
}
}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0-beta.8"
version: "2.0.0-beta.9"
macos_window_utils:
dependency: transitive
description:
Expand Down
62 changes: 54 additions & 8 deletions lib/src/layout/resizable_pane.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,54 @@ enum ResizableSide {
/// The [startSize] is the initial width or height depending on the orientation of the pane.
/// {@endtemplate}
class ResizablePane extends StatefulWidget {
/// {@macro resizablePane}
/// Creates a [ResizablePane] with an internal [MacosScrollbar].
///
/// Consider using [ResizablePane.noScrollBar] constructor when the internal
/// [MacosScrollbar] is not needed or when working with widgets which do not
/// expose their scroll controllers.
/// {@macro resizablePane}.
const ResizablePane({
super.key,
required this.builder,
required ScrollableWidgetBuilder this.builder,
this.decoration,
this.maxSize = 500.0,
required this.minSize,
this.isResizable = true,
required this.resizableSide,
this.windowBreakpoint,
required this.startSize,
}) : assert(
}) : child = null,
useScrollBar = true,
assert(
maxSize >= minSize,
'minSize should not be more than maxSize.',
),
assert(
(startSize >= minSize) && (startSize <= maxSize),
'startSize must not be less than minSize or more than maxWidth',
);

/// Creates a [ResizablePane] without an internal [MacosScrollbar].
///
/// Useful when working with widgets which do not expose their scroll
/// controllers or when not using the platform scroll bar is preferred.
///
/// Consider using the default constructor if showing a [MacosScrollbar]
/// when scrolling the content of this widget is the expected behavior.
/// {@macro resizablePane}.
const ResizablePane.noScrollBar({
super.key,
required Widget this.child,
this.decoration,
this.maxSize = 500.0,
required this.minSize,
this.isResizable = true,
required this.resizableSide,
this.windowBreakpoint,
required this.startSize,
}) : builder = null,
useScrollBar = false,
assert(
maxSize >= minSize,
'minSize should not be more than maxSize.',
),
Expand All @@ -55,7 +91,15 @@ class ResizablePane extends StatefulWidget {
///
/// Pass the [scrollController] obtained from this method, to a scrollable
/// widget used in this method to work with the internal [MacosScrollbar].
final ScrollableWidgetBuilder builder;
final ScrollableWidgetBuilder? builder;

/// The child to display in this widget.
///
/// This is only referenced when the constructor used is [ResizablePane.noScrollbar].
final Widget? child;

/// Specify if this [ResizablePane] should have an internal [MacosScrollbar].
final bool useScrollBar;

/// The [BoxDecoration] to paint behind the child in the [builder].
final BoxDecoration? decoration;
Expand Down Expand Up @@ -277,10 +321,12 @@ class _ResizablePaneState extends State<ResizablePane> {
SafeArea(
left: false,
right: false,
child: MacosScrollbar(
controller: _scrollController,
child: widget.builder(context, _scrollController),
),
child: widget.useScrollBar
? MacosScrollbar(
controller: _scrollController,
child: widget.builder!(context, _scrollController),
)
: widget.child!,
),
if (widget.isResizable && !_resizeOnRight && !_resizeOnTop)
Positioned(
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: 2.0.0-beta.8
version: 2.0.0-beta.9
homepage: "https://macosui.dev"
repository: "https://github.com/GroovinChip/macos_ui"

Expand Down
Loading
Loading