Showing
5 changed files
with
323 additions
and
159 deletions
... | @@ -9,7 +9,6 @@ import 'package:one_poem/tiktok/widgets/tiktok_top_info.dart'; | ... | @@ -9,7 +9,6 @@ import 'package:one_poem/tiktok/widgets/tiktok_top_info.dart'; |
9 | import 'package:one_poem/tiktok/widgets/tiktok_video.dart'; | 9 | import 'package:one_poem/tiktok/widgets/tiktok_video.dart'; |
10 | import 'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart'; | 10 | import 'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart'; |
11 | import 'package:one_poem/tiktok/widgets/tiktok_video_poem.dart'; | 11 | import 'package:one_poem/tiktok/widgets/tiktok_video_poem.dart'; |
12 | -import 'package:one_poem/util/toast_utils.dart'; | ||
13 | import 'package:one_poem/widgets/bars/home_action_bar.dart'; | 12 | import 'package:one_poem/widgets/bars/home_action_bar.dart'; |
14 | import 'package:one_poem/widgets/my_app_bar.dart'; | 13 | import 'package:one_poem/widgets/my_app_bar.dart'; |
15 | import 'package:video_player/video_player.dart'; | 14 | import 'package:video_player/video_player.dart'; | ... | ... |
... | @@ -66,6 +66,7 @@ class TikTokVidePoem extends StatelessWidget { | ... | @@ -66,6 +66,7 @@ class TikTokVidePoem extends StatelessWidget { |
66 | fontSize: 20.px), | 66 | fontSize: 20.px), |
67 | ), | 67 | ), |
68 | Container( | 68 | Container( |
69 | + padding: EdgeInsets.only(right: 5.px), | ||
69 | alignment: Alignment.centerRight, | 70 | alignment: Alignment.centerRight, |
70 | width: double.infinity, | 71 | width: double.infinity, |
71 | child: Text( | 72 | child: Text( | ... | ... |
... | @@ -5,7 +5,8 @@ import 'package:flutter/material.dart'; | ... | @@ -5,7 +5,8 @@ import 'package:flutter/material.dart'; |
5 | import 'package:flutter/services.dart'; | 5 | import 'package:flutter/services.dart'; |
6 | import 'package:one_poem/timeline/models/friend_entity.dart'; | 6 | import 'package:one_poem/timeline/models/friend_entity.dart'; |
7 | import 'package:one_poem/timeline/widgets/friend_cell.dart'; | 7 | import 'package:one_poem/timeline/widgets/friend_cell.dart'; |
8 | -import 'package:one_poem/timeline/widgets/header_view.dart'; | 8 | +import 'package:one_poem/widgets/bars/timeline_menu_bar.dart'; |
9 | +import 'package:one_poem/widgets/my_app_bar.dart'; | ||
9 | 10 | ||
10 | class TimelinesPage extends StatefulWidget { | 11 | class TimelinesPage extends StatefulWidget { |
11 | const TimelinesPage({Key? key}) : super(key: key); | 12 | const TimelinesPage({Key? key}) : super(key: key); |
... | @@ -14,11 +15,11 @@ class TimelinesPage extends StatefulWidget { | ... | @@ -14,11 +15,11 @@ class TimelinesPage extends StatefulWidget { |
14 | _TimelinesPageState createState() => _TimelinesPageState(); | 15 | _TimelinesPageState createState() => _TimelinesPageState(); |
15 | } | 16 | } |
16 | 17 | ||
17 | -class _TimelinesPageState extends State<TimelinesPage>{ | 18 | +class _TimelinesPageState extends State<TimelinesPage> { |
18 | final ScrollController _scrollController = ScrollController(); | 19 | final ScrollController _scrollController = ScrollController(); |
19 | double _opacity = 0; | 20 | double _opacity = 0; |
20 | 21 | ||
21 | - FriendEntity _friendmodelEntity = FriendEntity(); | 22 | + FriendEntity _friendModelEntity = FriendEntity(); |
22 | 23 | ||
23 | Future<String> loadAsset() async { | 24 | Future<String> loadAsset() async { |
24 | return await rootBundle.loadString('assets/data/Data.json'); | 25 | return await rootBundle.loadString('assets/data/Data.json'); |
... | @@ -28,59 +29,51 @@ class _TimelinesPageState extends State<TimelinesPage>{ | ... | @@ -28,59 +29,51 @@ class _TimelinesPageState extends State<TimelinesPage>{ |
28 | void initState() { | 29 | void initState() { |
29 | super.initState(); | 30 | super.initState(); |
30 | 31 | ||
31 | - loadAsset().then((value){ | 32 | + loadAsset().then((value) { |
32 | var json = jsonDecode(value); | 33 | var json = jsonDecode(value); |
33 | - _friendmodelEntity = FriendEntity.fromJson(json); | 34 | + _friendModelEntity = FriendEntity.fromJson(json); |
34 | setState(() {}); | 35 | setState(() {}); |
35 | }); | 36 | }); |
36 | 37 | ||
37 | - | ||
38 | _scrollController.addListener(() { | 38 | _scrollController.addListener(() { |
39 | - | 39 | + double alpha = _scrollController.offset / 200; |
40 | - double alph = _scrollController.offset/200; | 40 | + if (alpha < 0) { |
41 | - if (alph < 0) { | 41 | + alpha = 0; |
42 | - alph = 0; | 42 | + } else if (alpha > 1) { |
43 | - } else if (alph > 1) { | 43 | + alpha = 1; |
44 | - alph = 1; | ||
45 | } | 44 | } |
46 | setState(() { | 45 | setState(() { |
47 | - _opacity = alph; | 46 | + _opacity = alpha; |
48 | }); | 47 | }); |
49 | - | ||
50 | - | ||
51 | }); | 48 | }); |
52 | - | ||
53 | } | 49 | } |
54 | 50 | ||
55 | - Widget _mainListViewBuidler(BuildContext context , int index) { | 51 | + Widget _mainListViewBuilder(BuildContext context, int index) { |
56 | - return FriendCell(model: _friendmodelEntity.data[index],); | 52 | + return FriendCell( |
53 | + model: _friendModelEntity.data[index], | ||
54 | + ); | ||
57 | } | 55 | } |
58 | 56 | ||
59 | - | ||
60 | @override | 57 | @override |
61 | Widget build(BuildContext context) { | 58 | Widget build(BuildContext context) { |
62 | - | ||
63 | return Scaffold( | 59 | return Scaffold( |
64 | - body: Stack( | 60 | + appBar: const MyAppBar( |
65 | - children: <Widget>[ | 61 | + isBack: false, |
66 | - ListView( | 62 | + isTransparent: true, |
63 | + homeMenuHeader: TimelineMenuHeader(), | ||
64 | + ), | ||
65 | + body: ListView( | ||
67 | padding: const EdgeInsets.only(top: 0), | 66 | padding: const EdgeInsets.only(top: 0), |
68 | controller: _scrollController, | 67 | controller: _scrollController, |
69 | children: <Widget>[ | 68 | children: <Widget>[ |
70 | - const HeaderView(), | 69 | + ListView.builder( |
71 | - ListView.builder(padding: const EdgeInsets.only(top: 0), itemBuilder: _mainListViewBuidler , itemCount: _friendmodelEntity.data.length, shrinkWrap: true, physics:NeverScrollableScrollPhysics(),) | 70 | + padding: const EdgeInsets.only(top: 0), |
72 | - ], | 71 | + itemBuilder: _mainListViewBuilder, |
73 | - ), | 72 | + itemCount: _friendModelEntity.data.length, |
74 | - Opacity( | 73 | + shrinkWrap: true, |
75 | - opacity: _opacity, | 74 | + physics: const NeverScrollableScrollPhysics(), |
76 | - child: const CupertinoNavigationBar( | ||
77 | - middle: Text("临境|附近|新鲜"), | ||
78 | - | ||
79 | - ), | ||
80 | ) | 75 | ) |
81 | - | ||
82 | ], | 76 | ], |
83 | - | ||
84 | ), | 77 | ), |
85 | ); | 78 | ); |
86 | } | 79 | } | ... | ... |
... | @@ -2,46 +2,59 @@ import 'package:flutter/cupertino.dart'; | ... | @@ -2,46 +2,59 @@ import 'package:flutter/cupertino.dart'; |
2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
3 | import 'package:one_poem/timeline/models/friend_entity.dart'; | 3 | import 'package:one_poem/timeline/models/friend_entity.dart'; |
4 | 4 | ||
5 | -class FriendCell extends StatefulWidget { | 5 | +import 'package:one_poem/extension/int_extension.dart'; |
6 | 6 | ||
7 | - FriendData model; | 7 | +class FriendCell extends StatefulWidget { |
8 | + final FriendData model; | ||
8 | 9 | ||
9 | - FriendCell({Key? key, required this.model}) : super(key: key); | 10 | + const FriendCell({Key? key, required this.model}) : super(key: key); |
10 | @override | 11 | @override |
11 | State<StatefulWidget> createState() { | 12 | State<StatefulWidget> createState() { |
12 | - // TODO: implement createState | ||
13 | return FriendCellState(); | 13 | return FriendCellState(); |
14 | } | 14 | } |
15 | - | ||
16 | } | 15 | } |
17 | -class FriendCellState extends State<FriendCell> { | ||
18 | 16 | ||
17 | +class FriendCellState extends State<FriendCell> { | ||
19 | Widget? makePictureCount(List<String> pics) { | 18 | Widget? makePictureCount(List<String> pics) { |
20 | if (pics.length == 1) { | 19 | if (pics.length == 1) { |
21 | return Container( | 20 | return Container( |
22 | - margin: EdgeInsets.fromLTRB(0, 10, 50, 10), | 21 | + margin: EdgeInsets.fromLTRB(0.px, 10.px, 50.px, 10.px), |
23 | - child: Image.asset("assets/data/friends/" + pics[0] , fit: BoxFit.fill,), | 22 | + child: Image.asset( |
23 | + "assets/data/friends/" + pics[0], | ||
24 | + fit: BoxFit.fill, | ||
25 | + ), | ||
24 | ); | 26 | ); |
25 | } else if (pics.length == 4 || pics.length == 2) { | 27 | } else if (pics.length == 4 || pics.length == 2) { |
26 | return Container( | 28 | return Container( |
27 | - margin: EdgeInsets.fromLTRB(0, 10, 0, 10), | 29 | + margin: EdgeInsets.fromLTRB(0.px, 10.px, 0.px, 10.px), |
28 | child: Wrap( | 30 | child: Wrap( |
29 | spacing: 5, | 31 | spacing: 5, |
30 | runSpacing: 5, | 32 | runSpacing: 5, |
31 | alignment: WrapAlignment.start, | 33 | alignment: WrapAlignment.start, |
32 | - children: pics.map((p) => Image.asset("assets/data/friends/" + p , width: 100 , height: 100 , fit: BoxFit.cover,)).toList() | 34 | + children: pics |
33 | - ) | 35 | + .map((p) => Image.asset( |
34 | - ); | 36 | + "assets/data/friends/" + p, |
37 | + width: 100.px, | ||
38 | + height: 100.px, | ||
39 | + fit: BoxFit.cover, | ||
40 | + )) | ||
41 | + .toList())); | ||
35 | } else if (pics.length == 3 || pics.length > 4) { | 42 | } else if (pics.length == 3 || pics.length > 4) { |
36 | return Container( | 43 | return Container( |
37 | - margin: EdgeInsets.fromLTRB(0, 10, 0, 10), | 44 | + margin: EdgeInsets.fromLTRB(0.px, 10.px, 0.px, 10.px), |
38 | child: Wrap( | 45 | child: Wrap( |
39 | spacing: 5, | 46 | spacing: 5, |
40 | runSpacing: 5, | 47 | runSpacing: 5, |
41 | alignment: WrapAlignment.start, | 48 | alignment: WrapAlignment.start, |
42 | - children: pics.map((p) => Image.asset("assets/data/friends/" + p , width: 70 , height: 70 , fit: BoxFit.cover,)).toList() | 49 | + children: pics |
43 | - ) | 50 | + .map((p) => Image.asset( |
44 | - ); | 51 | + "assets/data/friends/" + p, |
52 | + width: 70.px, | ||
53 | + height: 70.px, | ||
54 | + fit: BoxFit.cover, | ||
55 | + )) | ||
56 | + .toList(), | ||
57 | + )); | ||
45 | } | 58 | } |
46 | } | 59 | } |
47 | 60 | ||
... | @@ -50,9 +63,8 @@ class FriendCellState extends State<FriendCell> { | ... | @@ -50,9 +63,8 @@ class FriendCellState extends State<FriendCell> { |
50 | 63 | ||
51 | @override | 64 | @override |
52 | Widget build(BuildContext context) { | 65 | Widget build(BuildContext context) { |
53 | - // TODO: implement build | ||
54 | return Container( | 66 | return Container( |
55 | - color: Color(0XFFFEFFFE), | 67 | + color: const Color(0XFFFEFFFE), |
56 | child: Column( | 68 | child: Column( |
57 | children: <Widget>[ | 69 | children: <Widget>[ |
58 | Flex( | 70 | Flex( |
... | @@ -60,33 +72,42 @@ class FriendCellState extends State<FriendCell> { | ... | @@ -60,33 +72,42 @@ class FriendCellState extends State<FriendCell> { |
60 | mainAxisAlignment: MainAxisAlignment.start, | 72 | mainAxisAlignment: MainAxisAlignment.start, |
61 | crossAxisAlignment: CrossAxisAlignment.start, | 73 | crossAxisAlignment: CrossAxisAlignment.start, |
62 | children: <Widget>[ | 74 | children: <Widget>[ |
63 | - | ||
64 | Container( | 75 | Container( |
65 | - width: 40, | 76 | + width: 40.px, |
66 | - height: 40, | 77 | + height: 40.px, |
67 | - margin: EdgeInsets.fromLTRB(15, 20, 15, 0), | 78 | + margin: EdgeInsets.fromLTRB(15.px, 20.px, 15.px, 0.px), |
68 | child: ClipRRect( | 79 | child: ClipRRect( |
69 | - child: Image.asset("assets/data/friends/" + widget.model.head , fit: BoxFit.fill,), | 80 | + child: Image.asset( |
70 | - borderRadius: BorderRadius.circular(5), | 81 | + "assets/data/friends/" + widget.model.head, |
82 | + fit: BoxFit.fill, | ||
83 | + ), | ||
84 | + borderRadius: BorderRadius.circular(5.px), | ||
71 | ), | 85 | ), |
72 | ), | 86 | ), |
73 | Expanded( | 87 | Expanded( |
74 | child: Container( | 88 | child: Container( |
75 | - margin: EdgeInsets.fromLTRB(0, 20, 70, 0), | 89 | + margin: EdgeInsets.fromLTRB(0.px, 20.px, 70.px, 0.px), |
76 | child: Column( | 90 | child: Column( |
77 | mainAxisAlignment: MainAxisAlignment.start, | 91 | mainAxisAlignment: MainAxisAlignment.start, |
78 | crossAxisAlignment: CrossAxisAlignment.start, | 92 | crossAxisAlignment: CrossAxisAlignment.start, |
79 | children: <Widget>[ | 93 | children: <Widget>[ |
80 | - Text(widget.model.name , style: TextStyle(fontSize: 17 , color: Color(0XFF566B94) , fontWeight: FontWeight.w500),), | 94 | + Text( |
81 | - SizedBox(height: 5,), | 95 | + widget.model.name, |
82 | - Text(widget.model.desc , style: TextStyle(fontSize: 15),), | 96 | + style: TextStyle( |
97 | + fontSize: 17.px, | ||
98 | + color: const Color(0XFF566B94), | ||
99 | + fontWeight: FontWeight.w500), | ||
100 | + ), | ||
101 | + SizedBox( | ||
102 | + height: 5.px, | ||
103 | + ), | ||
104 | + Text( | ||
105 | + widget.model.desc, | ||
106 | + style: TextStyle(fontSize: 15.px), | ||
107 | + ), | ||
83 | makePictureCount(widget.model.pics)!, | 108 | makePictureCount(widget.model.pics)!, |
84 | - | ||
85 | ], | 109 | ], |
86 | - ) | 110 | + ))) |
87 | - ) | ||
88 | - ) | ||
89 | - | ||
90 | ], | 111 | ], |
91 | ), | 112 | ), |
92 | Flex( | 113 | Flex( |
... | @@ -96,136 +117,216 @@ class FriendCellState extends State<FriendCell> { | ... | @@ -96,136 +117,216 @@ class FriendCellState extends State<FriendCell> { |
96 | Expanded( | 117 | Expanded( |
97 | flex: 1, | 118 | flex: 1, |
98 | child: Container( | 119 | child: Container( |
99 | - | 120 | + margin: EdgeInsets.only(left: 70.px), |
100 | - margin: EdgeInsets.only(left: 70), | 121 | + child: Text( |
101 | - child: Text(widget.model.time , style: TextStyle(fontSize: 12 , color: Color(0XFFB2B2B2)),), | 122 | + widget.model.time, |
123 | + style: TextStyle( | ||
124 | + fontSize: 12.px, | ||
125 | + color: const Color(0XFFB2B2B2), | ||
126 | + ), | ||
127 | + ), | ||
102 | ), | 128 | ), |
103 | ), | 129 | ), |
104 | Expanded( | 130 | Expanded( |
105 | flex: 2, | 131 | flex: 2, |
106 | child: Container( | 132 | child: Container( |
107 | - margin: EdgeInsets.only(right: 20), | 133 | + margin: EdgeInsets.only(right: 20.px), |
108 | child: Row( | 134 | child: Row( |
109 | mainAxisAlignment: MainAxisAlignment.end, | 135 | mainAxisAlignment: MainAxisAlignment.end, |
110 | children: <Widget>[ | 136 | children: <Widget>[ |
111 | AnimatedContainer( | 137 | AnimatedContainer( |
112 | decoration: BoxDecoration( | 138 | decoration: BoxDecoration( |
113 | - borderRadius: BorderRadius.circular(5), | 139 | + borderRadius: BorderRadius.circular(5.px), |
114 | - color: Color(0XFF4C5154) | 140 | + color: const Color(0XFF4C5154)), |
115 | - ), | 141 | + duration: const Duration(milliseconds: 100), |
116 | - duration: Duration(milliseconds: 100), | ||
117 | width: _width, | 142 | width: _width, |
118 | - height: 30, | 143 | + height: 30.px, |
119 | child: Flex( | 144 | child: Flex( |
120 | direction: Axis.horizontal, | 145 | direction: Axis.horizontal, |
121 | children: <Widget>[ | 146 | children: <Widget>[ |
122 | Expanded( | 147 | Expanded( |
123 | - flex : 1 , | 148 | + flex: 1, |
124 | child: Row( | 149 | child: Row( |
125 | - mainAxisAlignment: MainAxisAlignment.center, | 150 | + mainAxisAlignment: |
151 | + MainAxisAlignment.center, | ||
126 | children: <Widget>[ | 152 | children: <Widget>[ |
127 | - Icon(Icons.favorite_border , color: Colors.white, size: 15,), | 153 | + Icon( |
128 | - SizedBox(width: 5,), | 154 | + Icons.favorite_border, |
155 | + color: Colors.white, | ||
156 | + size: 15.px, | ||
157 | + ), | ||
158 | + SizedBox( | ||
159 | + width: 5.px, | ||
160 | + ), | ||
129 | InkWell( | 161 | InkWell( |
130 | - onTap: (){ | 162 | + onTap: () { |
131 | setState(() { | 163 | setState(() { |
132 | - _starCount ++ ; | 164 | + _starCount++; |
133 | isShow(); | 165 | isShow(); |
134 | }); | 166 | }); |
135 | }, | 167 | }, |
136 | - child: Text("赞" ,style: TextStyle(color: Colors.white , fontSize: 12),) | 168 | + child: Text( |
137 | - ) | 169 | + "荐", |
138 | - | 170 | + style: TextStyle( |
139 | - ], | 171 | + color: Colors.white, |
140 | - ) | 172 | + fontSize: 12.px, |
141 | ), | 173 | ), |
174 | + )) | ||
175 | + ], | ||
176 | + )), | ||
142 | Expanded( | 177 | Expanded( |
143 | flex: 1, | 178 | flex: 1, |
144 | child: Row( | 179 | child: Row( |
145 | - mainAxisAlignment: MainAxisAlignment.center, | 180 | + mainAxisAlignment: |
181 | + MainAxisAlignment.center, | ||
146 | children: <Widget>[ | 182 | children: <Widget>[ |
147 | - Icon(Icons.sms , color: Colors.white, size: 15,), | 183 | + Icon( |
148 | - SizedBox(width: 5,), | 184 | + Icons.sms, |
185 | + color: Colors.white, | ||
186 | + size: 15.px, | ||
187 | + ), | ||
188 | + SizedBox( | ||
189 | + width: 5.px, | ||
190 | + ), | ||
149 | InkWell( | 191 | InkWell( |
150 | onTap: () { | 192 | onTap: () { |
151 | setState(() { | 193 | setState(() { |
152 | - _talkCount ++ ; | 194 | + _talkCount++; |
153 | isShow(); | 195 | isShow(); |
154 | }); | 196 | }); |
155 | }, | 197 | }, |
156 | - child: Text("评论" ,style: TextStyle(color: Colors.white , fontSize: 12),) | 198 | + child: Text( |
157 | - ) | 199 | + "避", |
158 | - | 200 | + style: TextStyle( |
201 | + color: Colors.white, | ||
202 | + fontSize: 12.px, | ||
203 | + ), | ||
204 | + )) | ||
159 | ], | 205 | ], |
160 | - ) | 206 | + )), |
161 | - ) | 207 | + Expanded( |
208 | + flex: 1, | ||
209 | + child: Row( | ||
210 | + mainAxisAlignment: | ||
211 | + MainAxisAlignment.center, | ||
212 | + children: <Widget>[ | ||
213 | + Icon( | ||
214 | + Icons.sms, | ||
215 | + color: Colors.white, | ||
216 | + size: 15.px, | ||
217 | + ), | ||
218 | + SizedBox( | ||
219 | + width: 5.px, | ||
220 | + ), | ||
221 | + InkWell( | ||
222 | + onTap: () { | ||
223 | + setState(() { | ||
224 | + _talkCount++; | ||
225 | + isShow(); | ||
226 | + }); | ||
227 | + }, | ||
228 | + child: Text( | ||
229 | + "藏", | ||
230 | + style: TextStyle( | ||
231 | + color: Colors.white, | ||
232 | + fontSize: 12.px, | ||
233 | + ), | ||
234 | + )) | ||
162 | ], | 235 | ], |
163 | - ) | 236 | + )), |
237 | + Expanded( | ||
238 | + flex: 1, | ||
239 | + child: Row( | ||
240 | + mainAxisAlignment: | ||
241 | + MainAxisAlignment.center, | ||
242 | + children: <Widget>[ | ||
243 | + Icon( | ||
244 | + Icons.sms, | ||
245 | + color: Colors.white, | ||
246 | + size: 15.px, | ||
247 | + ), | ||
248 | + SizedBox( | ||
249 | + width: 5.px, | ||
164 | ), | 250 | ), |
165 | - SizedBox(width: 10,), | ||
166 | InkWell( | 251 | InkWell( |
167 | - onTap: (){ | 252 | + onTap: () { |
253 | + setState(() { | ||
254 | + _talkCount++; | ||
168 | isShow(); | 255 | isShow(); |
256 | + }); | ||
169 | }, | 257 | }, |
170 | - child: Image.asset("assets/data/friends/button.png" , width: 22, height: 18,) | 258 | + child: Text( |
259 | + "评", | ||
260 | + style: TextStyle( | ||
261 | + color: Colors.white, | ||
262 | + fontSize: 12.px, | ||
171 | ), | 263 | ), |
264 | + )) | ||
172 | ], | 265 | ], |
266 | + )), | ||
267 | + ], | ||
268 | + )), | ||
269 | + SizedBox( | ||
270 | + width: 10.px, | ||
173 | ), | 271 | ), |
174 | - ) | 272 | + InkWell( |
175 | - | 273 | + onTap: () { |
176 | - | 274 | + isShow(); |
177 | - | 275 | + }, |
178 | - ) | 276 | + child: Image.asset( |
277 | + "assets/data/friends/button.png", | ||
278 | + width: 22.px, | ||
279 | + height: 18.px, | ||
280 | + )), | ||
281 | + ], | ||
282 | + ), | ||
283 | + )) | ||
179 | ], | 284 | ], |
180 | ), | 285 | ), |
181 | Offstage( | 286 | Offstage( |
182 | offstage: _starCount == 0 ? true : false, | 287 | offstage: _starCount == 0 ? true : false, |
183 | child: Container( | 288 | child: Container( |
184 | - constraints: BoxConstraints( | 289 | + constraints: const BoxConstraints(minWidth: double.infinity), |
185 | - minWidth: double.infinity | 290 | + margin: EdgeInsets.fromLTRB(70.px, 10.px, 15.px, 0.px), |
186 | - ), | 291 | + padding: EdgeInsets.all(5.px), |
187 | - margin: EdgeInsets.fromLTRB(70, 10, 15, 0), | 292 | + color: const Color(0XFFF3F3F5), |
188 | - padding: EdgeInsets.all(5), | ||
189 | - color: Color(0XFFF3F3F5), | ||
190 | child: Wrap( | 293 | child: Wrap( |
191 | alignment: WrapAlignment.start, | 294 | alignment: WrapAlignment.start, |
192 | - runSpacing: 5, | 295 | + runSpacing: 5.px, |
193 | - spacing: 5, | 296 | + spacing: 5.px, |
194 | - children:likeView(_starCount) | 297 | + children: likeView(_starCount)), |
195 | - ), | ||
196 | ), | 298 | ), |
197 | ), | 299 | ), |
198 | Offstage( | 300 | Offstage( |
199 | offstage: _talkCount == 0 ? true : false, | 301 | offstage: _talkCount == 0 ? true : false, |
200 | child: Container( | 302 | child: Container( |
201 | - constraints: BoxConstraints( | 303 | + constraints: const BoxConstraints(minWidth: double.infinity), |
202 | - minWidth: double.infinity | 304 | + margin: EdgeInsets.fromLTRB(70.px, 0.px, 15.px, 0.px), |
203 | - ), | 305 | + padding: EdgeInsets.all(5.px), |
204 | - margin: EdgeInsets.fromLTRB(70, 0, 15, 0), | 306 | + color: const Color(0XFFF3F3F5), |
205 | - padding: EdgeInsets.all(5), | ||
206 | - color: Color(0XFFF3F3F5), | ||
207 | child: Wrap( | 307 | child: Wrap( |
208 | alignment: WrapAlignment.start, | 308 | alignment: WrapAlignment.start, |
209 | - runSpacing: 5, | 309 | + runSpacing: 5.px, |
210 | - spacing: 5, | 310 | + spacing: 5.px, |
211 | - children:talkView(_talkCount) | 311 | + children: talkView(_talkCount)), |
212 | ), | 312 | ), |
213 | ), | 313 | ), |
314 | + SizedBox( | ||
315 | + height: 10.px, | ||
214 | ), | 316 | ), |
215 | - SizedBox(height: 10,), | 317 | + Container( |
216 | - Container(height: 0.5, width: double.infinity, color: Colors.black26,) | 318 | + height: 0.5, |
217 | - ], | 319 | + width: double.infinity, |
320 | + color: Colors.black26, | ||
218 | ) | 321 | ) |
219 | - | 322 | + ], |
220 | - | 323 | + )); |
221 | - | ||
222 | - ); | ||
223 | } | 324 | } |
224 | 325 | ||
225 | void isShow() { | 326 | void isShow() { |
226 | _isShow = !_isShow; | 327 | _isShow = !_isShow; |
227 | setState(() { | 328 | setState(() { |
228 | - _width = _isShow ? 120 : 0; | 329 | + _width = _isShow ? 160.px : 0.px; |
229 | }); | 330 | }); |
230 | } | 331 | } |
231 | 332 | ||
... | @@ -233,16 +334,27 @@ class FriendCellState extends State<FriendCell> { | ... | @@ -233,16 +334,27 @@ class FriendCellState extends State<FriendCell> { |
233 | var _talkCount = 0; | 334 | var _talkCount = 0; |
234 | 335 | ||
235 | List<Widget> likeView(int count) { | 336 | List<Widget> likeView(int count) { |
236 | - | ||
237 | List<Widget> result = []; | 337 | List<Widget> result = []; |
238 | - for (int i =0 ; i< count ; i ++) { | 338 | + for (int i = 0; i < count; i++) { |
239 | - result.add(Container( | 339 | + result.add(SizedBox( |
240 | - width: 70, | 340 | + width: 70.px, |
241 | child: Row( | 341 | child: Row( |
242 | children: <Widget>[ | 342 | children: <Widget>[ |
243 | - Icon(Icons.favorite_border , size: 13, color: Color(0XFF566B94),), | 343 | + Icon( |
244 | - SizedBox(width: 5,), | 344 | + Icons.favorite_border, |
245 | - Text("sunnytu" ,style: TextStyle(color: Color(0XFF566B94) , fontSize: 15 , fontWeight: FontWeight.w500),) | 345 | + size: 13.px, |
346 | + color: const Color(0XFF566B94), | ||
347 | + ), | ||
348 | + SizedBox( | ||
349 | + width: 5.px, | ||
350 | + ), | ||
351 | + Text( | ||
352 | + "sunnytu", | ||
353 | + style: TextStyle( | ||
354 | + color: const Color(0XFF566B94), | ||
355 | + fontSize: 15.px, | ||
356 | + fontWeight: FontWeight.w500), | ||
357 | + ) | ||
246 | ], | 358 | ], |
247 | ), | 359 | ), |
248 | )); | 360 | )); |
... | @@ -252,38 +364,30 @@ class FriendCellState extends State<FriendCell> { | ... | @@ -252,38 +364,30 @@ class FriendCellState extends State<FriendCell> { |
252 | } | 364 | } |
253 | 365 | ||
254 | List<Widget> talkView(int count) { | 366 | List<Widget> talkView(int count) { |
255 | - | ||
256 | List<Widget> result = []; | 367 | List<Widget> result = []; |
257 | - for (int i =0 ; i< count ; i ++) { | 368 | + for (int i = 0; i < count; i++) { |
258 | - result.add(Container( | 369 | + result.add(Row( |
259 | - child: Row( | ||
260 | children: <Widget>[ | 370 | children: <Widget>[ |
261 | - | ||
262 | Expanded( | 371 | Expanded( |
263 | child: Text.rich( | 372 | child: Text.rich( |
264 | - TextSpan( | 373 | + TextSpan(children: [ |
265 | - children: [ | ||
266 | TextSpan( | 374 | TextSpan( |
267 | text: "sunnytu:", | 375 | text: "sunnytu:", |
268 | - style: TextStyle(fontSize: 15 ,fontWeight: FontWeight.w500 , color: Color(0XFF566B94)) | 376 | + style: TextStyle( |
269 | - ), | 377 | + fontSize: 15.px, |
378 | + fontWeight: FontWeight.w500, | ||
379 | + color: const Color(0XFF566B94))), | ||
270 | TextSpan( | 380 | TextSpan( |
271 | text: "66666", | 381 | text: "66666", |
272 | - style: TextStyle(fontSize: 14), | 382 | + style: TextStyle(fontSize: 14.px), |
273 | ) | 383 | ) |
274 | - ] | 384 | + ]), |
275 | - ), | ||
276 | textAlign: TextAlign.start, | 385 | textAlign: TextAlign.start, |
277 | - ) | 386 | + )), |
278 | - ), | ||
279 | - | ||
280 | - | ||
281 | ], | 387 | ], |
282 | - ), | ||
283 | )); | 388 | )); |
284 | } | 389 | } |
285 | 390 | ||
286 | return result; | 391 | return result; |
287 | } | 392 | } |
288 | - | ||
289 | } | 393 | } | ... | ... |
lib/widgets/bars/timeline_menu_bar.dart
0 → 100644
1 | +import 'package:flutter/material.dart'; | ||
2 | + | ||
3 | +class TimelineMenuHeader extends StatelessWidget { | ||
4 | + const TimelineMenuHeader({ | ||
5 | + Key? key, | ||
6 | + this.funcLeft, | ||
7 | + this.funcCenter, | ||
8 | + this.funcRight, | ||
9 | + }) : super(key: key); | ||
10 | + | ||
11 | + final Function? funcLeft; | ||
12 | + final Function? funcCenter; | ||
13 | + final Function? funcRight; | ||
14 | + | ||
15 | + @override | ||
16 | + Widget build(BuildContext context) { | ||
17 | + return Container( | ||
18 | + alignment: Alignment.center, | ||
19 | + margin: const EdgeInsets.symmetric(horizontal: 5.0), | ||
20 | + child: Row( | ||
21 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
22 | + mainAxisSize: MainAxisSize.min, | ||
23 | + //交叉轴的布局方式,对于column来说就是水平方向的布局方式 | ||
24 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
25 | + children: <Widget>[ | ||
26 | + SizedBox( | ||
27 | + width: 60.0, | ||
28 | + child: TextButton( | ||
29 | + onPressed: () => funcLeft!(), | ||
30 | + child: const Text( | ||
31 | + "临境", | ||
32 | + style: TextStyle(color: Colors.black54), | ||
33 | + ), | ||
34 | + ), | ||
35 | + ), | ||
36 | + const VerticalDivider( | ||
37 | + color: Colors.black54, | ||
38 | + width: 1.0, | ||
39 | + thickness: 1.0, | ||
40 | + indent: 16.0, | ||
41 | + endIndent: 16.0, | ||
42 | + ), | ||
43 | + TextButton( | ||
44 | + onPressed: () => funcCenter!(), | ||
45 | + child: const Text( | ||
46 | + "附近", | ||
47 | + style: TextStyle(color: Colors.black54), | ||
48 | + ), | ||
49 | + ), | ||
50 | + const VerticalDivider( | ||
51 | + color: Colors.black54, | ||
52 | + width: 1.0, | ||
53 | + thickness: 1.0, | ||
54 | + indent: 15.0, | ||
55 | + endIndent: 15.0, | ||
56 | + ), | ||
57 | + TextButton( | ||
58 | + onPressed: () => funcRight!(), | ||
59 | + child: const Text( | ||
60 | + "新鲜", | ||
61 | + style: TextStyle(color: Colors.black54), | ||
62 | + ), | ||
63 | + ), | ||
64 | + ], | ||
65 | + )); | ||
66 | + } | ||
67 | +} |
-
Please register or login to post a comment