Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e5ae754
Update main.dart
toly1994328 Apr 20, 2020
e9b09cd
删除无用代码
toly1994328 Apr 20, 2020
6e63ec3
冲突
toly1994328 Apr 20, 2020
98bb07c
使用无边线NoBorderExpansionTile
toly1994328 Apr 20, 2020
068d99c
优化收藏集显示
toly1994328 Apr 20, 2020
10369c1
图标
toly1994328 Apr 20, 2020
a853c7d
🎉完成收藏夹创建和删除
toly1994328 Apr 21, 2020
b139de5
:tada: Initial commit.
toly1994328 Apr 21, 2020
97308f2
:pencil: Initial commit.
toly1994328 Apr 21, 2020
b41b128
:pencil: 添加注释说明
toly1994328 Apr 21, 2020
810f9af
🏷️ MIT 协议
toly1994328 Apr 21, 2020
7f7a566
:sparkles: 收藏夹完成
toly1994328 Apr 23, 2020
84f2458
:sparkles: 收藏夹修改完成
toly1994328 Apr 23, 2020
23d02c5
:pencil: 修改文档
toly1994328 Apr 24, 2020
8c070f0
:art: 优化展示组件代码的存在形式
toly1994328 Apr 25, 2020
b178162
:art: 优化展示组件代码的存在形式
toly1994328 Apr 26, 2020
ef21901
:art: 优化展示组件代码的存在形式,stateless重构完毕
toly1994328 Apr 27, 2020
36a65f4
:art: 优化结构,调整包位置
toly1994328 Apr 27, 2020
da87301
:ambulance: ios白屏问题fix
toly1994328 Apr 28, 2020
b4d1f78
:pencil: 添加运行环境
toly1994328 Apr 28, 2020
548199c
:sparkles: item样式切换支持优化
toly1994328 Apr 28, 2020
fc84531
:ambulance: hero组件异常
toly1994328 Apr 29, 2020
60eb0f0
:art: stateful组件重构完毕
toly1994328 Apr 29, 2020
b58de9d
:art: 当前组件结构重构完毕
toly1994328 Apr 30, 2020
c0ff2b5
:zap: 优化详情
toly1994328 May 3, 2020
6446160
:pencil: 临时提交
toly1994328 May 3, 2020
9a7b642
:pencil: 临时提交
toly1994328 May 3, 2020
69cff81
:pencil: 修改文档
toly1994328 May 4, 2020
88c2a06
:pencil: 修改文档
toly1994328 May 6, 2020
43ad645
:pencil: 修改文档
toly1994328 May 6, 2020
7d065f1
:zap: 使用Flutter1.17
toly1994328 May 7, 2020
6bbbfd6
:pencil: 修改文档
toly1994328 May 7, 2020
fcf85cc
:pencil: 修改文档
toly1994328 May 9, 2020
2cc2e1d
:bug: 修复详情页右侧滑和linkto的冲突。优化代码结构
toly1994328 May 10, 2020
7db01d8
:pencil: 修改文档
toly1994328 May 10, 2020
d93a82c
:pencil: 修改文档
toly1994328 May 10, 2020
8a9f97c
:pencil: 修改文档
toly1994328 May 10, 2020
cc71231
Update README.md
toly1994328 May 14, 2020
7e02d23
:ambulance: 侧栏菜单跳转异常
toly1994328 May 27, 2020
88c7855
:sparkles: 添加CustomSingleChildLayout组件
toly1994328 Jun 3, 2020
b55f618
:sparkles: 添加CustomMultiChildLayout、LayoutId组件
toly1994328 Jun 6, 2020
6bb6bbc
:pencil: 文档更新
toly1994328 Jun 11, 2020
46addef
:art: 优化代码
toly1994328 Jun 15, 2020
3cc2418
:sparkles: 添加NestedScrollView、SliverOverlapAbsorber、SliverOverlapInje…
toly1994328 Jun 16, 2020
5fe4ca9
:pencil: 文档更新
toly1994328 Jun 16, 2020
ee14c6e
:sparkles: 添加应用版本检查页
toly1994328 Jun 16, 2020
375a903
:pencil: 更新文档
toly1994328 Jun 16, 2020
3ee66b1
:pencil: 更新文档
toly1994328 Jun 16, 2020
eed1773
:pencil: 要点集录初测
toly1994328 Jun 19, 2020
f9d679d
:sparkles: 开启性能浮层、CupertinoSegmentedControl组件
toly1994328 Jun 30, 2020
1bc7014
:sparkles: 开启性能浮层、CupertinoSegmentedControl组件
toly1994328 Jun 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
优化收藏集显示
  • Loading branch information
