Skip to content

Commit

Permalink
Merge pull request toshiaki-h#10 from toshiaki-h/feature_splitviewchild
Browse files Browse the repository at this point in the history
Feature splitviewchild
  • Loading branch information
toshiaki-h committed May 30, 2021
2 parents a1fa40c + 5ab57a7 commit 25254f4
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 216 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 3.0.0

* This version contains breaking changes.
* Fields in view1 and view2 changed to children.
* Added the SplitviewController class due to controlling views weights and limits.
* Removed fields minWidthSidebar/maxWidthSidebar/minHeightSidebar/maxHeightSidebar and initialWeight. Instead, Added the WeightLimit class so that we can specify the weight.
* The argument of the onWeightChanged handler now has multiple weights.

## 2.1.1+1

* Formatted by dartfmt.
Expand Down
48 changes: 28 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,40 @@ class _MyHomePageState extends State<MyHomePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
title: Text(widget.title!),
),
body: SplitView(
initialWeight: 0.7,
minHeightSidebar: 300,
maxHeightSidebar: 400,
view1: SplitView(
viewMode: SplitViewMode.Horizontal,
minWidthSidebar: 300,
maxWidthSidebar: 400,
view1: Container(
child: Center(child: Text("View1")),
color: Colors.red,
children: [
SplitView(
viewMode: SplitViewMode.Horizontal,
children: [
Container(
child: Center(child: Text("View1")),
color: Colors.red,
),
Container(
child: Center(child: Text("View2")),
color: Colors.blue,
),
Container(
child: Center(child: Text("View3")),
color: Colors.green,
),
],
onWeightChanged: (w) => print("Horizon: $w"),
),
view2: Container(
child: Center(child: Text("View2")),
color: Colors.blue,
Container(
child: Center(child: Text("View4")),
color: Colors.purple,
),
),
view2: Container(
child: Center(
child: Text("View3"),
Container(
child: Center(child: Text("View5")),
color: Colors.yellow,
),
color: Colors.green,
),
],
viewMode: SplitViewMode.Vertical,
controller: SplitViewController(limits: [null, WeightLimit(max: 0.5)]),
onWeightChanged: (w) => print("Vertical $w"),
),
);
}
Expand Down
42 changes: 26 additions & 16 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,36 @@ class _MyHomePageState extends State<MyHomePage> {
title: Text(widget.title!),
),
body: SplitView(
initialWeight: 0.7,
view1: SplitView(
viewMode: SplitViewMode.Horizontal,
view1: Container(
child: Center(child: Text("View1")),
color: Colors.red,
children: [
SplitView(
viewMode: SplitViewMode.Horizontal,
children: [
Container(
child: Center(child: Text("View1")),
color: Colors.red,
),
Container(
child: Center(child: Text("View2")),
color: Colors.blue,
),
Container(
child: Center(child: Text("View3")),
color: Colors.green,
),
],
onWeightChanged: (w) => print("Horizon: $w"),
),
view2: Container(
child: Center(child: Text("View2")),
color: Colors.blue,
Container(
child: Center(child: Text("View4")),
color: Colors.purple,
),
onWeightChanged: (w) => print("Horizon: $w"),
),
view2: Container(
child: Center(
child: Text("View3"),
Container(
child: Center(child: Text("View5")),
color: Colors.yellow,
),
color: Colors.green,
),
],
viewMode: SplitViewMode.Vertical,
controller: SplitViewController(limits: [null, WeightLimit(max: 0.5)]),
onWeightChanged: (w) => print("Vertical $w"),
),
);
Expand Down
50 changes: 27 additions & 23 deletions example/lib/main_tabview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,35 @@ class _MyHomePageState extends State<MyHomePage> {
children: [
SplitView(
key: PageStorageKey(0),
initialWeight: 0.7,
view1: SplitView(
key: PageStorageKey(1),
viewMode: SplitViewMode.Horizontal,
view1: Container(
child: Center(child: Text("View1")),
color: Colors.red,
controller: SplitViewController(weights: [0.7]),
children: [
SplitView(
key: PageStorageKey(1),
viewMode: SplitViewMode.Horizontal,
children: [
Container(
child: Center(child: Text("View1")),
color: Colors.red,
),
Container(
child: Center(child: Text("View2")),
color: Colors.blue,
),
],
onWeightChanged: (w) => print("Horizon: $w"),
),
view2: Container(
child: Center(child: Text("View2")),
color: Colors.blue,
Container(
child: ListView.separated(
itemBuilder: (context, index) {
return ListTile(
title: Text("Item ${items[index]}"),
);
},
separatorBuilder: (context, index) => Divider(),
itemCount: items.length),
color: Colors.green,
),
onWeightChanged: (w) => print("Horizon: $w"),
),
view2: Container(
child: ListView.separated(
itemBuilder: (context, index) {
return ListTile(
title: Text("Item ${items[index]}"),
);
},
separatorBuilder: (context, index) => Divider(),
itemCount: items.length),
color: Colors.green,
),
],
viewMode: SplitViewMode.Vertical,
onWeightChanged: (w) => print("Vertical $w"),
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.1.1"
version: "2.1.1+1"
stack_trace:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 25254f4

Please sign in to comment.