Skip to content

Commit 7cf2c72

Browse files
committed
add Flow widget.
1 parent 20045d1 commit 7cf2c72

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

lib/const/page_item_const.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,9 @@ const PAGE_ITEMS = [
162162
"img": PageImage.FLUTTER_OPEN,
163163
"click": PageName.EXPANDED,
164164
},
165+
{
166+
"title": PageName.FLOW,
167+
"img": PageImage.FLUTTER_OPEN,
168+
"click": PageName.FLOW,
169+
},
165170
];

lib/const/page_name_const.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ class PageName {
3737
static const MIX_SINGLE_LAYOUT = "MixLayout";
3838
static const INDEX_STACK = "IndexedStack";
3939
static const EXPANDED = "Expanded";
40+
static const FLOW = "Flow";
4041
}

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class FlutterOpenApp extends StatelessWidget {
5151
PageName.MIX_SINGLE_LAYOUT: (context) => MixPage(),
5252
PageName.INDEX_STACK: (context) => IndexStackPage(),
5353
PageName.EXPANDED: (context) => ExpandPage(),
54+
PageName.FLOW: (context) => FlowPage(),
5455
},
5556
);
5657
}

lib/page/muti/FlowPage.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
///
2+
/// Created by NieBin on 2019/5/24
3+
/// Github: https://github.com/nb312
4+
5+
///
6+
import "package:flutter/material.dart";
7+
import 'package:flutter_widgets/const/_const.dart';
8+
9+
class FlowPage extends StatefulWidget {
10+
@override
11+
FlowState createState() => FlowState();
12+
}
13+
14+
class FlowState extends State<FlowPage> {
15+
@override
16+
Widget build(BuildContext context) {
17+
return Scaffold(
18+
appBar: AppBar(
19+
title: Text(PageName.FLOW),
20+
),
21+
body: Flow(
22+
delegate: MFlowDelegate(),
23+
children: <Widget>[
24+
Container(
25+
constraints: BoxConstraints.expand(height: 100),
26+
color: RED,
27+
),
28+
Container(
29+
constraints: BoxConstraints.expand(height: 100, width: 100),
30+
alignment: Alignment.center,
31+
color: BLUE,
32+
)
33+
],
34+
),
35+
);
36+
}
37+
}
38+
39+
class MFlowDelegate extends FlowDelegate {
40+
@override
41+
void paintChildren(FlowPaintingContext context) {
42+
context.paintChild(0, transform: Matrix4.rotationZ(1));
43+
context.paintChild(1,
44+
transform: Matrix4.translationValues(100, 0, 0)..rotateZ(1));
45+
}
46+
47+
@override
48+
bool shouldRepaint(MFlowDelegate oldDelegate) {
49+
return true;
50+
}
51+
}

lib/page/muti/_muti.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
///
66
export "IndexStackPage.dart";
77
export "ExpandPage.dart";
8+
export 'FlowPage.dart';

0 commit comments

Comments
 (0)