forked from lxm_flutter/FlutterUnit
📝 修改文档
This commit is contained in:
@@ -27,7 +27,7 @@ Tools • Dart 2.7.0
|
||||
|
||||
#### Flutter Unit 周边
|
||||
|
||||
- 🔥 [Flutter Unit 更新记录 ](http://blog.toly1994.com/FlutterUnit_update.html)
|
||||
- 🔥 [Flutter Unit 更新记录 ](http://king.toly1994.com/FlutterUnit_update.html)
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -9,7 +9,12 @@ import 'package:flutter_unit/views/items/collect_widget_list_item.dart';
|
||||
|
||||
import 'category_page.dart';
|
||||
|
||||
class CollectPage extends StatelessWidget {
|
||||
class CollectPage extends StatefulWidget {
|
||||
@override
|
||||
_CollectPageState createState() => _CollectPageState();
|
||||
}
|
||||
|
||||
class _CollectPageState extends State<CollectPage> with AutomaticKeepAliveClientMixin{
|
||||
final gridDelegate = const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 10,
|
||||
@@ -19,9 +24,10 @@ class CollectPage extends StatelessWidget {
|
||||
|
||||
final _tabs = ['收藏集录','默认收藏', ];
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print('-------CollectPage-------build-------');
|
||||
|
||||
var _topContext = context;
|
||||
return Scaffold(
|
||||
backgroundColor: BlocProvider.of<HomeBloc>(context).state.homeColor.withAlpha(11),
|
||||
@@ -43,9 +49,12 @@ class CollectPage extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
CategoryPage(),
|
||||
BlocBuilder<CollectBloc, CollectState>(
|
||||
builder: (_, state) => CustomScrollView(
|
||||
builder: (_, state) {
|
||||
// print('-------BlocBuilder-------build-------');
|
||||
return CustomScrollView(
|
||||
slivers: <Widget>[_buildContent(context, state)],
|
||||
)),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -136,4 +145,8 @@ class CollectPage extends StatelessWidget {
|
||||
BlocProvider.of<DetailBloc>(context).add(FetchWidgetDetail(model));
|
||||
Navigator.pushNamed(context, Router.widget_detail, arguments: model);
|
||||
}
|
||||
|
||||
@override
|
||||
// TODO: implement wantKeepAlive
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class HomePage extends StatefulWidget {
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin{
|
||||
ScrollController _ctrl;
|
||||
double _limitY = 35;
|
||||
double _height = kToolbarHeight * 2 - 20;
|
||||
@@ -31,6 +31,7 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print('-------HomePage-------build-------');
|
||||
var color = BlocProvider.of<HomeBloc>(context).state.homeColor;
|
||||
var showBg = BlocProvider.of<GlobalBloc>(context).state.showBackGround;
|
||||
return Scaffold(
|
||||
@@ -92,4 +93,8 @@ class _HomePageState extends State<HomePage> {
|
||||
BlocProvider.of<DetailBloc>(context).add(FetchWidgetDetail(model));
|
||||
Navigator.pushNamed(context, Router.widget_detail, arguments: model);
|
||||
}
|
||||
|
||||
@override
|
||||
// TODO: implement wantKeepAlive
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
|
||||
@@ -36,16 +36,14 @@ class _PlayBezier3PageState extends State<PlayBezier3Page> {
|
||||
_pos.add(Offset(-120, -40));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 200,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: CustomPaint(
|
||||
painter: BezierPainter(pos: _pos, selectPos: selectPos),
|
||||
),
|
||||
|
||||
return Container(
|
||||
height: 200,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: CustomPaint(
|
||||
painter: BezierPainter(pos: _pos, selectPos: selectPos),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -85,12 +83,12 @@ class BezierPainter extends CustomPainter {
|
||||
_drawGrid(canvas, size); //绘制格线
|
||||
_drawAxis(canvas, size); //绘制轴线
|
||||
|
||||
_mainPath.moveTo(pos[0].dx, pos[0].dy);
|
||||
_mainPath.cubicTo(pos[1].dx, pos[1].dy, pos[2].dx, pos[2].dy, pos[3].dx, pos[3].dy);
|
||||
canvas.drawPath(_mainPath, _mainPaint);
|
||||
_drawHelp(canvas);
|
||||
_drawSelectPos(canvas);
|
||||
|
||||
_mainPath.moveTo(pos[0].dx, pos[0].dy);
|
||||
_mainPath.cubicTo(
|
||||
pos[1].dx, pos[1].dy, pos[2].dx, pos[2].dy, pos[3].dx, pos[3].dy);
|
||||
canvas.drawPath(_mainPath, _mainPaint);
|
||||
_drawHelp(canvas);
|
||||
_drawSelectPos(canvas);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -170,4 +168,4 @@ class BezierPainter extends CustomPainter {
|
||||
..color = Colors.green
|
||||
..strokeWidth = 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user