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 18 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.8]
* `ResizablePane` can now disallow the usage of its internal scrollbar via the `ReziablePane.noScrollBar` constructor.

## [2.0.0-beta.7]
✨ New ✨
* You can now call `MacosTypography.of(context)` as a shorthand for retrieving the typography used in your `MacosTheme`.
Expand Down
7 changes: 7 additions & 0 deletions example/lib/pages/buttons_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ class _ButtonsPageState extends State<ButtonsPage> {
],
),
children: [
const ResizablePane.noScrollBar(
minSize: 180,
startSize: 200,
windowBreakpoint: 700,
resizableSide: ResizableSide.right,
child: Center(child: Text('Resizable Pane')),
),
stMerlHin marked this conversation as resolved.
Show resolved Hide resolved
ContentArea(
builder: (context, scrollController) {
return SingleChildScrollView(
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.7"
version: "2.0.0-beta.8"
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 going with [ResizablePane.noScrollBar] constructor if the internal
/// [MacosScrollbar] is useless or when dealing with widgets which do not
/// expose their scroll controllers.
GroovinChip marked this conversation as resolved.
Show resolved Hide resolved
/// {@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',
);

/// Create a [ResizablePane] without an internal [MacosScrollbar].
///
/// Very useful when dealing with widgets which do not expose their scroll
/// controllers or when not using the platform scroll bar is preferred.
///
/// Consider going with the default constructor if showing [MacosScrollbar]
/// when scrolling the content of this widget is the expected behaviour.
stMerlHin marked this conversation as resolved.
Show resolved Hide resolved
/// {@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
4 changes: 2 additions & 2 deletions lib/src/selectors/date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class MacosDatePicker extends StatefulWidget {

/// Allows for changing the order of day headers in the graphical Date Picker
/// to Mo, Tu, We, Th, Fr, Sa, Su.
///
///
/// This is useful for internationalization purposes, as many countries begin their weeks on Mondays.
///
///
/// Defaults to `false`.
final bool? startWeekOnMonday;

Expand Down
5 changes: 2 additions & 3 deletions lib/src/theme/macos_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ class MacosThemeData with Diagnosticable {
);
pushButtonTheme ??= PushButtonThemeData(
color: primaryColor,
secondaryColor: isDark
? const Color.fromRGBO(110, 109, 112, 1.0)
: MacosColors.white,
secondaryColor:
isDark ? const Color.fromRGBO(110, 109, 112, 1.0) : MacosColors.white,
disabledColor: isDark
? const Color.fromRGBO(255, 255, 255, 0.1)
: const Color.fromRGBO(244, 245, 245, 1.0),
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.7
version: 2.0.0-beta.8
homepage: "https://macosui.dev"
repository: "https://github.com/GroovinChip/macos_ui"

Expand Down
Loading
Loading