reason

?

...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 // ignore_for_file: prefer_single_quotes 3 // ignore_for_file: prefer_single_quotes
4 4
5 // This file is automatically generated. DO NOT EDIT, all your changes would be lost. 5 // This file is automatically generated. DO NOT EDIT, all your changes would be lost.
6 -import 'package:one_poem/account/models/user_entity.dart'; 6 +import 'package:one_poem/models/user_entity.dart';
7 7
8 JsonConvert jsonConvert = JsonConvert(); 8 JsonConvert jsonConvert = JsonConvert();
9 9
......
1 -import 'package:one_poem/generated/json/base/json_convert_content.dart';
2 -import 'package:one_poem/goods/models/goods_sort_entity.dart';
3 -
4 -GoodsSortEntity $GoodsSortEntityFromJson(Map<String, dynamic> json) {
5 - final GoodsSortEntity goodsSortEntity = GoodsSortEntity();
6 - final String? id = jsonConvert.convert<String>(json['id']);
7 - if (id != null) {
8 - goodsSortEntity.id = id;
9 - }
10 - final String? name = jsonConvert.convert<String>(json['name']);
11 - if (name != null) {
12 - goodsSortEntity.name = name;
13 - }
14 - return goodsSortEntity;
15 -}
16 -
17 -Map<String, dynamic> $GoodsSortEntityToJson(GoodsSortEntity entity) {
18 - final Map<String, dynamic> data = <String, dynamic>{};
19 - data['id'] = entity.id;
20 - data['name'] = entity.name;
21 - return data;
22 -}
...\ No newline at end of file ...\ No newline at end of file
1 -import 'package:one_poem/generated/json/base/json_convert_content.dart';
2 -import 'package:one_poem/account/models/user_entity.dart';
3 -
4 -UserEntity $UserEntityFromJson(Map<String, dynamic> json) {
5 - final UserEntity userEntity = UserEntity();
6 - final int? id = jsonConvert.convert<int>(json['id']);
7 - if (id != null) {
8 - userEntity.id = id;
9 - }
10 - final String? name = jsonConvert.convert<String>(json['name']);
11 - if (name != null) {
12 - userEntity.name = name;
13 - }
14 - final String? avatar = jsonConvert.convert<String>(json['avatar']);
15 - if (avatar != null) {
16 - userEntity.avatar = avatar;
17 - }
18 - return userEntity;
19 -}
20 -
21 -Map<String, dynamic> $UserEntityToJson(UserEntity entity) {
22 - final Map<String, dynamic> data = <String, dynamic>{};
23 - data['id'] = entity.id;
24 - data['name'] = entity.name;
25 - data['avatar'] = entity.avatar;
26 - return data;
27 -}
...\ No newline at end of file ...\ No newline at end of file
1 +import 'dart:convert';
2 +import 'package:one_poem/generated/json/base/json_field.dart';
3 +import 'package:one_poem/generated/json/friend_entity.g.dart';
4 +
5 +@JsonSerializable()
6 +class FriendEntity {
7 +
8 + late List<FriendData> data;
9 +
10 + FriendEntity();
11 +
12 + factory FriendEntity.fromJson(Map<String, dynamic> json) => $FriendEntityFromJson(json);
13 +
14 + Map<String, dynamic> toJson() => $FriendEntityToJson(this);
15 +
16 + @override
17 + String toString() {
18 + return jsonEncode(this);
19 + }
20 +}
21 +
22 +@JsonSerializable()
23 +class FriendData {
24 +
25 + late String head;
26 + late String name;
27 + late String desc;
28 + late List<String> pics;
29 + late String time;
30 +
31 + FriendData();
32 +
33 + factory FriendData.fromJson(Map<String, dynamic> json) => $FriendDataFromJson(json);
34 +
35 + Map<String, dynamic> toJson() => $FriendDataToJson(this);
36 +
37 + @override
38 + String toString() {
39 + return jsonEncode(this);
40 + }
41 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "data" : [
3 + {
4 + "head" : "logo.jpg",
5 + "name" : "Sunnytu",
6 + "desc" : "早上好中国的朋友们。宝宝们今天也很早开始一天。我好困\uD83D\uDCA4今天也我会努力",
7 + "pics" : ["banner.jpg"],
8 + "time" : "刚刚"
9 + },
10 + {
11 + "head" : "wyf.jpg",
12 + "name" : "吴亦凡",
13 + "desc" : "作为歌手和音乐制作人,他才华出众; 作为演员和时尚领袖,他光芒闪耀。他有风格,有态度,更有魅力。今天,吴亦凡 @Mr_凡先生 成为首位兰蔻亚太区品牌代言人,为品牌注入更多奢华摩登的新活力,并呈现护肤、彩妆与香水的美丽精彩。不同\"\"响的幸福旅程即将开始!你,准备好了吗? \u200B\u200B\u200B\u200B",
14 + "pics" : ["wyf1.jpg" ,"wyf2.jpg" , "wyf3.jpg"],
15 + "time" : "3分钟前"
16 + },
17 + {
18 + "head" : "lh.jpg",
19 + "name" : "鹿晗",
20 + "desc" : "海淀素材库的密码终于想起来了[笑cry][笑cry][笑cry] \u200B\u200B\u200B\u200B\n",
21 + "pics" : ["lh1.jpg" ,"lh2.jpg" , "lh3.jpg" , "lh4.jpg"],
22 + "time" : "20分钟前"
23 + },
24 + {
25 + "head" : "cxk.jpg",
26 + "name" : "🏀蔡徐坤🏀",
27 + "desc" : "老哥们,看我篮球🏀打的好不好,赶紧点个赞👍",
28 + "pics" : ["cxk1.jpg" ,"cxk2.jpg" ],
29 + "time" : "1小时前"
30 + },
31 + {
32 + "head" : "zyx.jpg",
33 + "name" : "张艺兴",
34 + "desc" : "透过所有非凡成就,预见更为璀璨的未来。\n歌手、音乐制作人、演员张艺兴@努力努力再努力x 从未停下前进的脚步,从亚洲流行乐坛引领M-POP走向世界。\n《VMAN》九月电子刊带你走进封面人物张艺兴的世界,即“兴”而为,涌动新潮。\n《VMAN》官网独家专访",
35 + "pics" : ["zyx1.jpg" ,"zyx2.jpg" , "zyx3.jpg" , "zyx4.jpg","zyx5.jpg" ,"zyx6.jpg" , "zyx7.jpg" , "zyx8.jpg" , "zyx9.jpg"],
36 + "time" : "2小时前"
37 + },
38 + {
39 + "head" : "hsf.jpg",
40 + "name" : "黄诗扶",
41 + "desc" : "喝完大酒撑条船,说今生不靠岸。\n去天涯海角浪个遍,失意当尝鲜。\n神仙掐指算,此去少圆满。\n得来失,聚了散,千万莫求全。",
42 + "pics" : ["hsf1.jpg" ,"hsf2.jpg"],
43 + "time" : "3小时前"
44 + },
45 +
46 +
47 + {
48 + "head" : "logo.jpg",
49 + "name" : "Sunnytu",
50 + "desc" : "早上好中国的朋友们。宝宝们今天也很早开始一天。我好困\uD83D\uDCA4今天也我会努力",
51 + "pics" : ["banner.jpg"],
52 + "time" : "刚刚"
53 + },
54 + {
55 + "head" : "wyf.jpg",
56 + "name" : "吴亦凡",
57 + "desc" : "作为歌手和音乐制作人,他才华出众; 作为演员和时尚领袖,他光芒闪耀。他有风格,有态度,更有魅力。今天,吴亦凡 @Mr_凡先生 成为首位兰蔻亚太区品牌代言人,为品牌注入更多奢华摩登的新活力,并呈现护肤、彩妆与香水的美丽精彩。不同\"\"响的幸福旅程即将开始!你,准备好了吗? \u200B\u200B\u200B\u200B",
58 + "pics" : ["wyf1.jpg" ,"wyf2.jpg" , "wyf3.jpg"],
59 + "time" : "3分钟前"
60 + },
61 + {
62 + "head" : "lh.jpg",
63 + "name" : "鹿晗",
64 + "desc" : "海淀素材库的密码终于想起来了[笑cry][笑cry][笑cry] \u200B\u200B\u200B\u200B\n",
65 + "pics" : ["lh1.jpg" ,"lh2.jpg" , "lh3.jpg" , "lh4.jpg"],
66 + "time" : "20分钟前"
67 + },
68 + {
69 + "head" : "cxk.jpg",
70 + "name" : "🏀蔡徐坤🏀",
71 + "desc" : "老哥们,看我篮球🏀打的好不好,赶紧点个赞👍",
72 + "pics" : ["cxk1.jpg" ,"cxk2.jpg" ],
73 + "time" : "1小时前"
74 + },
75 + {
76 + "head" : "zyx.jpg",
77 + "name" : "张艺兴",
78 + "desc" : "透过所有非凡成就,预见更为璀璨的未来。\n歌手、音乐制作人、演员张艺兴@努力努力再努力x 从未停下前进的脚步,从亚洲流行乐坛引领M-POP走向世界。\n《VMAN》九月电子刊带你走进封面人物张艺兴的世界,即“兴”而为,涌动新潮。\n《VMAN》官网独家专访",
79 + "pics" : ["zyx1.jpg" ,"zyx2.jpg" , "zyx3.jpg" , "zyx4.jpg","zyx5.jpg" ,"zyx6.jpg" , "zyx7.jpg" , "zyx8.jpg" , "zyx9.jpg"],
80 + "time" : "2小时前"
81 + },
82 + {
83 + "head" : "hsf.jpg",
84 + "name" : "黄诗扶",
85 + "desc" : "喝完大酒撑条船,说今生不靠岸。\n去天涯海角浪个遍,失意当尝鲜。\n神仙掐指算,此去少圆满。\n得来失,聚了散,千万莫求全。",
86 + "pics" : ["hsf1.jpg" ,"hsf2.jpg"],
87 + "time" : "3小时前"
88 + },
89 + {
90 + "head" : "logo.jpg",
91 + "name" : "Sunnytu",
92 + "desc" : "早上好中国的朋友们。宝宝们今天也很早开始一天。我好困\uD83D\uDCA4今天也我会努力",
93 + "pics" : ["banner.jpg"],
94 + "time" : "刚刚"
95 + },
96 + {
97 + "head" : "wyf.jpg",
98 + "name" : "吴亦凡",
99 + "desc" : "作为歌手和音乐制作人,他才华出众; 作为演员和时尚领袖,他光芒闪耀。他有风格,有态度,更有魅力。今天,吴亦凡 @Mr_凡先生 成为首位兰蔻亚太区品牌代言人,为品牌注入更多奢华摩登的新活力,并呈现护肤、彩妆与香水的美丽精彩。不同\"\"响的幸福旅程即将开始!你,准备好了吗? \u200B\u200B\u200B\u200B",
100 + "pics" : ["wyf1.jpg" ,"wyf2.jpg" , "wyf3.jpg"],
101 + "time" : "3分钟前"
102 + },
103 + {
104 + "head" : "lh.jpg",
105 + "name" : "鹿晗",
106 + "desc" : "海淀素材库的密码终于想起来了[笑cry][笑cry][笑cry] \u200B\u200B\u200B\u200B\n",
107 + "pics" : ["lh1.jpg" ,"lh2.jpg" , "lh3.jpg" , "lh4.jpg"],
108 + "time" : "20分钟前"
109 + },
110 + {
111 + "head" : "cxk.jpg",
112 + "name" : "🏀蔡徐坤🏀",
113 + "desc" : "老哥们,看我篮球🏀打的好不好,赶紧点个赞👍",
114 + "pics" : ["cxk1.jpg" ,"cxk2.jpg" ],
115 + "time" : "1小时前"
116 + },
117 + {
118 + "head" : "zyx.jpg",
119 + "name" : "张艺兴",
120 + "desc" : "透过所有非凡成就,预见更为璀璨的未来。\n歌手、音乐制作人、演员张艺兴@努力努力再努力x 从未停下前进的脚步,从亚洲流行乐坛引领M-POP走向世界。\n《VMAN》九月电子刊带你走进封面人物张艺兴的世界,即“兴”而为,涌动新潮。\n《VMAN》官网独家专访",
121 + "pics" : ["zyx1.jpg" ,"zyx2.jpg" , "zyx3.jpg" , "zyx4.jpg","zyx5.jpg" ,"zyx6.jpg" , "zyx7.jpg" , "zyx8.jpg" , "zyx9.jpg"],
122 + "time" : "2小时前"
123 + },
124 + {
125 + "head" : "hsf.jpg",
126 + "name" : "黄诗扶",
127 + "desc" : "喝完大酒撑条船,说今生不靠岸。\n去天涯海角浪个遍,失意当尝鲜。\n神仙掐指算,此去少圆满。\n得来失,聚了散,千万莫求全。",
128 + "pics" : ["hsf1.jpg" ,"hsf2.jpg"],
129 + "time" : "3小时前"
130 + },
131 + {
132 + "head" : "logo.jpg",
133 + "name" : "Sunnytu",
134 + "desc" : "早上好中国的朋友们。宝宝们今天也很早开始一天。我好困\uD83D\uDCA4今天也我会努力",
135 + "pics" : ["banner.jpg"],
136 + "time" : "刚刚"
137 + },
138 + {
139 + "head" : "wyf.jpg",
140 + "name" : "吴亦凡",
141 + "desc" : "作为歌手和音乐制作人,他才华出众; 作为演员和时尚领袖,他光芒闪耀。他有风格,有态度,更有魅力。今天,吴亦凡 @Mr_凡先生 成为首位兰蔻亚太区品牌代言人,为品牌注入更多奢华摩登的新活力,并呈现护肤、彩妆与香水的美丽精彩。不同\"\"响的幸福旅程即将开始!你,准备好了吗? \u200B\u200B\u200B\u200B",
142 + "pics" : ["wyf1.jpg" ,"wyf2.jpg" , "wyf3.jpg"],
143 + "time" : "3分钟前"
144 + },
145 + {
146 + "head" : "lh.jpg",
147 + "name" : "鹿晗",
148 + "desc" : "海淀素材库的密码终于想起来了[笑cry][笑cry][笑cry] \u200B\u200B\u200B\u200B\n",
149 + "pics" : ["lh1.jpg" ,"lh2.jpg" , "lh3.jpg" , "lh4.jpg"],
150 + "time" : "20分钟前"
151 + },
152 + {
153 + "head" : "cxk.jpg",
154 + "name" : "🏀蔡徐坤🏀",
155 + "desc" : "老哥们,看我篮球🏀打的好不好,赶紧点个赞👍",
156 + "pics" : ["cxk1.jpg" ,"cxk2.jpg" ],
157 + "time" : "1小时前"
158 + },
159 + {
160 + "head" : "zyx.jpg",
161 + "name" : "张艺兴",
162 + "desc" : "透过所有非凡成就,预见更为璀璨的未来。\n歌手、音乐制作人、演员张艺兴@努力努力再努力x 从未停下前进的脚步,从亚洲流行乐坛引领M-POP走向世界。\n《VMAN》九月电子刊带你走进封面人物张艺兴的世界,即“兴”而为,涌动新潮。\n《VMAN》官网独家专访",
163 + "pics" : ["zyx1.jpg" ,"zyx2.jpg" , "zyx3.jpg" , "zyx4.jpg","zyx5.jpg" ,"zyx6.jpg" , "zyx7.jpg" , "zyx8.jpg" , "zyx9.jpg"],
164 + "time" : "2小时前"
165 + },
166 + {
167 + "head" : "hsf.jpg",
168 + "name" : "黄诗扶",
169 + "desc" : "喝完大酒撑条船,说今生不靠岸。\n去天涯海角浪个遍,失意当尝鲜。\n神仙掐指算,此去少圆满。\n得来失,聚了散,千万莫求全。",
170 + "pics" : ["hsf1.jpg" ,"hsf2.jpg"],
171 + "time" : "3小时前"
172 + }
173 +
174 + ]
175 +}
...\ No newline at end of file ...\ No newline at end of file
1 1
2 -import 'package:one_poem/account/models/user_entity.dart'; 2 +import 'package:one_poem/models/user_entity.dart';
3 import 'package:one_poem/mvp/mvps.dart'; 3 import 'package:one_poem/mvp/mvps.dart';
4 4
5 abstract class ShopIMvpView implements IMvpView { 5 abstract class ShopIMvpView implements IMvpView {
......
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:one_poem/account/account_router.dart'; 2 import 'package:one_poem/account/account_router.dart';
3 -import 'package:one_poem/account/models/user_entity.dart'; 3 +import 'package:one_poem/models/user_entity.dart';
4 import 'package:one_poem/mvp/base_page.dart'; 4 import 'package:one_poem/mvp/base_page.dart';
5 import 'package:one_poem/res/resources.dart'; 5 import 'package:one_poem/res/resources.dart';
6 import 'package:one_poem/routers/fluro_navigator.dart'; 6 import 'package:one_poem/routers/fluro_navigator.dart';
......
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 -import 'package:one_poem/account/models/user_entity.dart'; 2 +import 'package:one_poem/models/user_entity.dart';
3 import 'package:one_poem/mvp/base_page_presenter.dart'; 3 import 'package:one_poem/mvp/base_page_presenter.dart';
4 import 'package:one_poem/net/dio_utils.dart'; 4 import 'package:one_poem/net/dio_utils.dart';
5 import 'package:one_poem/net/http_api.dart'; 5 import 'package:one_poem/net/http_api.dart';
......
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 -import 'package:one_poem/account/models/user_entity.dart'; 2 +import 'package:one_poem/models/user_entity.dart';
3 3
4 class UserProvider extends ChangeNotifier { 4 class UserProvider extends ChangeNotifier {
5 5
......
1 -class TimelineItemEntity {
2 -
3 - TimelineItemEntity({required this.icon, required this.title, required this.type});
4 -
5 - TimelineItemEntity.fromJson(Map<String, dynamic> json) {
6 - icon = json['icon'] as String;
7 - title = json['title'] as String;
8 - type = json['type'] as int;
9 - }
10 -
11 - late String icon;
12 - late String title;
13 - late int type;
14 -
15 - Map<String, dynamic> toJson() {
16 - final Map<String, dynamic> data = <String, dynamic>{};
17 - data['icon'] = icon;
18 - data['title'] = title;
19 - data['type'] = type;
20 - return data;
21 - }
22 -}
1 -import 'package:flutter/material.dart';
2 -import 'package:one_poem/res/constant.dart';
3 -import 'package:one_poem/timeline/models/timeline_item_entity.dart';
4 -import 'package:one_poem/timeline/provider/timeline_page_provider.dart';
5 -import 'package:one_poem/timeline/widgets/timeline_delete_bottom_sheet.dart';
6 -import 'package:one_poem/timeline/widgets/timeline_item.dart';
7 -import 'package:one_poem/util/toast_utils.dart';
8 -import 'package:one_poem/widgets/my_refresh_list.dart';
9 -import 'package:one_poem/widgets/state_layout.dart';
10 -import 'package:provider/provider.dart';
11 -
12 -class TimelineListPage extends StatefulWidget {
13 - const TimelineListPage({Key? key, required this.index}) : super(key: key);
14 -
15 - final int index;
16 -
17 - @override
18 - _TimelineListPageState createState() => _TimelineListPageState();
19 -}
20 -
21 -class _TimelineListPageState extends State<TimelineListPage>
22 - with
23 - AutomaticKeepAliveClientMixin<TimelineListPage>,
24 - SingleTickerProviderStateMixin {
25 - int _selectIndex = -1;
26 - late Animation<double> _animation;
27 - late AnimationController _controller;
28 - List<TimelineItemEntity> _list = [];
29 - AnimationStatus _animationStatus = AnimationStatus.dismissed;
30 -
31 - @override
32 - void initState() {
33 - super.initState();
34 - // 初始化动画控制
35 - _controller = AnimationController(
36 - duration: const Duration(milliseconds: 450), vsync: this);
37 - // 动画曲线
38 - final _curvedAnimation =
39 - CurvedAnimation(parent: _controller, curve: Curves.easeOutSine);
40 - _animation = Tween(begin: 0.0, end: 1.1).animate(_curvedAnimation)
41 - ..addStatusListener((status) {
42 - _animationStatus = status;
43 - });
44 -
45 - //Item数量
46 - _maxPage = widget.index == 0 ? 1 : (widget.index == 1 ? 2 : 3);
47 -
48 - _onRefresh();
49 - }
50 -
51 - @override
52 - void dispose() {
53 - _controller.dispose();
54 - super.dispose();
55 - }
56 -
57 - final List<String> _imgList = [
58 - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3130502839,1206722360&fm=26&gp=0.jpg',
59 - if (Constant.isDriverTest)
60 - 'https://img2.baidu.com/it/u=3994371075,170872697&fm=26&fmt=auto&gp=0.jpg'
61 - else
62 - 'https://xxx', // 可以使用一张无效链接,触发缺省、异常显示图片
63 - 'https://img0.baidu.com/it/u=4049693009,2577412121&fm=224&fmt=auto&gp=0.jpg',
64 - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3659255919,3211745976&fm=26&gp=0.jpg',
65 - 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2085939314,235211629&fm=26&gp=0.jpg',
66 - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3659255919,3211745976&fm=26&gp=0.jpg',
67 - 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2085939314,235211629&fm=26&gp=0.jpg',
68 - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3659255919,3211745976&fm=26&gp=0.jpg',
69 - 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2085939314,235211629&fm=26&gp=0.jpg',
70 - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3659255919,3211745976&fm=26&gp=0.jpg',
71 - 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2085939314,235211629&fm=26&gp=0.jpg',
72 - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3659255919,3211745976&fm=26&gp=0.jpg',
73 - 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2085939314,235211629&fm=26&gp=0.jpg',
74 - ];
75 -
76 - Future _onRefresh() async {
77 - await Future.delayed(const Duration(seconds: 2), () {
78 - setState(() {
79 - _page = 1;
80 - _list = List.generate(
81 - widget.index == 0 ? 3 : 10,
82 - (i) => TimelineItemEntity(
83 - icon: _imgList[i % 6], title: '八月十五中秋月饼礼盒', type: i % 3));
84 - });
85 - _setTimelineCount(_list.length);
86 - });
87 - }
88 -
89 - Future _loadMore() async {
90 - await Future.delayed(const Duration(seconds: 2), () {
91 - setState(() {
92 - _list.addAll(List.generate(
93 - 10,
94 - (i) => TimelineItemEntity(
95 - icon: _imgList[i % 6], title: '八月十五中秋月饼礼盒', type: i % 3)));
96 - _page++;
97 - });
98 - _setTimelineCount(_list.length);
99 - });
100 - }
101 -
102 - void _setTimelineCount(int count) {
103 - /// 与上方等价,provider 4.1.0添加的拓展方法
104 - context.read<TimelinePageProvider>().setTimelineCount(count);
105 - }
106 -
107 - int _page = 1;
108 - late int _maxPage;
109 - StateType _stateType = StateType.loading;
110 -
111 - @override
112 - Widget build(BuildContext context) {
113 - super.build(context);
114 - return DeerListView(
115 - itemCount: _list.length,
116 - stateType: _stateType,
117 - onRefresh: _onRefresh,
118 - loadMore: _loadMore,
119 - hasMore: _page < _maxPage,
120 - itemBuilder: (_, index) {
121 - final String heroTag = 'goodsImg${widget.index}-$index';
122 - return TimelineItem(
123 - index: index,
124 - heroTag: heroTag,
125 - selectIndex: _selectIndex,
126 - item: _list[index],
127 - animation: _animation,
128 - onTapMenu: () {
129 - /// 点击其他item时,重置状态
130 - if (_selectIndex != index) {
131 - _animationStatus = AnimationStatus.dismissed;
132 - }
133 -
134 - /// 避免动画中重复执行
135 - if (_animationStatus == AnimationStatus.dismissed) {
136 - // 开始执行动画
137 - _controller.forward(from: 0.0);
138 - }
139 - setState(() {
140 - _selectIndex = index;
141 - });
142 - },
143 - onTapMenuClose: () {
144 - if (_animationStatus == AnimationStatus.completed) {
145 - _controller.reverse(from: 1.1);
146 - }
147 - _selectIndex = -1;
148 - },
149 - onTapEdit: () {
150 - setState(() {
151 - _selectIndex = -1;
152 - });
153 - },
154 - onTapOperation: () {
155 - Toast.show('下架');
156 - },
157 - onTapDelete: () {
158 - _controller.reverse(from: 1.1);
159 - _selectIndex = -1;
160 - _showDeleteBottomSheet(index);
161 - },
162 - );
163 - });
164 - }
165 -
166 - @override
167 - bool get wantKeepAlive => true;
168 -
169 - void _showDeleteBottomSheet(int index) {
170 - showModalBottomSheet<void>(
171 - context: context,
172 - builder: (BuildContext context) {
173 - return TimelineDeleteBottomSheet(
174 - onTapDelete: () {
175 - setState(() {
176 - _list.removeAt(index);
177 - if (_list.isEmpty) {
178 - _stateType = StateType.goods;
179 - }
180 - });
181 - _setTimelineCount(_list.length);
182 - },
183 - );
184 - },
185 - );
186 - }
187 -}
1 -import 'package:flutter/material.dart'; 1 +import 'dart:convert';
2 -import 'package:one_poem/timeline/provider/timeline_page_provider.dart';
3 -import 'package:one_poem/widgets/my_app_bar.dart';
4 -import 'package:provider/provider.dart';
5 2
6 -import 'timeline_list_page.dart'; 3 +import 'package:flutter/cupertino.dart';
4 +import 'package:flutter/material.dart';
5 +import 'package:flutter/services.dart';
6 +import 'package:one_poem/timeline/widgets/friend_cell.dart';
7 +import 'package:one_poem/timeline/widgets/header_view.dart';
8 +import 'package:one_poem/models/friend_entity.dart';
7 9
8 class TimelinesPage extends StatefulWidget { 10 class TimelinesPage extends StatefulWidget {
9 const TimelinesPage({Key? key}) : super(key: key); 11 const TimelinesPage({Key? key}) : super(key: key);
...@@ -12,48 +14,74 @@ class TimelinesPage extends StatefulWidget { ...@@ -12,48 +14,74 @@ class TimelinesPage extends StatefulWidget {
12 _TimelinesPageState createState() => _TimelinesPageState(); 14 _TimelinesPageState createState() => _TimelinesPageState();
13 } 15 }
14 16
15 -class _TimelinesPageState extends State<TimelinesPage> 17 +class _TimelinesPageState extends State<TimelinesPage>{
16 - with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { 18 + final ScrollController _scrollController = ScrollController();
17 - final PageController _pageController = PageController(); 19 + double _opacity = 0;
18 20
19 - final GlobalKey _bodyKey = GlobalKey(); 21 + FriendEntity _friendmodelEntity = FriendEntity();
20 22
21 - TimelinePageProvider provider = TimelinePageProvider(); 23 + Future<String> loadAsset() async {
24 + return await rootBundle.loadString('lib/res/timeline/Data.json');
25 + }
22 26
23 @override 27 @override
24 void initState() { 28 void initState() {
25 super.initState(); 29 super.initState();
30 +
31 + loadAsset().then((value){
32 + var json = jsonDecode(value);
33 + _friendmodelEntity = FriendEntity.fromJson(json);
34 + setState(() {});
35 + });
36 +
37 +
38 + _scrollController.addListener(() {
39 +
40 + double alph = _scrollController.offset/200;
41 + if (alph < 0) {
42 + alph = 0;
43 + } else if (alph > 1) {
44 + alph = 1;
26 } 45 }
46 + setState(() {
47 + _opacity = alph;
48 + });
27 49
28 - @override 50 +
29 - void dispose() { 51 + });
30 - super.dispose(); 52 +
53 + }
54 +
55 + Widget _mainListViewBuidler(BuildContext context , int index) {
56 + return FriendCell(model: _friendmodelEntity.data![index],);
31 } 57 }
32 58
59 +
33 @override 60 @override
34 Widget build(BuildContext context) { 61 Widget build(BuildContext context) {
35 - super.build(context); 62 +
36 - return ChangeNotifierProvider<TimelinePageProvider>( 63 + return Scaffold(
37 - create: (_) => provider, 64 + body: Stack(
38 - child: Scaffold(
39 - appBar: const MyAppBar(),
40 - body: Column(
41 - key: _bodyKey,
42 - crossAxisAlignment: CrossAxisAlignment.start,
43 children: <Widget>[ 65 children: <Widget>[
44 - Expanded( 66 + ListView(
45 - child: PageView.builder( 67 + padding: const EdgeInsets.only(top: 0),
46 - key: const Key('pageView'), 68 + controller: _scrollController,
47 - controller: _pageController, 69 + children: <Widget>[
48 - itemBuilder: (_, int index) => 70 + const HeaderView(),
49 - TimelineListPage(index: index)), 71 + ListView.builder(padding: const EdgeInsets.only(top: 0), itemBuilder: _mainListViewBuidler , itemCount: _friendmodelEntity.data!.length, shrinkWrap: true, physics:NeverScrollableScrollPhysics(),)
50 - )
51 ], 72 ],
52 ), 73 ),
74 + Opacity(
75 + opacity: _opacity,
76 + child: const CupertinoNavigationBar(
77 + middle: Text("朋友圈"),
78 +
79 + ),
80 + )
81 +
82 + ],
83 +
53 ), 84 ),
54 ); 85 );
55 } 86 }
56 -
57 - @override
58 - bool get wantKeepAlive => true;
59 } 87 }
......
1 -import 'package:flutter/material.dart';
2 -
3 -class TimelinePageProvider extends ChangeNotifier {
4 -
5 - /// Tab的下标
6 - int _index = 0;
7 - int get index => _index;
8 - /// 商品数量
9 - final List<int> _timelineCountList = [0, 0, 0];
10 - List<int> get timelineCountList => _timelineCountList;
11 -
12 - /// 选中商品分类下标
13 - int _sortIndex = 0;
14 - int get sortIndex => _sortIndex;
15 -
16 - void setSortIndex(int sortIndex) {
17 - _sortIndex = sortIndex;
18 - notifyListeners();
19 - }
20 -
21 - void setIndex(int index) {
22 - _index = index;
23 - notifyListeners();
24 - }
25 -
26 - void setTimelineCount(int count) {
27 - _timelineCountList[index] = count;
28 - notifyListeners();
29 - }
30 -}
1 +import 'package:flutter/cupertino.dart';
2 +import 'package:flutter/material.dart';
3 +import 'package:one_poem/models/friend_entity.dart';
4 +
5 +class FriendCell extends StatefulWidget {
6 +
7 + FriendData model;
8 +
9 + FriendCell({Key? key, required this.model}) : super(key: key);
10 + @override
11 + State<StatefulWidget> createState() {
12 + // TODO: implement createState
13 + return FriendCellState();
14 + }
15 +
16 +}
17 +class FriendCellState extends State<FriendCell> {
18 +
19 + Widget? makePictureCount(List<String> pics) {
20 + if (pics.length == 1) {
21 + return Container(
22 + margin: EdgeInsets.fromLTRB(0, 10, 50, 10),
23 + child: Image.asset("lib/Resourse/" + pics[0] , fit: BoxFit.fill,),
24 + );
25 + } else if (pics.length == 4 || pics.length == 2) {
26 + return Container(
27 + margin: EdgeInsets.fromLTRB(0, 10, 0, 10),
28 + child: Wrap(
29 + spacing: 5,
30 + runSpacing: 5,
31 + alignment: WrapAlignment.start,
32 + children: pics.map((p) => Image.asset("lib/Resourse/" + p , width: 100 , height: 100 , fit: BoxFit.cover,)).toList()
33 + )
34 + );
35 + } else if (pics.length == 3 || pics.length > 4) {
36 + return Container(
37 + margin: EdgeInsets.fromLTRB(0, 10, 0, 10),
38 + child: Wrap(
39 + spacing: 5,
40 + runSpacing: 5,
41 + alignment: WrapAlignment.start,
42 + children: pics.map((p) => Image.asset("lib/Resourse/" + p , width: 70 , height: 70 , fit: BoxFit.cover,)).toList()
43 + )
44 + );
45 + }
46 + }
47 +
48 + double _width = 0;
49 + bool _isShow = false;
50 +
51 + @override
52 + Widget build(BuildContext context) {
53 + // TODO: implement build
54 + return Container(
55 + color: Color(0XFFFEFFFE),
56 + child: Column(
57 + children: <Widget>[
58 + Flex(
59 + direction: Axis.horizontal,
60 + mainAxisAlignment: MainAxisAlignment.start,
61 + crossAxisAlignment: CrossAxisAlignment.start,
62 + children: <Widget>[
63 +
64 + Container(
65 + width: 40,
66 + height: 40,
67 + margin: EdgeInsets.fromLTRB(15, 20, 15, 0),
68 + child: ClipRRect(
69 + child: Image.asset("lib/Resourse/" + widget.model.head , fit: BoxFit.fill,),
70 + borderRadius: BorderRadius.circular(5),
71 + ),
72 + ),
73 + Expanded(
74 + child: Container(
75 + margin: EdgeInsets.fromLTRB(0, 20, 70, 0),
76 + child: Column(
77 + mainAxisAlignment: MainAxisAlignment.start,
78 + crossAxisAlignment: CrossAxisAlignment.start,
79 + children: <Widget>[
80 + Text(widget.model.name , style: TextStyle(fontSize: 17 , color: Color(0XFF566B94) , fontWeight: FontWeight.w500),),
81 + SizedBox(height: 5,),
82 + Text(widget.model.desc , style: TextStyle(fontSize: 15),),
83 + makePictureCount(widget.model.pics)!,
84 +
85 + ],
86 + )
87 + )
88 + )
89 +
90 + ],
91 + ),
92 + Flex(
93 + direction: Axis.horizontal,
94 + mainAxisAlignment: MainAxisAlignment.center,
95 + children: <Widget>[
96 + Expanded(
97 + flex: 1,
98 + child: Container(
99 +
100 + margin: EdgeInsets.only(left: 70),
101 + child: Text(widget.model.time , style: TextStyle(fontSize: 12 , color: Color(0XFFB2B2B2)),),
102 + ),
103 + ),
104 + Expanded(
105 + flex: 2,
106 + child: Container(
107 + margin: EdgeInsets.only(right: 20),
108 + child: Row(
109 + mainAxisAlignment: MainAxisAlignment.end,
110 + children: <Widget>[
111 + AnimatedContainer(
112 + decoration: BoxDecoration(
113 + borderRadius: BorderRadius.circular(5),
114 + color: Color(0XFF4C5154)
115 + ),
116 + duration: Duration(milliseconds: 100),
117 + width: _width,
118 + height: 30,
119 + child: Flex(
120 + direction: Axis.horizontal,
121 + children: <Widget>[
122 + Expanded(
123 + flex : 1 ,
124 + child: Row(
125 + mainAxisAlignment: MainAxisAlignment.center,
126 + children: <Widget>[
127 + Icon(Icons.favorite_border , color: Colors.white, size: 15,),
128 + SizedBox(width: 5,),
129 + InkWell(
130 + onTap: (){
131 + setState(() {
132 + _starCount ++ ;
133 + isShow();
134 + });
135 + },
136 + child: Text("赞" ,style: TextStyle(color: Colors.white , fontSize: 12),)
137 + )
138 +
139 + ],
140 + )
141 + ),
142 + Expanded(
143 + flex: 1,
144 + child: Row(
145 + mainAxisAlignment: MainAxisAlignment.center,
146 + children: <Widget>[
147 + Icon(Icons.sms , color: Colors.white, size: 15,),
148 + SizedBox(width: 5,),
149 + InkWell(
150 + onTap: () {
151 + setState(() {
152 + _talkCount ++ ;
153 + isShow();
154 + });
155 + },
156 + child: Text("评论" ,style: TextStyle(color: Colors.white , fontSize: 12),)
157 + )
158 +
159 + ],
160 + )
161 + )
162 + ],
163 + )
164 + ),
165 + SizedBox(width: 10,),
166 + InkWell(
167 + onTap: (){
168 + isShow();
169 + },
170 + child: Image.asset("lib/Resourse/button.png" , width: 22, height: 18,)
171 + ),
172 + ],
173 + ),
174 + )
175 +
176 +
177 +
178 + )
179 + ],
180 + ),
181 + Offstage(
182 + offstage: _starCount == 0 ? true : false,
183 + child: Container(
184 + constraints: BoxConstraints(
185 + minWidth: double.infinity
186 + ),
187 + margin: EdgeInsets.fromLTRB(70, 10, 15, 0),
188 + padding: EdgeInsets.all(5),
189 + color: Color(0XFFF3F3F5),
190 + child: Wrap(
191 + alignment: WrapAlignment.start,
192 + runSpacing: 5,
193 + spacing: 5,
194 + children:likeView(_starCount)
195 + ),
196 + ),
197 + ),
198 + Offstage(
199 + offstage: _talkCount == 0 ? true : false,
200 + child: Container(
201 + constraints: BoxConstraints(
202 + minWidth: double.infinity
203 + ),
204 + margin: EdgeInsets.fromLTRB(70, 0, 15, 0),
205 + padding: EdgeInsets.all(5),
206 + color: Color(0XFFF3F3F5),
207 + child: Wrap(
208 + alignment: WrapAlignment.start,
209 + runSpacing: 5,
210 + spacing: 5,
211 + children:talkView(_talkCount)
212 + ),
213 + ),
214 + ),
215 + SizedBox(height: 10,),
216 + Container(height: 0.5, width: double.infinity, color: Colors.black26,)
217 + ],
218 + )
219 +
220 +
221 +
222 + );
223 + }
224 +
225 + void isShow() {
226 + _isShow = !_isShow;
227 + setState(() {
228 + _width = _isShow ? 120 : 0;
229 + });
230 + }
231 +
232 + var _starCount = 0;
233 + var _talkCount = 0;
234 +
235 + List<Widget> likeView(int count) {
236 +
237 + List<Widget> result = [];
238 + for (int i =0 ; i< count ; i ++) {
239 + result.add(Container(
240 + width: 70,
241 + child: Row(
242 + children: <Widget>[
243 + Icon(Icons.favorite_border , size: 13, color: Color(0XFF566B94),),
244 + SizedBox(width: 5,),
245 + Text("sunnytu" ,style: TextStyle(color: Color(0XFF566B94) , fontSize: 15 , fontWeight: FontWeight.w500),)
246 + ],
247 + ),
248 + ));
249 + }
250 +
251 + return result;
252 + }
253 +
254 + List<Widget> talkView(int count) {
255 +
256 + List<Widget> result = [];
257 + for (int i =0 ; i< count ; i ++) {
258 + result.add(Container(
259 + child: Row(
260 + children: <Widget>[
261 +
262 + Expanded(
263 + child: Text.rich(
264 + TextSpan(
265 + children: [
266 + TextSpan(
267 + text: "sunnytu:",
268 + style: TextStyle(fontSize: 15 ,fontWeight: FontWeight.w500 , color: Color(0XFF566B94))
269 + ),
270 + TextSpan(
271 + text: "66666",
272 + style: TextStyle(fontSize: 14),
273 + )
274 + ]
275 + ),
276 + textAlign: TextAlign.start,
277 + )
278 + ),
279 +
280 +
281 + ],
282 + ),
283 + ));
284 + }
285 +
286 + return result;
287 + }
288 +
289 +}
...\ No newline at end of file ...\ No newline at end of file
1 +import 'package:flutter/cupertino.dart';
2 +import 'package:flutter/material.dart';
3 +
4 +class HeaderView extends StatelessWidget {
5 + const HeaderView({Key? key}) : super(key: key);
6 +
7 + @override
8 + Widget build(BuildContext context) {
9 + // TODO: implement build
10 + return Container(
11 + height: 320,
12 + color: const Color(0XFFFEFFFE),
13 + child: Stack(
14 + children: <Widget>[
15 + Positioned(
16 + left: 0,
17 + right: 0,
18 + top: 0,
19 + bottom: 40,
20 +
21 + child: Image.asset("lib/Resourse/banner.jpg" , fit: BoxFit.fill,)
22 + ),
23 + Positioned(
24 + right: 15,
25 + bottom: 20,
26 + child: SizedBox(
27 + width: 60,
28 + height: 60,
29 + child: ClipRRect(borderRadius:BorderRadius.circular(8) , child: Image.asset("lib/Resourse/logo.jpg" , fit: BoxFit.cover,))
30 + ),
31 + ),
32 + const Positioned(
33 + right: 100,
34 + bottom: 50,
35 + child: Text("sunnytu" , style: TextStyle(fontSize: 20 , fontWeight: FontWeight.w600 , color: Colors.white , shadows:[
36 + Shadow(color: Colors.black, offset: Offset(1, 1))
37 + ] ),),
38 + )
39 +
40 + ],
41 + ),
42 + );
43 + }
44 +
45 +}
...\ No newline at end of file ...\ No newline at end of file
1 -import 'dart:math';
2 -
3 -import 'package:flutter/material.dart';
4 -
5 -//https://github.com/alibaba/flutter-go/blob/master/lib/views/fourth_page/page_reveal.dart
6 -class MenuReveal extends StatelessWidget {
7 -
8 - const MenuReveal({
9 - Key? key,
10 - required this.revealPercent,
11 - required this.child
12 - }): super(key: key);
13 -
14 - final double revealPercent;
15 - final Widget child;
16 -
17 - @override
18 - Widget build(BuildContext context) {
19 - return ClipOval(
20 - clipper: CircleRevealClipper(revealPercent),
21 - child: child,
22 - );
23 - }
24 -}
25 -
26 -class CircleRevealClipper extends CustomClipper<Rect> {
27 -
28 - CircleRevealClipper(this.revealPercent);
29 -
30 - final double revealPercent;
31 -
32 - @override
33 - Rect getClip(Size size) {
34 -
35 - // 右上角的点击点为圆心
36 - final Offset epicenter = Offset(size.width - 25.0, 25.0);
37 -
38 - final double theta = atan(epicenter.dy / epicenter.dx);
39 - final double distanceToCorner = (epicenter.dy) / sin(theta);
40 -
41 - final double radius = distanceToCorner * revealPercent;
42 - final double diameter = 2 * radius;
43 -
44 - return Rect.fromLTWH(epicenter.dx - radius, epicenter.dy - radius, diameter, diameter);
45 - }
46 -
47 - @override
48 - bool shouldReclip(CustomClipper<Rect> oldClipper) {
49 - return true;
50 - }
51 -
52 -}
1 -import 'package:flutter/material.dart';
2 -import 'package:one_poem/res/resources.dart';
3 -import 'package:one_poem/routers/fluro_navigator.dart';
4 -import 'package:one_poem/widgets/my_button.dart';
5 -
6 -/// design/4商品/index.html#artboard2
7 -class TimelineDeleteBottomSheet extends StatelessWidget {
8 -
9 - const TimelineDeleteBottomSheet({
10 - Key? key,
11 - required this.onTapDelete,
12 - }): super(key: key);
13 -
14 - final VoidCallback onTapDelete;
15 -
16 - @override
17 - Widget build(BuildContext context) {
18 - return Material(
19 - child: SafeArea(
20 - child: Column(
21 - mainAxisSize: MainAxisSize.min,
22 - children: <Widget>[
23 - const SizedBox(
24 - height: 52.0,
25 - child: Center(
26 - child: Text(
27 - '是否确认删除,防止错误操作',
28 - style: TextStyles.textSize16,
29 - ),
30 - ),
31 - ),
32 - Gaps.line,
33 - MyButton(
34 - minHeight: 54.0,
35 - textColor: Theme.of(context).errorColor,
36 - text: '确认删除',
37 - backgroundColor: Colors.transparent,
38 - onPressed: () {
39 - NavigatorUtils.goBack(context);
40 - onTapDelete();
41 - },
42 - ),
43 - Gaps.line,
44 - MyButton(
45 - minHeight: 54.0,
46 - textColor: Colours.text_gray,
47 - text: '取消',
48 - backgroundColor: Colors.transparent,
49 - onPressed: () {
50 - NavigatorUtils.goBack(context);
51 - },
52 - ),
53 - ],
54 - ),
55 - ),
56 - );
57 - }
58 -}
1 -import 'package:common_utils/common_utils.dart';
2 -import 'package:flutter/material.dart';
3 -import 'package:one_poem/res/resources.dart';
4 -import 'package:one_poem/timeline/models/timeline_item_entity.dart';
5 -import 'package:one_poem/util/device_utils.dart';
6 -import 'package:one_poem/util/other_utils.dart';
7 -import 'package:one_poem/util/theme_utils.dart';
8 -import 'package:one_poem/widgets/load_image.dart';
9 -import 'package:one_poem/widgets/my_button.dart';
10 -
11 -import 'menu_reveal.dart';
12 -
13 -/// design/4商品/index.html#artboard1
14 -class TimelineItem extends StatelessWidget {
15 -
16 - const TimelineItem({
17 - Key? key,
18 - required this.item,
19 - required this.index,
20 - required this.selectIndex,
21 - required this.onTapMenu,
22 - required this.onTapEdit,
23 - required this.onTapOperation,
24 - required this.onTapDelete,
25 - required this.onTapMenuClose,
26 - required this.animation,
27 - required this.heroTag,
28 - }): super(key: key);
29 -
30 - final TimelineItemEntity item;
31 - final int index;
32 - final int selectIndex;
33 - final VoidCallback onTapMenu;
34 - final VoidCallback onTapEdit;
35 - final VoidCallback onTapOperation;
36 - final VoidCallback onTapDelete;
37 - final VoidCallback onTapMenuClose;
38 - final Animation<double> animation;
39 - final String heroTag;
40 -
41 - @override
42 - Widget build(BuildContext context) {
43 - final Row child = Row(
44 - crossAxisAlignment: CrossAxisAlignment.start,
45 - children: <Widget>[
46 - ExcludeSemantics(
47 - child: Hero(
48 - tag: heroTag,
49 - child: LoadImage(item.icon, width: 72.0, height: 72.0),
50 - ),
51 - ),
52 - Gaps.hGap8,
53 - Expanded(
54 - child: Column(
55 - crossAxisAlignment: CrossAxisAlignment.start,
56 - children: <Widget>[
57 - Text(
58 - item.type % 3 != 0 ? '八月十五中秋月饼礼盒' : '八月十五中秋月饼礼盒八月十五中秋月饼礼盒',
59 - maxLines: 1,
60 - overflow: TextOverflow.ellipsis,
61 - ),
62 - Gaps.vGap4,
63 - Row(
64 - children: <Widget>[
65 - Visibility(
66 - // 默认为占位替换,类似于gone
67 - visible: item.type % 3 == 0,
68 - child: _GoodsItemTag(
69 - text: '立减',
70 - color: Theme.of(context).errorColor,
71 - ),
72 - ),
73 - Opacity(
74 - // 修改透明度实现隐藏,类似于invisible
75 - opacity: item.type % 2 != 0 ? 0.0 : 1.0,
76 - child: _GoodsItemTag(
77 - text: '金币抵扣',
78 - color: Theme.of(context).primaryColor,
79 - ),
80 - )
81 - ],
82 - ),
83 - Gaps.vGap16,
84 - Text(Utils.formatPrice('20.00', format: MoneyFormat.NORMAL))
85 - ],
86 - ),
87 - ),
88 - Column(
89 - crossAxisAlignment: CrossAxisAlignment.end,
90 - children: <Widget>[
91 - Semantics(
92 - /// container属性为true,防止上方ExcludeSemantics去除此处语义
93 - container: true,
94 - label: '商品操作菜单',
95 - child: GestureDetector(
96 - onTap: onTapMenu,
97 - child: Container(
98 - key: Key('goods_menu_item_$index'),
99 - width: 44.0,
100 - height: 44.0,
101 - color: Colors.transparent,
102 - padding: const EdgeInsets.only(left: 28.0, bottom: 28.0),
103 - child: const LoadAssetImage('goods/ellipsis'),
104 - ),
105 - ),
106 - ),
107 - Padding(
108 - padding: const EdgeInsets.only(top: 10.0),
109 - child: Text(
110 - '特产美味',
111 - style: Theme.of(context).textTheme.subtitle2,
112 - ),
113 - )
114 - ],
115 - )
116 - ],
117 - );
118 -
119 - return Stack(
120 - children: <Widget>[
121 - // item间的分隔线
122 - Padding(
123 - padding: const EdgeInsets.only(left: 16.0, top: 16.0),
124 - child: DecoratedBox(
125 - decoration: BoxDecoration(
126 - border: Border(
127 - bottom: Divider.createBorderSide(context, width: 0.8),
128 - ),
129 - ),
130 - child: Padding(
131 - padding: const EdgeInsets.only(right: 16.0, bottom: 16.0),
132 - child: child,
133 - ),
134 - ),
135 - ),
136 - if (selectIndex != index) Gaps.empty else _buildGoodsMenu(context),
137 - ],
138 - );
139 - }
140 -
141 - Widget _buildGoodsMenu(BuildContext context) {
142 - return Positioned.fill(
143 - child: AnimatedBuilder(
144 - animation: animation,
145 - child: _buildGoodsMenuContent(context),
146 - builder: (_, Widget? child) {
147 - return MenuReveal(
148 - revealPercent: animation.value,
149 - child: child!
150 - );
151 - }
152 - ),
153 - );
154 - }
155 -
156 - Widget _buildGoodsMenuContent(BuildContext context) {
157 - final bool isDark = context.isDark;
158 - final Color buttonColor = isDark ? Colours.dark_text : Colors.white;
159 -
160 - return InkWell(
161 - onTap: onTapMenuClose,
162 - child: Container(
163 - color: isDark ? const Color(0xB34D4D4D) : const Color(0x4D000000),
164 - child: Row(
165 - mainAxisAlignment: MainAxisAlignment.spaceEvenly,
166 - children: <Widget>[
167 - Gaps.hGap15,
168 - MyButton(
169 - key: Key('goods_edit_item_$index'),
170 - text: '编辑',
171 - fontSize: Dimens.font_sp16,
172 - radius: 24.0,
173 - minWidth: 56.0,
174 - minHeight: 56.0,
175 - padding: const EdgeInsets.symmetric(horizontal: 12.0),
176 - textColor: isDark ? Colours.dark_button_text : Colors.white,
177 - backgroundColor: isDark ? Colours.dark_app_main : Colours.app_main,
178 - onPressed: onTapEdit,
179 - ),
180 - MyButton(
181 - key: Key('goods_operation_item_$index'),
182 - text: '下架',
183 - fontSize: Dimens.font_sp16,
184 - radius: 24.0,
185 - minWidth: 56.0,
186 - minHeight: 56.0,
187 - padding: const EdgeInsets.symmetric(horizontal: 12.0),
188 - textColor: Colours.text,
189 - backgroundColor: buttonColor,
190 - onPressed: onTapOperation,
191 - ),
192 - MyButton(
193 - key: Key('goods_delete_item_$index'),
194 - text: '删除',
195 - fontSize: Dimens.font_sp16,
196 - radius: 24.0,
197 - minWidth: 56.0,
198 - minHeight: 56.0,
199 - padding: const EdgeInsets.symmetric(horizontal: 12.0),
200 - textColor: Colours.text,
201 - backgroundColor: buttonColor,
202 - onPressed: onTapDelete,
203 - ),
204 - Gaps.hGap15,
205 - ],
206 - ),
207 - ),
208 - );
209 - }
210 -}
211 -
212 -class _GoodsItemTag extends StatelessWidget {
213 -
214 - const _GoodsItemTag({
215 - Key? key,
216 - required this.color,
217 - required this.text,
218 - }): super(key: key);
219 -
220 - final Color? color;
221 - final String text;
222 -
223 - @override
224 - Widget build(BuildContext context) {
225 - return Container(
226 - padding: const EdgeInsets.symmetric(horizontal: 4.0),
227 - margin: const EdgeInsets.only(right: 4.0),
228 - decoration: BoxDecoration(
229 - color: color,
230 - borderRadius: BorderRadius.circular(2.0),
231 - ),
232 - height: 16.0,
233 - alignment: Alignment.center,
234 - child: Text(
235 - text,
236 - style: TextStyle(
237 - color: Colors.white,
238 - fontSize: Dimens.font_sp10,
239 - height: Device.isAndroid ? 1.1 : null,
240 - ),
241 - ),
242 - );
243 - }
244 -}
...@@ -43,6 +43,62 @@ packages: ...@@ -43,6 +43,62 @@ packages:
43 url: "https://pub.dartlang.org" 43 url: "https://pub.dartlang.org"
44 source: hosted 44 source: hosted
45 version: "2.1.0" 45 version: "2.1.0"
46 + build:
47 + dependency: transitive
48 + description:
49 + name: build
50 + url: "https://pub.dartlang.org"
51 + source: hosted
52 + version: "2.2.1"
53 + build_config:
54 + dependency: transitive
55 + description:
56 + name: build_config
57 + url: "https://pub.dartlang.org"
58 + source: hosted
59 + version: "1.0.0"
60 + build_daemon:
61 + dependency: transitive
62 + description:
63 + name: build_daemon
64 + url: "https://pub.dartlang.org"
65 + source: hosted
66 + version: "3.0.1"
67 + build_resolvers:
68 + dependency: transitive
69 + description:
70 + name: build_resolvers
71 + url: "https://pub.dartlang.org"
72 + source: hosted
73 + version: "2.0.6"
74 + build_runner:
75 + dependency: "direct dev"
76 + description:
77 + name: build_runner
78 + url: "https://pub.dartlang.org"
79 + source: hosted
80 + version: "2.1.7"
81 + build_runner_core:
82 + dependency: transitive
83 + description:
84 + name: build_runner_core
85 + url: "https://pub.dartlang.org"
86 + source: hosted
87 + version: "7.2.3"
88 + built_collection:
89 + dependency: transitive
90 + description:
91 + name: built_collection
92 + url: "https://pub.dartlang.org"
93 + source: hosted
94 + version: "5.1.1"
95 + built_value:
96 + dependency: transitive
97 + description:
98 + name: built_value
99 + url: "https://pub.dartlang.org"
100 + source: hosted
101 + version: "8.1.3"
46 cached_network_image: 102 cached_network_image:
47 dependency: "direct main" 103 dependency: "direct main"
48 description: 104 description:
...@@ -78,6 +134,13 @@ packages: ...@@ -78,6 +134,13 @@ packages:
78 url: "https://pub.dartlang.org" 134 url: "https://pub.dartlang.org"
79 source: hosted 135 source: hosted
80 version: "1.3.1" 136 version: "1.3.1"
137 + checked_yaml:
138 + dependency: transitive
139 + description:
140 + name: checked_yaml
141 + url: "https://pub.dartlang.org"
142 + source: hosted
143 + version: "2.0.1"
81 cli_util: 144 cli_util:
82 dependency: transitive 145 dependency: transitive
83 description: 146 description:
...@@ -92,6 +155,13 @@ packages: ...@@ -92,6 +155,13 @@ packages:
92 url: "https://pub.dartlang.org" 155 url: "https://pub.dartlang.org"
93 source: hosted 156 source: hosted
94 version: "1.1.0" 157 version: "1.1.0"
158 + code_builder:
159 + dependency: transitive
160 + description:
161 + name: code_builder
162 + url: "https://pub.dartlang.org"
163 + source: hosted
164 + version: "4.1.0"
95 collection: 165 collection:
96 dependency: transitive 166 dependency: transitive
97 description: 167 description:
...@@ -148,6 +218,13 @@ packages: ...@@ -148,6 +218,13 @@ packages:
148 url: "https://pub.dartlang.org" 218 url: "https://pub.dartlang.org"
149 source: hosted 219 source: hosted
150 version: "1.0.4" 220 version: "1.0.4"
221 + dart_style:
222 + dependency: transitive
223 + description:
224 + name: dart_style
225 + url: "https://pub.dartlang.org"
226 + source: hosted
227 + version: "2.2.1"
151 decimal: 228 decimal:
152 dependency: "direct overridden" 229 dependency: "direct overridden"
153 description: 230 description:
...@@ -225,6 +302,13 @@ packages: ...@@ -225,6 +302,13 @@ packages:
225 url: "https://pub.dartlang.org" 302 url: "https://pub.dartlang.org"
226 source: hosted 303 source: hosted
227 version: "6.1.2" 304 version: "6.1.2"
305 + fixnum:
306 + dependency: transitive
307 + description:
308 + name: fixnum
309 + url: "https://pub.dartlang.org"
310 + source: hosted
311 + version: "1.0.0"
228 fluro: 312 fluro:
229 dependency: "direct main" 313 dependency: "direct main"
230 description: 314 description:
...@@ -332,6 +416,13 @@ packages: ...@@ -332,6 +416,13 @@ packages:
332 url: "https://pub.dartlang.org" 416 url: "https://pub.dartlang.org"
333 source: hosted 417 source: hosted
334 version: "2.0.2" 418 version: "2.0.2"
419 + graphs:
420 + dependency: transitive
421 + description:
422 + name: graphs
423 + url: "https://pub.dartlang.org"
424 + source: hosted
425 + version: "2.1.0"
335 html: 426 html:
336 dependency: transitive 427 dependency: transitive
337 description: 428 description:
...@@ -407,13 +498,27 @@ packages: ...@@ -407,13 +498,27 @@ packages:
407 url: "https://pub.dartlang.org" 498 url: "https://pub.dartlang.org"
408 source: hosted 499 source: hosted
409 version: "0.6.3" 500 version: "0.6.3"
501 + json_annotation:
502 + dependency: "direct main"
503 + description:
504 + name: json_annotation
505 + url: "https://pub.dartlang.org"
506 + source: hosted
507 + version: "4.4.0"
508 + json_serializable:
509 + dependency: "direct dev"
510 + description:
511 + name: json_serializable
512 + url: "https://pub.dartlang.org"
513 + source: hosted
514 + version: "6.1.3"
410 keyboard_actions: 515 keyboard_actions:
411 dependency: "direct main" 516 dependency: "direct main"
412 description: 517 description:
413 name: keyboard_actions 518 name: keyboard_actions
414 url: "https://pub.dartlang.org" 519 url: "https://pub.dartlang.org"
415 source: hosted 520 source: hosted
416 - version: "3.4.5" 521 + version: "3.4.6"
417 lints: 522 lints:
418 dependency: transitive 523 dependency: transitive
419 description: 524 description:
...@@ -589,6 +694,13 @@ packages: ...@@ -589,6 +694,13 @@ packages:
589 url: "https://pub.dartlang.org" 694 url: "https://pub.dartlang.org"
590 source: hosted 695 source: hosted
591 version: "2.1.0" 696 version: "2.1.0"
697 + pubspec_parse:
698 + dependency: transitive
699 + description:
700 + name: pubspec_parse
701 + url: "https://pub.dartlang.org"
702 + source: hosted
703 + version: "1.2.0"
592 qr_code_scanner: 704 qr_code_scanner:
593 dependency: "direct main" 705 dependency: "direct main"
594 description: 706 description:
...@@ -720,6 +832,20 @@ packages: ...@@ -720,6 +832,20 @@ packages:
720 description: flutter 832 description: flutter
721 source: sdk 833 source: sdk
722 version: "0.0.99" 834 version: "0.0.99"
835 + source_gen:
836 + dependency: transitive
837 + description:
838 + name: source_gen
839 + url: "https://pub.dartlang.org"
840 + source: hosted
841 + version: "1.2.1"
842 + source_helper:
843 + dependency: transitive
844 + description:
845 + name: source_helper
846 + url: "https://pub.dartlang.org"
847 + source: hosted
848 + version: "1.3.1"
723 source_map_stack_trace: 849 source_map_stack_trace:
724 dependency: transitive 850 dependency: transitive
725 description: 851 description:
...@@ -790,6 +916,13 @@ packages: ...@@ -790,6 +916,13 @@ packages:
790 url: "https://pub.dartlang.org" 916 url: "https://pub.dartlang.org"
791 source: hosted 917 source: hosted
792 version: "2.1.0" 918 version: "2.1.0"
919 + stream_transform:
920 + dependency: transitive
921 + description:
922 + name: stream_transform
923 + url: "https://pub.dartlang.org"
924 + source: hosted
925 + version: "2.0.0"
793 string_scanner: 926 string_scanner:
794 dependency: transitive 927 dependency: transitive
795 description: 928 description:
...@@ -846,6 +979,13 @@ packages: ...@@ -846,6 +979,13 @@ packages:
846 url: "https://pub.dartlang.org" 979 url: "https://pub.dartlang.org"
847 source: hosted 980 source: hosted
848 version: "0.4.0" 981 version: "0.4.0"
982 + timing:
983 + dependency: transitive
984 + description:
985 + name: timing
986 + url: "https://pub.dartlang.org"
987 + source: hosted
988 + version: "1.0.0"
849 typed_data: 989 typed_data:
850 dependency: transitive 990 dependency: transitive
851 description: 991 description:
......
...@@ -81,7 +81,7 @@ dependencies: ...@@ -81,7 +81,7 @@ dependencies:
81 # Use with the CupertinoIcons class for iOS style icons. 81 # Use with the CupertinoIcons class for iOS style icons.
82 cupertino_icons: ^1.0.2 82 cupertino_icons: ^1.0.2
83 83
84 - # temp 84 + # tiktok
85 video_player: ^2.1.6 85 video_player: ^2.1.6
86 # map取值 86 # map取值
87 safemap: ^2.0.0-nullsafety.0 87 safemap: ^2.0.0-nullsafety.0
...@@ -90,6 +90,8 @@ dependencies: ...@@ -90,6 +90,8 @@ dependencies:
90 # 加载动画库 90 # 加载动画库
91 flutter_spinkit: ^5.0.0 91 flutter_spinkit: ^5.0.0
92 92
93 + json_annotation: ^4.4.0
94 +
93 dependency_overrides: 95 dependency_overrides:
94 decimal: 1.5.0 96 decimal: 1.5.0
95 97
...@@ -114,6 +116,9 @@ dev_dependencies: ...@@ -114,6 +116,9 @@ dev_dependencies:
114 # rules and activating additional ones. 116 # rules and activating additional ones.
115 flutter_lints: ^1.0.0 117 flutter_lints: ^1.0.0
116 118
119 + json_serializable: ^6.1.3
120 + build_runner: ^2.1.7
121 +
117 # For information on the generic Dart part of this file, see the 122 # For information on the generic Dart part of this file, see the
118 # following page: https://dart.dev/tools/pub/pubspec 123 # following page: https://dart.dev/tools/pub/pubspec
119 124
......