Skip to content

Commit

Permalink
fix/resizable-on-resize (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
nank1ro committed Aug 9, 2024
1 parent ad138ef commit 89678d1
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 272 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 0.7.4
## 0.8.0

- **BREAKING CHANGE**: Refactor `ShadResizablePanelGroup` in order to react to window resize correctly. The sizes have been normalized. You don't need to provide anymore a pixel size, but a value between 0 and 1 which indicates the percentage of the available space.
- Add `onChanged` to `ShadTabs`.
- Fix `maxWidth` missing in `ShadSelectForlField`.

Expand Down
86 changes: 45 additions & 41 deletions example/lib/pages/resizable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,56 @@ class _ResizablePageState extends State<ResizablePage> {
return BaseScaffold(
appBarTitle: 'Resizable',
children: [
ShadDecorator(
decoration: ShadDecoration(
merge: false,
border: ShadBorder.all(
color: theme.colorScheme.border,
radius: theme.radius,
SizedBox(
width: 300,
height: 200,
child: ShadDecorator(
decoration: ShadDecoration(
merge: false,
border: ShadBorder.all(
color: theme.colorScheme.border,
radius: theme.radius,
),
),
),
child: ClipRRect(
borderRadius: theme.radius,
child: ShadResizablePanelGroup(
mainAxisSize: MainAxisSize.min,
height: 200,
showHandle: true,
children: [
ShadResizablePanel(
defaultSize: 150,
minSize: 50,
maxSize: 300,
child: Center(
child: Text('One', style: theme.textTheme.large),
child: ClipRRect(
borderRadius: theme.radius,
child: ShadResizablePanelGroup(
mainAxisSize: MainAxisSize.min,
showHandle: true,
children: [
ShadResizablePanel(
defaultSize: .5,
minSize: 0.1,
maxSize: 0.8,
child: Center(
child: Text('One', style: theme.textTheme.large),
),
),
),
ShadResizablePanel(
defaultSize: 150,
child: ShadResizablePanelGroup(
axis: Axis.vertical,
showHandle: true,
children: [
ShadResizablePanel(
defaultSize: 50,
child: Center(
child: Text('Two', style: theme.textTheme.large)),
),
ShadResizablePanel(
defaultSize: 150,
child: Align(
child: Text('Three', style: theme.textTheme.large)),
),
],
ShadResizablePanel(
defaultSize: 0.5,
child: ShadResizablePanelGroup(
axis: Axis.vertical,
showHandle: true,
children: [
ShadResizablePanel(
defaultSize: 0.4,
child: Center(
child: Text('Two', style: theme.textTheme.large)),
),
ShadResizablePanel(
defaultSize: 0.6,
child: Align(
child:
Text('Three', style: theme.textTheme.large)),
),
],
),
),
),
],
],
),
),
),
),
)
],
);
}
Expand Down
Loading

0 comments on commit 89678d1

Please sign in to comment.