diff --git a/.metadata b/.metadata index e584bc7..ce13b42 100644 --- a/.metadata +++ b/.metadata @@ -1,8 +1,45 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled and should not be manually edited. +# This file should be version controlled. version: - revision: 2b14ac1efcaf353623cec7503e8374de91d95562 - channel: master + revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + - platform: android + create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + - platform: ios + create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + - platform: linux + create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + - platform: macos + create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + - platform: web + create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + - platform: windows + create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/CHANGELOG.md b/CHANGELOG.md index 4746e05..0d1051f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [3.0.1] +- support flutter 3.0 + +## [2.0.1] +- ScaleView:support PC +- Swiper: support PC mouse events + ## [2.0.0 stable] - 2.0 first stable version ## [2.0.0-beta5] diff --git a/README-EN.md b/README-EN.md index 983d924..2b278bd 100644 --- a/README-EN.md +++ b/README-EN.md @@ -3,37 +3,6 @@ *flukit* is a **Flutter UI Kit**。 -## Notice - -**This project is in development now and there is no release or stable version。 We do not recommend that you use it in production .** - -## Contribution&Run demo - -### **Project dirs** - -``` -flukit - - --lib //demo dir - --package_src - --lib - --src //widget dir -``` - -### **Run demo** - -``` -flutter run -``` -[Demo is here](https://github.com/flutterchina/flukit/tree/main/lib/routes). - -### **Notice of submission** - -If you add a new widget,please follow these rules: - -1. Add more details as possible in comments. -2. Add demo in demo dir. - ## Widgets | Widget | Description | @@ -72,3 +41,31 @@ If you add a new widget,please follow these rules: | SafeValueNotifier | Make sure notifying is safe during build/layout/paint phase. | | RenderObjectAnimationMixin | Animation scheduling helper for RenderObject. | + +## Contribution&Run demo + +### **Project dirs** + +``` +flukit + + --lib //demo dir + --package_src + --lib + --src //widget dir +``` + +### **Run demo** + +``` +flutter run +``` +[Demo is here](https://github.com/flutterchina/flukit/tree/main/lib/routes). + +### **Notice of submission** + +If you add a new widget,please follow these rules: + +1. Add more details as possible in comments. +2. Add demo in demo dir. + diff --git a/README.md b/README.md index 2a0203b..db95c1b 100644 --- a/README.md +++ b/README.md @@ -2,46 +2,9 @@ # Flukit [![Pub](https://img.shields.io/pub/v/flukit.svg?style=flat-square)](https://pub.dartlang.org/packages/flukit) -*flukit* (Flutter UI Kit)是一个Flutter Widget库。目前 2.0 版本正在预览中,2.0 版本有很大更新,可拉取项目后本地跑demo体验。 +*flukit* (Flutter UI Kit)是一个Flutter Widget库。 -## 注意 - -本项目正在持续迭代中,欢迎大家贡献代码。 - -## 贡献代码须知 - -### 工程目录 - -``` -flukit - --lib //示例目录 - --package_src - --lib - --example - --src //widget库目录 - --docs //文档目录,文档必须是markdown格式 - --images //文档用到的图片都放在这里,如截图 - --chs //中文文档目录 - --en //英文文档目录 -``` - -### 运行Demo - -[示例目录](https://github.com/flutterchina/flukit/tree/main/package_src/lib/example). - -``` -flutter run -``` - -### **提交代码须知** - -如果你添加了一个组件,请遵循如下规则: - -1. 尽可能多的添加注释,文档注释为三斜线"///" -2. 添加一个新的Widget后,请在Demo目录添加使用示例,示例应该纯净无干扰,如果一个widget需要多个示例,可以创建一个二级页面,可以参照水印组件 WaterMark 的示例。 -3. 如果可以,请尽可能在doc 目录下为widget添加使用文档,文档必须是markdown格式,文档名应与widget文件名同名 - -## Widgets +## 组件列表 | Widget | Description | | ------------------------------------------ | ------------------------------------------------------------ | @@ -90,3 +53,39 @@ flutter run + +## 贡献代码须知 + +### 工程目录 + +``` +flukit + --lib //示例目录 + --package_src + --lib + --example + --src //widget库目录 + --docs //文档目录,文档必须是markdown格式 + --images //文档用到的图片都放在这里,如截图 + --chs //中文文档目录 + --en //英文文档目录 +``` + +### 运行Demo + +[示例目录](https://github.com/flutterchina/flukit/tree/main/package_src/lib/example). + +``` +flutter run +``` + +### **提交代码须知** + +如果你添加了一个组件,请遵循如下规则: + +1. 尽可能多的添加注释,文档注释为三斜线"///" +2. 添加一个新的Widget后,请在Demo目录添加使用示例,示例应该纯净无干扰,如果一个widget需要多个示例,可以创建一个二级页面,可以参照水印组件 WaterMark 的示例。 +3. 如果可以,请尽可能在doc 目录下为widget添加使用文档,文档必须是markdown格式,文档名应与widget文件名同名 + + + diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9f6253b..ef6891b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -139,7 +139,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..3db53b6 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + diff --git a/lib/main.dart b/lib/main.dart index 8f6df9e..a012ff0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:math'; import 'package:flukit/flukit.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart' hide Page; import 'package:flukit/example/example.dart'; @@ -39,29 +38,21 @@ class MyApp extends StatelessWidget { return LayoutBuilder(builder: (context, constraints) { final routesMap= mapRoutes(getRoutes()); final maxWidth = min(constraints.maxWidth, 500.0); - return UnconstrainedBox( - child: ConstrainedBox( - constraints: constraints.copyWith( - minWidth: maxWidth, - maxWidth: maxWidth, - ), - child: MaterialApp( - title: 'Flukit', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - routes: routesMap, - onGenerateRoute: (RouteSettings settings) { - String routeName = settings.name!.substring(1).toLowerCase(); - routeName = Uri.decodeComponent(routeName); - return MaterialPageRoute( - builder: routesMap[routeName] ?? - (context) => const MyHomePage(title: 'Flukit demo'), - ); - }, - home: const MyHomePage(title: 'Flukit demo'), - ), + return MaterialApp( + title: 'Flukit', + theme: ThemeData( + primarySwatch: Colors.blue, ), + routes: routesMap, + onGenerateRoute: (RouteSettings settings) { + String routeName = settings.name!.substring(1).toLowerCase(); + routeName = Uri.decodeComponent(routeName); + return MaterialPageRoute( + builder: routesMap[routeName] ?? + (context) => const MyHomePage(title: 'Flukit demo'), + ); + }, + home: const MyHomePage(title: 'Flukit demo'), ); }); } diff --git a/package_src/CHANGELOG.md b/package_src/CHANGELOG.md new file mode 100644 index 0000000..0d1051f --- /dev/null +++ b/package_src/CHANGELOG.md @@ -0,0 +1,19 @@ +## [3.0.1] +- support flutter 3.0 + +## [2.0.1] +- ScaleView:support PC +- Swiper: support PC mouse events + +## [2.0.0 stable] +- 2.0 first stable version +## [2.0.0-beta5] +- move examples to package dir. +- optimize ScaleView +- fix LogPanel bugs + +## [2.0.0-beta2] +- Add lots of widgets. +## [1.0.2] +- Add InfiniteListView、GradientButton + diff --git a/package_src/LICENSE b/package_src/LICENSE index a22a2da..b4ce212 100644 --- a/package_src/LICENSE +++ b/package_src/LICENSE @@ -1 +1,21 @@ -MIT +MIT License + +Copyright (c) 2018 wendux + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/package_src/README-EN.md b/package_src/README-EN.md new file mode 100644 index 0000000..2b278bd --- /dev/null +++ b/package_src/README-EN.md @@ -0,0 +1,71 @@ +[中文简体](README.md)|English +# flukit + +*flukit* is a **Flutter UI Kit**。 + +## Widgets + +| Widget | Description | +| ------------------------------------------ | ------------------------------------------------------------ | +| AfterLayout | A widget can retrieve its render object after layout. | +| 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. | +| AnimatedRotationBox | Rotates child forever | +| DoneWidget | Done tip widget | +| GradientButton
ElevatedGradientButton | Button with gradient colors | +| GradientCircularProgressIndicator | A circular progress indicator with gradient effect. | +| HitTestBlocker | A blocker by which we can intercept hit test flow. | +| KeepAliveWrapper | KeepAliveWrapper can keep the item(s) of scrollview alive. | +| LeftRightBox | A widget which supports left-right layout algorithm。 | +| LayoutLogPrint | A helper widget which can print constraints information in debug mode. | +| LogListenerScope | A stateful widget to listen redirected log events. | +| 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 | A widget to show redirected logs from `print`. | +| PullRefreshScope | A widget provides pull refresh scope. Typically, the child is a [CustomScrollView]. | +| SliverPullRefreshIndicator | A indicator for PullRefreshScope. | +| QuickScrollbar | A quick scrollbar for scroll views. | +| Swiper | A scrollable list that works page by page automatically or manually, and it also support loop playbacks. | +| ScaleView | Scale the child from `minScale` to `maxScale` . support scale and double click gesture. | +| 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]. | +| SliverPersistentHeaderToBox | A sliver like [SliverPersistentHeader], the difference is [SliverPersistentHeaderToBox] can contain a box widget and use the height of its child directly. | +| SliverHeaderDelegate | Delegate helper for [SliverPersistentHeader] | +| 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]. | +| 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]). | +| TurnBox | Animates the rotation of a widget when [turns] is changed. | +| WaterMark | A widget that paints watermark. | + +## Tools + +| Tools | Description | +| -------------------------- | ------------------------------------------------------------ | +| ExtraInfoBoxConstraints | A box constraints with extra information. | +| SafeValueNotifier | Make sure notifying is safe during build/layout/paint phase. | +| RenderObjectAnimationMixin | Animation scheduling helper for RenderObject. | + + +## Contribution&Run demo + +### **Project dirs** + +``` +flukit + + --lib //demo dir + --package_src + --lib + --src //widget dir +``` + +### **Run demo** + +``` +flutter run +``` +[Demo is here](https://github.com/flutterchina/flukit/tree/main/lib/routes). + +### **Notice of submission** + +If you add a new widget,please follow these rules: + +1. Add more details as possible in comments. +2. Add demo in demo dir. + diff --git a/package_src/README.md b/package_src/README.md index 2a0203b..db95c1b 100644 --- a/package_src/README.md +++ b/package_src/README.md @@ -2,46 +2,9 @@ # Flukit [![Pub](https://img.shields.io/pub/v/flukit.svg?style=flat-square)](https://pub.dartlang.org/packages/flukit) -*flukit* (Flutter UI Kit)是一个Flutter Widget库。目前 2.0 版本正在预览中,2.0 版本有很大更新,可拉取项目后本地跑demo体验。 +*flukit* (Flutter UI Kit)是一个Flutter Widget库。 -## 注意 - -本项目正在持续迭代中,欢迎大家贡献代码。 - -## 贡献代码须知 - -### 工程目录 - -``` -flukit - --lib //示例目录 - --package_src - --lib - --example - --src //widget库目录 - --docs //文档目录,文档必须是markdown格式 - --images //文档用到的图片都放在这里,如截图 - --chs //中文文档目录 - --en //英文文档目录 -``` - -### 运行Demo - -[示例目录](https://github.com/flutterchina/flukit/tree/main/package_src/lib/example). - -``` -flutter run -``` - -### **提交代码须知** - -如果你添加了一个组件,请遵循如下规则: - -1. 尽可能多的添加注释,文档注释为三斜线"///" -2. 添加一个新的Widget后,请在Demo目录添加使用示例,示例应该纯净无干扰,如果一个widget需要多个示例,可以创建一个二级页面,可以参照水印组件 WaterMark 的示例。 -3. 如果可以,请尽可能在doc 目录下为widget添加使用文档,文档必须是markdown格式,文档名应与widget文件名同名 - -## Widgets +## 组件列表 | Widget | Description | | ------------------------------------------ | ------------------------------------------------------------ | @@ -90,3 +53,39 @@ flutter run + +## 贡献代码须知 + +### 工程目录 + +``` +flukit + --lib //示例目录 + --package_src + --lib + --example + --src //widget库目录 + --docs //文档目录,文档必须是markdown格式 + --images //文档用到的图片都放在这里,如截图 + --chs //中文文档目录 + --en //英文文档目录 +``` + +### 运行Demo + +[示例目录](https://github.com/flutterchina/flukit/tree/main/package_src/lib/example). + +``` +flutter run +``` + +### **提交代码须知** + +如果你添加了一个组件,请遵循如下规则: + +1. 尽可能多的添加注释,文档注释为三斜线"///" +2. 添加一个新的Widget后,请在Demo目录添加使用示例,示例应该纯净无干扰,如果一个widget需要多个示例,可以创建一个二级页面,可以参照水印组件 WaterMark 的示例。 +3. 如果可以,请尽可能在doc 目录下为widget添加使用文档,文档必须是markdown格式,文档名应与widget文件名同名 + + + diff --git a/package_src/lib/src/after_layout.dart b/package_src/lib/src/after_layout.dart index 95efa1f..36e06b6 100644 --- a/package_src/lib/src/after_layout.dart +++ b/package_src/lib/src/after_layout.dart @@ -45,7 +45,7 @@ class RenderAfterLayout extends RenderProxyBox { // 如果callback中又触发了UI更新(比如调用了 setState)则会报错。因此,我们 // 在 frame 结束的时候再去触发回调。 // callback(this); - SchedulerBinding.instance! + SchedulerBinding.instance .addPostFrameCallback((timeStamp) => callback(this)); } diff --git a/package_src/lib/src/log_panel.dart b/package_src/lib/src/log_panel.dart index a25cf5a..10e1dd0 100644 --- a/package_src/lib/src/log_panel.dart +++ b/package_src/lib/src/log_panel.dart @@ -478,7 +478,7 @@ class _LogPanelState extends State { } void _jumpToListEnd() { - SchedulerBinding.instance!.addPostFrameCallback((_) { + SchedulerBinding.instance.addPostFrameCallback((_) { if (mounted) { _controller.jumpTo( _controller.position.maxScrollExtent, diff --git a/package_src/lib/src/pull_refresh.dart b/package_src/lib/src/pull_refresh.dart index 895a35c..e137912 100644 --- a/package_src/lib/src/pull_refresh.dart +++ b/package_src/lib/src/pull_refresh.dart @@ -174,7 +174,7 @@ class SliverPullRefreshIndicatorState if (value == _height) return; _height = value; // build/layout 过程中不能调用 setState - SchedulerBinding.instance!.addPostFrameCallback((_) => setState(() => {})); + SchedulerBinding.instance.addPostFrameCallback((_) => setState(() => {})); } void goBack() { diff --git a/package_src/lib/src/render_object_animation_mixin.dart b/package_src/lib/src/render_object_animation_mixin.dart index cc2c7f7..8d3c4fc 100644 --- a/package_src/lib/src/render_object_animation_mixin.dart +++ b/package_src/lib/src/render_object_animation_mixin.dart @@ -1,4 +1,3 @@ -import 'package:flutter/rendering.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/widgets.dart'; @@ -33,7 +32,7 @@ mixin RenderObjectAnimationMixin on RenderObject { void _scheduleAnimation() { //SchedulerBinding.instance.remo if (_animationStatus != AnimationStatus.completed) { - SchedulerBinding.instance!.addPostFrameCallback((Duration timeStamp) { + SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) { if (_lastTimeStamp != null) { double delta = (timeStamp.inMilliseconds - _lastTimeStamp!) / duration.inMilliseconds; diff --git a/package_src/lib/src/safe_value_notifier.dart b/package_src/lib/src/safe_value_notifier.dart index 23141fa..72d649c 100644 --- a/package_src/lib/src/safe_value_notifier.dart +++ b/package_src/lib/src/safe_value_notifier.dart @@ -14,10 +14,10 @@ class SafeValueNotifier extends ValueNotifier { @override void notifyListeners() { - final schedulerPhase = SchedulerBinding.instance!.schedulerPhase; + final schedulerPhase = SchedulerBinding.instance.schedulerPhase; // build/layout/paint are performed in persistentCallbacks. if (schedulerPhase == SchedulerPhase.persistentCallbacks) { - SchedulerBinding.instance!.addPostFrameCallback((_) { + SchedulerBinding.instance.addPostFrameCallback((_) { super.notifyListeners(); }); } else { diff --git a/package_src/lib/src/scale_view.dart b/package_src/lib/src/scale_view.dart index 0a02949..a03e7bf 100644 --- a/package_src/lib/src/scale_view.dart +++ b/package_src/lib/src/scale_view.dart @@ -207,7 +207,7 @@ class _ScaleViewState extends State late Offset scaleAnchor; if (_childRect.contains(_doubleClickPosition)) { scaleAnchor = Offset( - _doubleClickPosition.dx, + (_doubleClickPosition.dx - _childRect.left), (_doubleClickPosition.dy - _childRect.top), ); } else { diff --git a/package_src/lib/src/swiper.dart b/package_src/lib/src/swiper.dart index 3bda07c..398d510 100644 --- a/package_src/lib/src/swiper.dart +++ b/package_src/lib/src/swiper.dart @@ -507,7 +507,11 @@ class _SwiperState extends State onPointerDown: (event) => _timer?.cancel(), onPointerCancel: (event) => _start(), onPointerUp: (event) => _start(), - child: Stack(alignment: widget.indicatorAlignment, children: children), + child: MouseRegion( + onEnter: (event) => _timer?.cancel(), + onExit: (event) => _start(), + child: Stack(alignment: widget.indicatorAlignment, children: children), + ), ); } } diff --git a/package_src/pubspec.yaml b/package_src/pubspec.yaml index 2c12f84..4df2a20 100644 --- a/package_src/pubspec.yaml +++ b/package_src/pubspec.yaml @@ -1,6 +1,6 @@ name: flukit -description: flukit(Flutter UI Kit), a flutter common library which contains ScaleView, Swiper, GradientCircularProgressIndicator... -version: 2.0.0 +description: flukit(Flutter UI Kit), a flutter common library which contains ScaleView, Swiper, PullRefrsh, WaterMark, GradientCircularProgressIndicator... +version: 3.0.1 homepage: https://github.com/flutterchina/flukit