forked from lxm_flutter/FlutterUnit
✨ 添加AnimatedPhysicalModel、PhysicalModel、Directionality、AnimatedTheme
This commit is contained in:
28
README.md
28
README.md
@@ -5,13 +5,13 @@
|
||||
- 🔥 [Flutter实用插件集录 ](https://github.com/toly1994328/FlutterUnit/issues/41)
|
||||
- 🔥 [Flutter要点集录 ](https://github.com/toly1994328/FlutterUnit/labels/point)
|
||||
|
||||
[](https://github.com/toly1994328/FlutterUnit/stargazers)
|
||||
[](https://github.com/toly1994328/FlutterUnit/network)
|
||||
[](https://github.com/toly1994328/FlutterUnit/blob/master/LICENSE)
|
||||
|
||||
|
||||
### FlutterUnit 下载体验:
|
||||
|
||||
|
||||
[](https://github.com/toly1994328/FlutterUnit/stargazers)
|
||||
[](https://github.com/toly1994328/FlutterUnit/network)
|
||||
[](https://github.com/toly1994328/FlutterUnit/blob/master/LICENSE)
|
||||
|
||||
| FlutterUnit.apk 下载 | FlutterUnit mac版 下载 | FlutterUnit win版 下载 |
|
||||
|------|------------|------------|
|
||||
@@ -40,11 +40,11 @@ Tools • Dart 2.9.0
|
||||
|
||||
### 一、组件的展示页面
|
||||
|
||||
#### 1. `210+组件收录`
|
||||
#### 1. `260+组件收录`
|
||||
|
||||
> Flutter源码中的可用的组件一共350个左右,纷繁复杂,也没有明确的分类标准
|
||||
FlutterUnit 对`大大小小,常用不常用`的组件能收的尽量收录。并`根据个人感觉进行评星 `
|
||||
`目前收录组件213个`,每个都有至少一个演示展现和代码展示。
|
||||
`目前收录组件260个`,每个都有至少一个演示展现和代码展示。
|
||||
|
||||
| . | . | . |
|
||||
|------|------------|------------|
|
||||
@@ -167,13 +167,19 @@ FlutterUnit 对`大大小小,常用不常用`的组件能收的尽量收录。
|
||||
|
||||
---
|
||||
|
||||
#### 2.搜藏功能
|
||||
#### 2.收藏功能
|
||||
|
||||
> 搜藏页做得比较简陋,后面打算做收藏夹,可以自己创建的那种。
|
||||
|
||||
| . | . | . |
|
||||
| 添加收藏集 | 修改收藏集 | 删除收藏集 |
|
||||
|------|------------|------------|
|
||||
||| |
|
||||
|  |  |  |
|
||||
|
||||
| 长按左菜单滑页 | 长按右菜单滑页 | 详情内长按展示收藏菜单 |
|
||||
|------|------------|------------|
|
||||
|  | |  |
|
||||
|
||||
| 删除与数据同步 | 组件加入收藏集 | 收藏集支持多选 |
|
||||
|------|------------|------------|
|
||||
|  |  |  |
|
||||
|
||||
> `FlutterUnit 1.0 `目前基本就是这么多功能,可以在Github中下载打包后的apk玩玩
|
||||
希望能对你的Flutter学习有所帮助。
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 173 KiB |
@@ -29,13 +29,11 @@ class BlocWrapper extends StatelessWidget {
|
||||
create: (_) => GlobalBloc(storage)..add(EventInitApp())),
|
||||
|
||||
BlocProvider<HomeBloc>(
|
||||
create: (_) => HomeBloc(repository: repository)
|
||||
..add(EventTabTap(WidgetFamily.statelessWidget))),
|
||||
create: (_) => HomeBloc(repository: repository)..add(EventTabTap(WidgetFamily.statelessWidget))),
|
||||
|
||||
BlocProvider<DetailBloc>(create: (_) => DetailBloc(repository: repository)),
|
||||
|
||||
BlocProvider<DetailBloc>(
|
||||
create: (_) => DetailBloc(repository: repository)),
|
||||
BlocProvider<CategoryBloc>(
|
||||
// lazy: false,
|
||||
create: (_) =>
|
||||
CategoryBloc(repository: categoryRepo)..add(EventLoadCategory())),
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -116,6 +116,5 @@ class _CollectPageState extends State<CollectPage>
|
||||
onPressed: () => Scaffold.of(context).openEndDrawer());
|
||||
|
||||
@override
|
||||
// TODO: implement wantKeepAlive
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:flutter/cupertino.dart';
|
||||
/// 说明:
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:flutter_unit/app/api/github/issues_api.dart';
|
||||
import 'package:flutter_unit/app/style/TolyIcon.dart';
|
||||
import 'package:flutter_unit/app/utils/convert_man.dart';
|
||||
@@ -17,22 +16,10 @@ import 'package:flutter_unit/components/permanent/circle_image.dart';
|
||||
import 'package:flutter_unit/model/github/issue.dart';
|
||||
import 'package:flutter_unit/model/github/repository.dart';
|
||||
|
||||
|
||||
class IssuesPointPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: Text("Flutter Unit Point"),
|
||||
// ),
|
||||
body: IssuesPointContent()
|
||||
// ListView(
|
||||
// children: <Widget>[
|
||||
// RepoWidget(),
|
||||
// IssuesPointContent(),
|
||||
// ],
|
||||
// ),
|
||||
);
|
||||
return Scaffold(body: IssuesPointContent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +33,6 @@ class RepoWidget extends StatelessWidget {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 56 + 24.0, bottom: 5),
|
||||
padding: EdgeInsets.all(10),
|
||||
// alignment: Alignment.bottomCenter,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(color: Colors.grey, offset: Offset(0, .5), blurRadius: 3)
|
||||
@@ -66,10 +52,14 @@ class RepoWidget extends StatelessWidget {
|
||||
repository.fullName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
WrapColor(
|
||||
child:Text(
|
||||
child: Text(
|
||||
repository.license.spdxId,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 12),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
fontSize: 12),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
@@ -102,10 +92,10 @@ class RepoWidget extends StatelessWidget {
|
||||
Text(repository.stargazersCount.toString()),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical:8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Text(
|
||||
"|",
|
||||
style: TextStyle(fontSize: 20,color: Colors.blue),
|
||||
style: TextStyle(fontSize: 20, color: Colors.blue),
|
||||
),
|
||||
),
|
||||
Wrap(
|
||||
@@ -113,14 +103,16 @@ class RepoWidget extends StatelessWidget {
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Icon(TolyIcon.icon_show),
|
||||
SizedBox(width: 5,),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(repository.subscribersCount.toString()),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical:8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Text(
|
||||
"|",
|
||||
style: TextStyle(fontSize: 20,color: Colors.blue),
|
||||
style: TextStyle(fontSize: 20, color: Colors.blue),
|
||||
),
|
||||
),
|
||||
Wrap(
|
||||
@@ -131,10 +123,10 @@ class RepoWidget extends StatelessWidget {
|
||||
Text(repository.forksCount.toString()),
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical:8.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Text(
|
||||
"|",
|
||||
style: TextStyle(fontSize: 20,color: Colors.blue),
|
||||
style: TextStyle(fontSize: 20, color: Colors.blue),
|
||||
),
|
||||
),
|
||||
Wrap(
|
||||
@@ -142,7 +134,9 @@ class RepoWidget extends StatelessWidget {
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Icon(TolyIcon.icon_issues),
|
||||
SizedBox(width: 5,),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(repository.openIssuesCount.toString()),
|
||||
]),
|
||||
],
|
||||
@@ -175,9 +169,10 @@ class _IssuesPointContentState extends State<IssuesPointContent> {
|
||||
content = SliverPadding(
|
||||
padding: EdgeInsets.only(top: 40),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: SpinKitWave(
|
||||
color: Colors.blue,
|
||||
)
|
||||
child: Container(),
|
||||
// child: SpinKitWave(
|
||||
// color: Colors.blue,
|
||||
// )
|
||||
),
|
||||
);
|
||||
} else {
|
||||
@@ -382,7 +377,10 @@ class IssueItem extends StatelessWidget {
|
||||
Spacer(),
|
||||
WrapColor(
|
||||
color: Colors.greenAccent,
|
||||
child: Text(issue.commentNum.toString(),style: TextStyle(color: Colors.white),)),
|
||||
child: Text(
|
||||
issue.commentNum.toString(),
|
||||
style: TextStyle(color: Colors.white),
|
||||
)),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
@@ -408,7 +406,11 @@ class IssueItem extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
WrapColor(child: Text("#${issue.number}",style: TextStyle(color: Colors.white),)),
|
||||
WrapColor(
|
||||
child: Text(
|
||||
"#${issue.number}",
|
||||
style: TextStyle(color: Colors.white),
|
||||
)),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
|
||||
@@ -12,7 +12,7 @@ class LoginFrom extends StatefulWidget {
|
||||
|
||||
class _LoginFromState extends State<LoginFrom> {
|
||||
final _usernameController = TextEditingController(text: 'toly1994328');
|
||||
final _passwordController = TextEditingController(text: '@#1994328zfjtl');
|
||||
final _passwordController = TextEditingController(text: '');
|
||||
|
||||
bool _showPwd = false;
|
||||
|
||||
@@ -22,7 +22,7 @@ class _LoginFromState extends State<LoginFrom> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text("FlutterUnit 登录",style: TextStyle(fontSize: 25),),
|
||||
SizedBox(height: 10,),
|
||||
SizedBox(height: 5,),
|
||||
Text("请使用github用户名登录",style: TextStyle(color: Colors.grey),),
|
||||
SizedBox(height:20,),
|
||||
buildUsernameInput(),
|
||||
@@ -71,7 +71,7 @@ class _LoginFromState extends State<LoginFrom> {
|
||||
}
|
||||
|
||||
Widget _buildBtn() => Container(
|
||||
margin: EdgeInsets.only(top: 10, left: 10, right: 10,bottom: 10),
|
||||
margin: EdgeInsets.only(top: 10, left: 10, right: 10,bottom: 0),
|
||||
height: 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child:
|
||||
@@ -110,7 +110,7 @@ class _LoginFromState extends State<LoginFrom> {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 30.0,
|
||||
height: 20.0,
|
||||
width: 1.0,
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
margin: const EdgeInsets.only(left: 00.0, right: 10.0),
|
||||
|
||||
@@ -110,7 +110,6 @@ class _SearchPageState extends State<SearchPage> {
|
||||
Widget _buildSliverList(List<WidgetModel> models) => SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, int index) => Container(
|
||||
// margin: EdgeInsets.symmetric(horizontal: 15, vertical: 5),
|
||||
child: InkWell(
|
||||
onTap: () => _toDetailPage(models[index]),
|
||||
child: TechnoWidgetListItem(
|
||||
|
||||
63
lib/views/widgets/ProxyWidget/Directionality/node1_base.dart
Normal file
63
lib/views/widgets/ProxyWidget/Directionality/node1_base.dart
Normal file
@@ -0,0 +1,63 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020-03-23
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明: 319 Directionality 定向性 为后代改变有textDirection属性的组件统一设置属性值,也可以通过Directionality.of(context)获取当前textDirection默认属性。
|
||||
// {
|
||||
// "widgetId": 319,
|
||||
// "name": "Directionality基本使用",
|
||||
// "priority": 1,
|
||||
// "subtitle": "【textDirection】 : 文字排列方向 【TextDirection】\n"
|
||||
// "【child】 : 子组件 【Widget】",
|
||||
// }
|
||||
class DirectionalityDemo extends StatefulWidget {
|
||||
@override
|
||||
_DirectionalityDemoState createState() => _DirectionalityDemoState();
|
||||
}
|
||||
|
||||
class _DirectionalityDemoState extends State<DirectionalityDemo> {
|
||||
TextDirection _textDirection = TextDirection.rtl;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Directionality(
|
||||
textDirection: _textDirection,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
width: 250,
|
||||
color: Colors.grey.withAlpha(33),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'A widget that determines the ambient directionality of text and text direction sensitive render objects.'),
|
||||
_buildSwitch(),
|
||||
Text(
|
||||
'The text direction from the closest instance of this class that encloses the given context.'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSwitch() {
|
||||
return Row(
|
||||
children: [
|
||||
Switch(
|
||||
value: _textDirection == TextDirection.rtl,
|
||||
onChanged: (v) {
|
||||
setState(() {
|
||||
_textDirection =
|
||||
v ? TextDirection.rtl : TextDirection.ltr;
|
||||
});
|
||||
},
|
||||
),
|
||||
Text(
|
||||
_textDirection.toString(),
|
||||
style: TextStyle(color: Colors.blue, fontSize: 18),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020-03-23
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明: 296 PhysicalModel 物理模块 可以让子组件按照圆形、方行进行剪裁,并且可以指定背景色、圆角、影深、阴影颜色、剪切行为。
|
||||
// {
|
||||
// "widgetId": 296,
|
||||
// "name": "PhysicalModel基本使用",
|
||||
// "priority": 1,
|
||||
// "subtitle": "【clipBehavior】 : 裁剪行为 【Clip】\n"
|
||||
// "【borderRadius】 : 圆角 【BorderRadius】\n"
|
||||
// "【child】 : 子组件 【Widget】\n"
|
||||
// "【elevation】 : 阴影深 【double】\n"
|
||||
// "【shadowColor】 : 阴影颜色 【Color】\n"
|
||||
// "【shape】 : 形状 【BoxShape】\n"
|
||||
// "【color】: 颜色 【Color】",
|
||||
// }
|
||||
class PhysicalModelDemo extends StatelessWidget{
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Container(
|
||||
width: 150,
|
||||
height: 150,
|
||||
child: PhysicalModel(
|
||||
shadowColor: Colors.orange,
|
||||
elevation: 3,
|
||||
child: Image.asset(
|
||||
'assets/images/caver.jpeg',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.deepPurpleAccent),
|
||||
),
|
||||
|
||||
Container(
|
||||
width: 150,
|
||||
height: 150,
|
||||
child: PhysicalModel(
|
||||
shadowColor: Colors.orange,
|
||||
elevation: 3,
|
||||
child: Image.asset(
|
||||
'assets/images/caver.jpeg',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
shape: BoxShape.rectangle,
|
||||
color: Colors.deepPurpleAccent),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
||||
/// 说明: 279 PhysicalShape 物理形状 可以让子组件按照路径进行剪裁,并且可以指定背景色、影深、阴影颜色、剪切行为。
|
||||
// {
|
||||
// "widgetId": 279,
|
||||
// "name": "返回按钮基本使用",
|
||||
// "name": "PhysicalShape基本使用",
|
||||
// "priority": 1,
|
||||
// "subtitle": "【clipper】 : 裁剪器 【CustomClipper<Path>】\n"
|
||||
// "【clipBehavior】 : 裁剪行为 【Clip】\n"
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020-03-23
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明: 225 相关属性变化时具有动画效果的PhysicalModel组件,本质是PhysicalModel和动画结合的产物。可指定阴影、影深、圆角、动画时长、结束回调等属性。
|
||||
// {
|
||||
// "widgetId": 225 ,
|
||||
// "name": 'AnimatedPhysicalModel基本使用',
|
||||
// "priority": 1,
|
||||
// "subtitle":
|
||||
// "【color】 : 背景色 【Color】\n"
|
||||
// "【duration】 : 动画时长 【Duration】\n"
|
||||
// "【onEnd】 : 动画结束回调 【Function()】\n"
|
||||
// "【curve】 : 动画曲线 【Duration】\n"
|
||||
// "【shape】 : 形状 【BoxShape】\n"
|
||||
// "【elevation】 : 影深 【double】\n"
|
||||
// "【borderRadius】 : 圆角 【BorderRadius】\n"
|
||||
// "【shadowColor】 : 阴影色 【Color】\n"
|
||||
// "【child】 : 子组件 【Widget】",
|
||||
// }
|
||||
class AnimatedPhysicalModelDemo extends StatefulWidget {
|
||||
@override
|
||||
_AnimatedPhysicalModelDemoState createState() =>
|
||||
_AnimatedPhysicalModelDemoState();
|
||||
}
|
||||
|
||||
class _AnimatedPhysicalModelDemoState extends State<AnimatedPhysicalModelDemo> {
|
||||
bool flag = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
_buildSwitch(),
|
||||
Container(
|
||||
width: 150,
|
||||
height: 150,
|
||||
child: AnimatedPhysicalModel(
|
||||
duration: Duration(seconds: 2),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
shadowColor: flag?Colors.orange:Colors.purple,
|
||||
elevation: flag?10:5,
|
||||
child: Image.asset(
|
||||
'assets/images/caver.jpeg',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(flag? 10:75)),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
shape: BoxShape.rectangle,
|
||||
color: Colors.deepPurpleAccent,
|
||||
onEnd: () {
|
||||
print('----onEnd---');
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSwitch() {
|
||||
return Switch(
|
||||
value: flag,
|
||||
onChanged: (v) {
|
||||
setState(() {
|
||||
flag = v;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020-03-23
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明: 224 主题变化时具有动画效果的组件,本质是Theme组件和动画结合的产物。可指定ThemeData、动画时长、曲线、结束回调等。相当于增强版的Theme组件。
|
||||
// {
|
||||
// "widgetId": 224 ,
|
||||
// "name": 'AnimatedTheme基本使用',
|
||||
// "priority": 1,
|
||||
// "subtitle":
|
||||
// "【data】 : 主题数据 【ThemeData】\n"
|
||||
// "【duration】 : 动画时长 【Duration】\n"
|
||||
// "【onEnd】 : 动画结束回调 【Function()】\n"
|
||||
// "【curve】 : 动画曲线 【Duration】\n"
|
||||
// "【child】 : 子组件 【Widget】",
|
||||
// }
|
||||
class AnimatedThemeDemo extends StatefulWidget {
|
||||
@override
|
||||
_AnimatedThemeDemoState createState() => _AnimatedThemeDemoState();
|
||||
}
|
||||
|
||||
class _AnimatedThemeDemoState extends State<AnimatedThemeDemo> {
|
||||
ThemeData startThem = ThemeData(
|
||||
primaryColor: Colors.blue,
|
||||
textTheme: TextTheme(
|
||||
headline1: TextStyle(
|
||||
color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold),
|
||||
));
|
||||
|
||||
ThemeData endThem = ThemeData(
|
||||
primaryColor: Colors.red,
|
||||
textTheme: TextTheme(
|
||||
headline1: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal)));
|
||||
|
||||
ThemeData them;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
them = startThem;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
_buildSwitch(),
|
||||
AnimatedTheme(
|
||||
data: them,
|
||||
duration: Duration(seconds: 2),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
onEnd: () {
|
||||
print('----onEnd---');
|
||||
},
|
||||
child: ChildContent(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSwitch() {
|
||||
print(them == endThem);
|
||||
return Switch(
|
||||
value: them == endThem,
|
||||
onChanged: (v) {
|
||||
setState(() {
|
||||
them = v ? endThem : startThem;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class ChildContent extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: 250,
|
||||
height: 60,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Text(
|
||||
'Flutter Unit',
|
||||
style: Theme.of(context).textTheme.headline1,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
58
lib/views/widgets/StatefulWidget/zz_no/Scrollable.dart
Normal file
58
lib/views/widgets/StatefulWidget/zz_no/Scrollable.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
//import 'package:flutter/material.dart';
|
||||
//
|
||||
///// create by 张风捷特烈 on 2020-03-28
|
||||
///// contact me by email 1981462002@qq.com
|
||||
///// 说明:
|
||||
//
|
||||
//class CustomScrollable extends StatelessWidget {
|
||||
// final data = <Color>[
|
||||
// Colors.blue[50],
|
||||
// Colors.blue[100],
|
||||
// Colors.blue[200],
|
||||
// Colors.blue[300],
|
||||
// Colors.blue[400],
|
||||
// Colors.blue[500],
|
||||
// Colors.blue[600],
|
||||
// Colors.blue[700],
|
||||
// Colors.blue[800],
|
||||
// Colors.blue[900],
|
||||
// ];
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Container(
|
||||
// height: 200,
|
||||
// child: Scrollable(
|
||||
// viewportBuilder: (ctx, p) => Viewport(offset: p,
|
||||
// slivers: <Widget>[
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// Column buildColumn() {
|
||||
// return Column(
|
||||
// children: data
|
||||
// .map((color) => Container(
|
||||
// alignment: Alignment.center,
|
||||
// height: 50,
|
||||
// color: color,
|
||||
// child: Text(
|
||||
// colorString(color),
|
||||
// style: TextStyle(color: Colors.white, shadows: [
|
||||
// Shadow(
|
||||
// color: Colors.black,
|
||||
// offset: Offset(.5, .5),
|
||||
// blurRadius: 2)
|
||||
// ]),
|
||||
// ),
|
||||
// ))
|
||||
// .toList(),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// String colorString(Color color) =>
|
||||
// "#${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}";
|
||||
//}
|
||||
@@ -25,3 +25,4 @@ export '../ProxyWidget/PopupMenuTheme/node1_base.dart';
|
||||
export '../ProxyWidget/ToggleButtonsTheme/node1_base.dart';
|
||||
export '../ProxyWidget/ButtonBarTheme/node1_base.dart';
|
||||
export '../ProxyWidget/TooltipTheme/node1_base.dart';
|
||||
export '../ProxyWidget/Directionality/node1_base.dart';
|
||||
|
||||
@@ -33,6 +33,7 @@ export '../SingleChildRenderObjectWidget/RepaintBoundary/node1_base.dart';
|
||||
export '../SingleChildRenderObjectWidget/RepaintBoundary/node2_save.dart';
|
||||
|
||||
export '../SingleChildRenderObjectWidget/ConstrainedBox/node1_base.dart';
|
||||
export '../SingleChildRenderObjectWidget/PhysicalModel/node1_base.dart';
|
||||
export '../SingleChildRenderObjectWidget/FractionalTranslation/node1_base.dart';
|
||||
export '../SingleChildRenderObjectWidget/ColorFiltered/node1_base.dart';
|
||||
export '../SingleChildRenderObjectWidget/Baseline/node1_base.dart';
|
||||
|
||||
@@ -143,3 +143,5 @@ export '../StatefulWidget/EditableText/node1_base.dart';
|
||||
export '../StatefulWidget/CupertinoSlidingSegmentedControl/node1_base.dart';
|
||||
export '../StatefulWidget/WidgetsApp/node1_base.dart' hide HomePage;
|
||||
export '../StatefulWidget/WidgetInspector/node1_base.dart' hide HomePage;
|
||||
export '../StatefulWidget/AnimatedTheme/node1_base.dart';
|
||||
export '../StatefulWidget/AnimatedPhysicalModel/node1_base.dart';
|
||||
|
||||
@@ -66,16 +66,26 @@ class WidgetsMap {
|
||||
case "PageStorage":
|
||||
return [
|
||||
PageStorageDemo(),
|
||||
]; case "NotificationListener":
|
||||
return [
|
||||
NotificationListenerDemo(),
|
||||
NotificationListenerUpdate()
|
||||
];
|
||||
case "NotificationListener":
|
||||
return [NotificationListenerDemo(), NotificationListenerUpdate()];
|
||||
|
||||
case "Scrollable":
|
||||
return [
|
||||
ScrollableDemo(),
|
||||
];
|
||||
case "PhysicalModel":
|
||||
return [
|
||||
PhysicalModelDemo(),
|
||||
];
|
||||
case "Directionality":
|
||||
return [
|
||||
DirectionalityDemo(),
|
||||
];
|
||||
case "AnimatedTheme":
|
||||
return [
|
||||
AnimatedThemeDemo(),
|
||||
];
|
||||
case "CupertinoSlidingSegmentedControl":
|
||||
return [
|
||||
CupertinoSlidingSegmentedControlDemo(),
|
||||
@@ -1113,6 +1123,10 @@ class WidgetsMap {
|
||||
return [
|
||||
CustomBackdropFilter(),
|
||||
];
|
||||
case "AnimatedPhysicalModel":
|
||||
return [
|
||||
AnimatedPhysicalModelDemo(),
|
||||
];
|
||||
case "CustomSingleChildLayout":
|
||||
return [
|
||||
CustomSingleChildLayoutDemo(),
|
||||
|
||||
@@ -118,13 +118,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
flutter_spinkit:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_spinkit
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.1.2+1"
|
||||
flutter_star:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -33,7 +33,7 @@ dependencies:
|
||||
intl: ^0.16.1
|
||||
path_provider: ^1.6.11
|
||||
connectivity: ^0.4.8+6 #网络状态
|
||||
flutter_spinkit: ^4.1.2+1 #loading
|
||||
# flutter_spinkit: ^4.1.2+1 #loading
|
||||
dio: ^3.0.9 #dio
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user