Skip to content

Commit f3cdb84

Browse files
committed
[2.0.0-beta5]
- move examples to package dir. - optimize ScaleView
1 parent bb50f4e commit f3cdb84

35 files changed

+314
-164
lines changed

package_src/CHANGELOG.md renamed to CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## [2.0.0-beta4]
1+
## [2.0.0-beta5]
2+
- move examples to package dir.
3+
- optimize ScaleView
24
- fix LogPanel bugs
35

46
## [2.0.0-beta2]

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22

33
# Flukit [![Pub](https://img.shields.io/pub/v/flukit.svg?style=flat-square)](https://pub.dartlang.org/packages/flukit)
44

5-
*flukit* (Flutter UI Kit)是一个Flutter Widget库。
5+
*flukit* (Flutter UI Kit)是一个Flutter Widget库。目前 2.0 版本正在预览中,2.0 版本有很大更新,可拉取项目后本地跑demo体验。
66

77
## 注意
88

9-
本项目正在持续迭代中,欢迎大家贡献代码。
10-
11-
原QuickSelectListView迁移至[AzListView](https://github.com/flutterchina/azlistview)
12-
QuickSelectListView 更改为 AzListView
13-
SuspensionListView 更改为 SuspensionView
9+
本项目正在持续迭代中,欢迎大家贡献代码。
1410

1511
## 贡献代码须知
1612

@@ -21,6 +17,7 @@ flukit
2117
--lib //示例目录
2218
--package_src
2319
--lib
20+
--example
2421
--src //widget库目录
2522
--docs //文档目录,文档必须是markdown格式
2623
--images //文档用到的图片都放在这里,如截图
@@ -30,7 +27,7 @@ flukit
3027

3128
### 运行Demo
3229

33-
[示例目录](https://github.com/flutterchina/flukit/tree/main/lib/routes).
30+
[示例目录](https://github.com/flutterchina/flukit/tree/main/package_src/lib/example).
3431

3532
```
3633
flutter run
@@ -84,13 +81,13 @@ flutter run
8481

8582

8683

87-
## Demo部分截图(只有少数,待补充)
84+
## Demo部分截图(只有极少数有图片,待补充)
8885

8986
<img src="./docs/images/quick_scroll_bar.gif" width="320"/>
9087
<img src="./docs/images/animated_rotation_box.gif" width="320"/>
9188
<img src="./docs/images/gradient_circular_progress_indicator.gif" width="320"/>
9289
<img src="./docs/images/swiper.gif" width="320"/>
9390
<img src="./docs/images/photoview.gif" width="320"/>
9491
<img src="./docs/images/raised_button.png" width="320"/>
95-
<img src="./docs/images/pull_refresh.gif" width="320"/>
92+
9693

lib/main.dart

Lines changed: 96 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import 'dart:async';
2+
import 'dart:math';
23
import 'package:flukit/flukit.dart';
4+
import 'package:flutter/foundation.dart';
35
import 'package:flutter/material.dart' hide Page;
4-
import 'common/index.dart';
5-
import 'routes/index.dart';
6+
import 'package:flukit/example/example.dart';
67

78
void main() {
89
final logEmitter = getGlobalLogEmitter();
910
runZoned(
10-
() => runApp(MyApp()),
11+
() => runApp(const MyApp()),
1112
zoneSpecification: ZoneSpecification(
1213
print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
1314
parent.print(zone, line);
@@ -36,13 +37,33 @@ class MyApp extends StatelessWidget {
3637

3738
@override
3839
Widget build(BuildContext context) {
39-
return MaterialApp(
40-
title: 'Flukit',
41-
theme: ThemeData(
42-
primarySwatch: Colors.blue,
43-
),
44-
home: MyHomePage(title: 'Flukit demo'),
45-
);
40+
return LayoutBuilder(builder: (context, constraints) {
41+
final maxWidth = min(constraints.maxWidth, 500.0);
42+
return UnconstrainedBox(
43+
child: ConstrainedBox(
44+
constraints: constraints.copyWith(
45+
minWidth: maxWidth,
46+
maxWidth: maxWidth,
47+
),
48+
child: MaterialApp(
49+
title: 'Flukit',
50+
theme: ThemeData(
51+
primarySwatch: Colors.blue,
52+
),
53+
routes: routesMap,
54+
onGenerateRoute: (RouteSettings settings) {
55+
String routeName = settings.name!.substring(1).toLowerCase();
56+
routeName = Uri.decodeComponent(routeName);
57+
return MaterialPageRoute(
58+
builder: routesMap[routeName] ??
59+
(context) => const MyHomePage(title: 'Flukit demo'),
60+
);
61+
},
62+
home: const MyHomePage(title: 'Flukit demo'),
63+
),
64+
),
65+
);
66+
});
4667
}
4768
}
4869

@@ -58,67 +79,78 @@ class MyHomePage extends StatefulWidget {
5879
_MyHomePageState createState() => _MyHomePageState();
5980
}
6081

82+
final routes = [
83+
Page("AfterLayout", const AfterLayoutRoute(), showLog: true),
84+
Page(
85+
"AccurateSizedBox",
86+
const AccurateSizedBoxRoute(),
87+
showLog: true,
88+
),
89+
Page("AnimatedRotationBox", const AnimatedRotationBoxRoute()),
90+
Page("DoneWidget", const DoneWidgetRoute()),
91+
Page("GradientButton", const GradientButtonRoute()),
92+
Page(
93+
"GradientCircularProgressIndicator",
94+
const GradientCircularProgressRoute(),
95+
),
96+
Page(
97+
"KeepAlive Test",
98+
const KeepAliveTest(),
99+
padding: false,
100+
showLog: true,
101+
),
102+
Page("LayoutLogPrint", const LayoutLogPrintRoute(), showLog: true),
103+
Page("LeftRightBox", const LeftRightBoxRoute()),
104+
Page("Log Panel", const LogListenerScopeRoute(), withScaffold: false),
105+
Page(
106+
"OverflowWithTranslateBox",
107+
const OverflowWithTranslateRoute(),
108+
padding: false,
109+
),
110+
Page("PullRefresh", const PullRefreshRoute(), padding: false),
111+
112+
Page("Quick Scrollbar", const QuickScrollbarRoute()),
113+
Page("Swiper", SwiperRoute()),
114+
Page("Swiper Style", const SwiperStyleRoute()),
115+
Page("ScaleView", const ScaleViewRoute(), padding: false),
116+
Page(
117+
"SliverFlexibleHeader",
118+
const SliverFlexibleHeaderRoute(),
119+
padding: false,
120+
),
121+
Page(
122+
"SliverHeaderDelegate",
123+
const SliverHeaderDelegateRoute(),
124+
padding: false,
125+
),
126+
Page(
127+
"SliverPersistentHeaderToBox",
128+
const SliverPersistentHeaderToBoxRoute(),
129+
padding: false,
130+
),
131+
Page("SlideTransitionX", const SlideTransitionXRoute()),
132+
Page("TurnBox", TurnBoxRoute()),
133+
Page("WaterMark(水印)", const WatermarkRoute(), padding: false),
134+
// Page("AzListView", (ctx) => QuickSelectListViewRoute()),
135+
];
136+
137+
final routesMap = mapRoutes(routes);
138+
61139
class _MyHomePageState extends State<MyHomePage> {
62140
@override
63141
Widget build(BuildContext context) {
64142
return Scaffold(
65143
appBar: AppBar(title: Text(widget.title)),
66144
body: ListPage(
67-
children: [
68-
Page("AfterLayout", const AfterLayoutRoute(), showLog: true),
69-
Page(
70-
"AccurateSizedBox",
71-
const AccurateSizedBoxRoute(),
72-
showLog: true,
73-
),
74-
Page("AnimatedRotationBox", const AnimatedRotationBoxRoute()),
75-
Page("DoneWidget", const DoneWidgetRoute()),
76-
Page("GradientButton", const GradientButtonRoute()),
77-
Page(
78-
"GradientCircularProgressIndicator",
79-
const GradientCircularProgressRoute(),
80-
),
81-
Page(
82-
"KeepAlive Test",
83-
const KeepAliveTest(),
84-
padding: false,
85-
showLog: true,
86-
),
87-
Page("LayoutLogPrint", const LayoutLogPrintRoute(), showLog: true),
88-
Page("LeftRightBox", const LeftRightBoxRoute()),
89-
Page("Log Panel", const LogListenerScopeRoute(), withScaffold: false),
90-
Page(
91-
"OverflowWithTranslateBox",
92-
const OverflowWithTranslateRoute(),
93-
padding: false,
94-
),
95-
Page("PullRefresh", const PullRefreshRoute()),
96-
97-
Page("Quick Scrollbar", const QuickScrollbarRoute()),
98-
Page("Swiper", SwiperRoute()),
99-
Page("Swiper Style", const SwiperStyleRoute()),
100-
Page("ScaleView", const ScaleViewRoute(), padding: false),
101-
Page(
102-
"SliverFlexibleHeader",
103-
const SliverFlexibleHeaderRoute(),
104-
padding: false,
105-
),
106-
Page(
107-
"SliverHeaderDelegate",
108-
const SliverHeaderDelegateRoute(),
109-
padding: false,
110-
),
111-
Page(
112-
"SliverPersistentHeaderToBox",
113-
const SliverPersistentHeaderToBoxRoute(),
114-
padding: false,
115-
),
116-
Page("SlideTransitionX", const SlideTransitionXRoute()),
117-
Page("TurnBox", TurnBoxRoute()),
118-
Page("WaterMark(水印)", const WatermarkRoute(), padding: false),
119-
// Page("AzListView", (ctx) => QuickSelectListViewRoute()),
120-
],
145+
children: routes,
121146
),
122147
);
123148
}
124149
}
150+
151+
Map<String, WidgetBuilder> mapRoutes(List<Page> pages) {
152+
return pages.fold(<String, WidgetBuilder>{}, (pre, page) {
153+
pre[page.title.toLowerCase()] = page.build;
154+
return pre;
155+
});
156+
}

package_src/README-EN.MD

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
[中文简体](README.md)|English
2+
# flukit
3+
4+
*flukit* is a **Flutter UI Kit**
5+
6+
## Notice
7+
8+
**This project is in development now and there is no release or stable version。 We do not recommend that you use it in production .**
9+
10+
## Contribution&Run demo
11+
12+
### **Project dirs**
13+
14+
```
15+
flukit
16+
17+
--lib //demo dir
18+
--package_src
19+
--lib
20+
--src //widget dir
21+
```
22+
23+
### **Run demo**
24+
25+
```
26+
flutter run
27+
```
28+
[Demo is here](https://github.com/flutterchina/flukit/tree/main/lib/routes).
29+
30+
### **Notice of submission**
31+
32+
If you add a new widget,please follow these rules:
33+
34+
1. Add more details as possible in comments.
35+
2. Add demo in demo dir.
36+
37+
## Widgets
38+
39+
| Widget | Description | Related |
40+
| ------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
41+
| AfterLayout | A widget can retrieve its render object after layout. | |
42+
| AccurateSizedBox | A box with a specified size for its child. It is similar to [SizedBox], but the difference is SizedBox pass the constraints received from its parent to its child, but [AccurateSizedBox] not. | SizedBox |
43+
| AnimatedRotationBox | Rotates child forever | |
44+
| DoneWidget | Done tip widget | |
45+
| GradientButton<br />ElevatedGradientButton | Button with gradient colors | |
46+
| GradientCircularProgressIndicator | A circular progress indicator with gradient effect. | |
47+
| HitTestBlocker | A blocker by which we can intercept hit test flow. | |
48+
| KeepAliveWrapper | KeepAliveWrapper can keep the item(s) of scrollview alive. | |
49+
| LeftRightBox | A widget which supports left-right layout algorithm。 | |
50+
| LayoutLogPrint | A helper widget which can print constraints information in debug mode. | |
51+
| LogListenerScope | A stateful widget to listen redirected log events. | VerticalLogPanel、LogPanel |
52+
| VerticalLogPanel | A widget to show redirected logs from `print`, which will divide the available display space vertically into two areas, and display the logs below. | LogPanel、LogListenerScope |
53+
| LogPanel | A widget to show redirected logs from `print`. | VerticalLogPanel、LogListenerScope |
54+
| PullRefreshScope | A widget provides pull refresh scope. Typically, the child is a [CustomScrollView]. | SliverPullRefreshIndicator |
55+
| SliverPullRefreshIndicator | A indicator for PullRefreshScope. | PullRefreshScope |
56+
| QuickScrollbar | A quick scrollbar for scroll views. | |
57+
| Swiper | A scrollable list that works page by page automatically or manually, and it also support loop playbacks. | RectangleSwiperIndicator、CircleSwiperIndicator、SwiperController |
58+
| ScaleView | Scale the child from `minScale` to `maxScale` . support scale and double click gesture. | |
59+
| SliverFlexibleHeader | A sliver to provide a flexible header that its height can expand when user continue dragging over scroll . Typically as the first child of [CustomScrollView]. | SliverPullRefreshIndicator |
60+
| SliverPersistentHeaderToBox | A sliver like [SliverPersistentHeader], the difference is [SliverPersistentHeaderToBox] can contain a box widget and use the height of its child directly. | |
61+
| SliverHeaderDelegate | Delegate helper for [SliverPersistentHeader] | |
62+
| SlideTransitionX | Animates the position of a widget relative to its normal position ignoring the animation direction(always slide along one direction). Typically, is used in combination with [AnimatedSwitcher]. | |
63+
| TranslateWithExpandedPaintingArea | A widget that: 1. imposes different constraints on its child than it gets from its parent, possibly allowing the child to overflow the parent. 2. apply translate to its child (specified by [offset]). | |
64+
| TurnBox | Animates the rotation of a widget when [turns] is changed. | |
65+
| WaterMark | A widget that paints watermark. | TextWaterMarkPainter、StaggerTextWaterMarkPainter |
66+
67+
## Tools
68+
69+
| Tools | Description |
70+
| -------------------------- | ------------------------------------------------------------ |
71+
| ExtraInfoBoxConstraints | A box constraints with extra information. |
72+
| SafeValueNotifier | Make sure notifying is safe during build/layout/paint phase. |
73+
| RenderObjectAnimationMixin | Animation scheduling helper for RenderObject. |
74+

0 commit comments

Comments
 (0)