toly1994328 committed Apr 20, 2020
commit 068d99cb9f6e1a10862cb0efb0db017081701a7f
3 changes: 0 additions & 3 deletions lib/blocs/collect/collect_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ class CollectBloc extends Bloc<CollectEvent, CollectState> {
if (event is ToggleCollectEvent) {
await repository.toggleCollect(event.id);
final widgets = await repository.loadCollectWidgets();

yield CollectState(widgets: widgets);
}
if( event is EventSetCollectData){
final widgets = await repository.loadCollectWidgets();
final collect = await repository.loadCollects();
print(collect);
yield CollectState(widgets: widgets);
}
}
Expand Down
4 changes: 3 additions & 1 deletion lib/components/permanent/circle_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
class CircleImage extends StatelessWidget {
CircleImage(
{Key key,
this.borderSize =3,
@required this.image,
this.size = 70,
this.shadowColor,
Expand All @@ -12,6 +13,7 @@ class CircleImage extends StatelessWidget {
final double size; //大小
final Color shadowColor; //阴影颜色
final Color roundColor; //边框颜色
final double borderSize;
@override
Widget build(BuildContext context) {
var headIcon = Container(
Expand All @@ -29,7 +31,7 @@ class CircleImage extends StatelessWidget {
],
),
child: Padding(
padding: EdgeInsets.all(3),
padding: EdgeInsets.all(borderSize),
child:
CircleAvatar(
backgroundImage: image,
Expand Down
1 change: 0 additions & 1 deletion lib/repositories/widget_db_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class WidgetDbRepository implements WidgetRepository {
Future<List<CollectModel>> loadCollects() async {
var data = await _collectDao.queryAll();
var collects = data.map((e) => CollectPo.fromJson(e)).toList();
print(collects);
return null;
}

Expand Down
116 changes: 96 additions & 20 deletions lib/views/pages/collect/default_collect_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_unit/app/router.dart';
Expand All @@ -7,6 +8,7 @@ import 'package:flutter_unit/blocs/collect/collect_state.dart';
import 'package:flutter_unit/blocs/detail/detail_bloc.dart';
import 'package:flutter_unit/blocs/detail/detail_event.dart';
import 'package:flutter_unit/blocs/widgets/home_bloc.dart';
import 'package:flutter_unit/components/permanent/circle_image.dart';
import 'package:flutter_unit/model/widget_model.dart';
import 'package:flutter_unit/views/items/collect_widget_list_item.dart';

Expand All @@ -18,29 +20,104 @@ class DefaultCollectPage extends StatelessWidget {
childAspectRatio: 1 / 0.5,
);

final _tabs = ['默认收藏', '收藏集录'];



@override
Widget build(BuildContext context) {
var _topContext = context;
return Scaffold(
appBar: AppBar(
backgroundColor: BlocProvider.of<HomeBloc>(context).state.homeColor,
title: Text('收藏集'),
actions: <Widget>[_buildAddActionBuilder(context)],
),
body: BlocBuilder<CollectBloc, CollectState>(builder: (_, state) {
return GridView.builder(
padding: EdgeInsets.all(10),
itemCount: state.widgets.length,
itemBuilder: (_, index) => Container(
child: GestureDetector(
onTap: () => _toDetailPage(context, state.widgets[index]),
child: CollectWidgetListItem(
data: state.widgets[index],
onDelectItemClick: (model) => _deleteCollect(context, model),
)),
backgroundColor:
BlocProvider.of<HomeBloc>(context).state.homeColor.withAlpha(11),
body: DefaultTabController(
length: _tabs.length, // This is the number of tabs.
child: NestedScrollView(
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
child: _buildAppBar(_topContext, innerBoxIsScrolled)),
];
},
body: TabBarView(
children: <Widget>[
BlocBuilder<CollectBloc, CollectState>(
builder: (_, state) => CustomScrollView(
slivers: <Widget>[_buildContent(context, state)],
)),
Container(
alignment: Alignment.center,
child: Text('开发中...'),
// color: Colors.purpleAccent,
)
],
),
),
gridDelegate: gridDelegate,
);
}),
));
}

Widget _buildAppBar(BuildContext context, bool index) {
return SliverAppBar(
leading: Container(
margin: EdgeInsets.all(10),
child: CircleImage(
image: AssetImage('assets/images/icon_head.png'),
borderSize: 1.5,
)),
backgroundColor: BlocProvider.of<HomeBloc>(context).state.homeColor,
actions: <Widget>[_buildAddActionBuilder(context)],
title: Text(
'收藏集 CollectUnit',
style: TextStyle(color: Colors.white, //标题
shadows: [
Shadow(color: Colors.blue, offset: Offset(1, 1), blurRadius: 2)
]),
),
pinned: true,
expandedHeight: 180.0,
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.parallax, //视差效果
background: Image.asset(
"assets/images/caver.jpeg",
fit: BoxFit.cover,
),
),
forceElevated: index,
bottom: TabBar(
indicatorColor: Colors.transparent,
labelColor: Colors.white,
labelStyle: TextStyle(fontSize: 16, shadows: [
Shadow(
color: Theme.of(context).primaryColor,
offset: Offset(1, 1),
blurRadius: 10)
]),
tabs: _tabs.map((String name) => Tab(text: name)).toList(),
),
);
}

Widget _buildContent(BuildContext context, CollectState state) {
return SliverPadding(
padding: EdgeInsets.only(
top: 180 - kTextTabBarHeight + 20, left: 10, right: 10, bottom: 40),
sliver: SliverGrid(
delegate: SliverChildBuilderDelegate(
(_, index) => Container(
child: GestureDetector(
onTap: () =>
_toDetailPage(context, state.widgets[index]),
child: CollectWidgetListItem(
data: state.widgets[index],
onDelectItemClick: (model) =>
_deleteCollect(context, model),
)),
),
childCount: state.widgets.length),
gridDelegate: gridDelegate),
);
}

Expand All @@ -51,7 +128,6 @@ class DefaultCollectPage extends StatelessWidget {
),
onPressed: () => Scaffold.of(context).openEndDrawer());


_deleteCollect(BuildContext context, WidgetModel model) =>
BlocProvider.of<CollectBloc>(context)
.add(ToggleCollectEvent(id: model.id));
Expand Down