Showing
5 changed files
with
425 additions
and
261 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( |
| 61 | + isBack: false, | ||
| 62 | + isTransparent: true, | ||
| 63 | + homeMenuHeader: TimelineMenuHeader(), | ||
| 64 | + ), | ||
| 65 | + body: ListView( | ||
| 66 | + padding: const EdgeInsets.only(top: 0), | ||
| 67 | + controller: _scrollController, | ||
| 65 | children: <Widget>[ | 68 | children: <Widget>[ |
| 66 | - ListView( | 69 | + ListView.builder( |
| 67 | padding: const EdgeInsets.only(top: 0), | 70 | padding: const EdgeInsets.only(top: 0), |
| 68 | - controller: _scrollController, | 71 | + itemBuilder: _mainListViewBuilder, |
| 69 | - children: <Widget>[ | 72 | + itemCount: _friendModelEntity.data.length, |
| 70 | - const HeaderView(), | 73 | + shrinkWrap: true, |
| 71 | - ListView.builder(padding: const EdgeInsets.only(top: 0), itemBuilder: _mainListViewBuidler , itemCount: _friendmodelEntity.data.length, shrinkWrap: true, physics:NeverScrollableScrollPhysics(),) | 74 | + physics: const NeverScrollableScrollPhysics(), |
| 72 | - ], | ||
| 73 | - ), | ||
| 74 | - Opacity( | ||
| 75 | - opacity: _opacity, | ||
| 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,240 +63,331 @@ class FriendCellState extends State<FriendCell> { | ... | @@ -50,240 +63,331 @@ 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( |
| 59 | - direction: Axis.horizontal, | 71 | + direction: Axis.horizontal, |
| 60 | - mainAxisAlignment: MainAxisAlignment.start, | 72 | + mainAxisAlignment: MainAxisAlignment.start, |
| 61 | - crossAxisAlignment: CrossAxisAlignment.start, | 73 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 62 | - children: <Widget>[ | 74 | + children: <Widget>[ |
| 63 | - | 75 | + Container( |
| 64 | - Container( | 76 | + width: 40.px, |
| 65 | - width: 40, | 77 | + height: 40.px, |
| 66 | - height: 40, | 78 | + margin: EdgeInsets.fromLTRB(15.px, 20.px, 15.px, 0.px), |
| 67 | - margin: EdgeInsets.fromLTRB(15, 20, 15, 0), | 79 | + child: ClipRRect( |
| 68 | - child: ClipRRect( | 80 | + child: Image.asset( |
| 69 | - child: Image.asset("assets/data/friends/" + widget.model.head , fit: BoxFit.fill,), | 81 | + "assets/data/friends/" + widget.model.head, |
| 70 | - borderRadius: BorderRadius.circular(5), | 82 | + fit: BoxFit.fill, |
| 71 | - ), | 83 | + ), |
| 72 | - ), | 84 | + borderRadius: BorderRadius.circular(5.px), |
| 73 | - Expanded( | 85 | + ), |
| 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 | ), | 86 | ), |
| 103 | - ), | 87 | + Expanded( |
| 104 | - Expanded( | 88 | + child: Container( |
| 105 | - flex: 2, | 89 | + margin: EdgeInsets.fromLTRB(0.px, 20.px, 70.px, 0.px), |
| 106 | - child: Container( | 90 | + child: Column( |
| 107 | - margin: EdgeInsets.only(right: 20), | 91 | + mainAxisAlignment: MainAxisAlignment.start, |
| 108 | - child: Row( | 92 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 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>[ | 93 | children: <Widget>[ |
| 122 | - Expanded( | 94 | + Text( |
| 123 | - flex : 1 , | 95 | + widget.model.name, |
| 124 | - child: Row( | 96 | + style: TextStyle( |
| 125 | - mainAxisAlignment: MainAxisAlignment.center, | 97 | + fontSize: 17.px, |
| 126 | - children: <Widget>[ | 98 | + color: const Color(0XFF566B94), |
| 127 | - Icon(Icons.favorite_border , color: Colors.white, size: 15,), | 99 | + fontWeight: FontWeight.w500), |
| 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 | ), | 100 | ), |
| 142 | - Expanded( | 101 | + SizedBox( |
| 143 | - flex: 1, | 102 | + height: 5.px, |
| 144 | - child: Row( | 103 | + ), |
| 145 | - mainAxisAlignment: MainAxisAlignment.center, | 104 | + Text( |
| 146 | - children: <Widget>[ | 105 | + widget.model.desc, |
| 147 | - Icon(Icons.sms , color: Colors.white, size: 15,), | 106 | + style: TextStyle(fontSize: 15.px), |
| 148 | - SizedBox(width: 5,), | 107 | + ), |
| 149 | - InkWell( | 108 | + makePictureCount(widget.model.pics)!, |
| 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 | ], | 109 | ], |
| 163 | - ) | 110 | + ))) |
| 164 | - ), | 111 | + ], |
| 165 | - SizedBox(width: 10,), | 112 | + ), |
| 166 | - InkWell( | 113 | + Flex( |
| 167 | - onTap: (){ | 114 | + direction: Axis.horizontal, |
| 168 | - isShow(); | 115 | + mainAxisAlignment: MainAxisAlignment.center, |
| 169 | - }, | 116 | + children: <Widget>[ |
| 170 | - child: Image.asset("assets/data/friends/button.png" , width: 22, height: 18,) | 117 | + Expanded( |
| 118 | + flex: 1, | ||
| 119 | + child: Container( | ||
| 120 | + margin: EdgeInsets.only(left: 70.px), | ||
| 121 | + child: Text( | ||
| 122 | + widget.model.time, | ||
| 123 | + style: TextStyle( | ||
| 124 | + fontSize: 12.px, | ||
| 125 | + color: const Color(0XFFB2B2B2), | ||
| 171 | ), | 126 | ), |
| 172 | - ], | 127 | + ), |
| 173 | ), | 128 | ), |
| 174 | - ) | 129 | + ), |
| 175 | - | 130 | + Expanded( |
| 176 | - | 131 | + flex: 2, |
| 177 | - | 132 | + child: Container( |
| 178 | - ) | 133 | + margin: EdgeInsets.only(right: 20.px), |
| 179 | - ], | 134 | + child: Row( |
| 180 | - ), | 135 | + mainAxisAlignment: MainAxisAlignment.end, |
| 181 | - Offstage( | 136 | + children: <Widget>[ |
| 182 | - offstage: _starCount == 0 ? true : false, | 137 | + AnimatedContainer( |
| 183 | - child: Container( | 138 | + decoration: BoxDecoration( |
| 184 | - constraints: BoxConstraints( | 139 | + borderRadius: BorderRadius.circular(5.px), |
| 185 | - minWidth: double.infinity | 140 | + color: const Color(0XFF4C5154)), |
| 186 | - ), | 141 | + duration: const Duration(milliseconds: 100), |
| 187 | - margin: EdgeInsets.fromLTRB(70, 10, 15, 0), | 142 | + width: _width, |
| 188 | - padding: EdgeInsets.all(5), | 143 | + height: 30.px, |
| 189 | - color: Color(0XFFF3F3F5), | 144 | + child: Flex( |
| 190 | - child: Wrap( | 145 | + direction: Axis.horizontal, |
| 191 | - alignment: WrapAlignment.start, | 146 | + children: <Widget>[ |
| 192 | - runSpacing: 5, | 147 | + Expanded( |
| 193 | - spacing: 5, | 148 | + flex: 1, |
| 194 | - children:likeView(_starCount) | 149 | + child: Row( |
| 195 | - ), | 150 | + mainAxisAlignment: |
| 151 | + MainAxisAlignment.center, | ||
| 152 | + children: <Widget>[ | ||
| 153 | + Icon( | ||
| 154 | + Icons.favorite_border, | ||
| 155 | + color: Colors.white, | ||
| 156 | + size: 15.px, | ||
| 157 | + ), | ||
| 158 | + SizedBox( | ||
| 159 | + width: 5.px, | ||
| 160 | + ), | ||
| 161 | + InkWell( | ||
| 162 | + onTap: () { | ||
| 163 | + setState(() { | ||
| 164 | + _starCount++; | ||
| 165 | + isShow(); | ||
| 166 | + }); | ||
| 167 | + }, | ||
| 168 | + child: Text( | ||
| 169 | + "荐", | ||
| 170 | + style: TextStyle( | ||
| 171 | + color: Colors.white, | ||
| 172 | + fontSize: 12.px, | ||
| 173 | + ), | ||
| 174 | + )) | ||
| 175 | + ], | ||
| 176 | + )), | ||
| 177 | + Expanded( | ||
| 178 | + flex: 1, | ||
| 179 | + child: Row( | ||
| 180 | + mainAxisAlignment: | ||
| 181 | + MainAxisAlignment.center, | ||
| 182 | + children: <Widget>[ | ||
| 183 | + Icon( | ||
| 184 | + Icons.sms, | ||
| 185 | + color: Colors.white, | ||
| 186 | + size: 15.px, | ||
| 187 | + ), | ||
| 188 | + SizedBox( | ||
| 189 | + width: 5.px, | ||
| 190 | + ), | ||
| 191 | + InkWell( | ||
| 192 | + onTap: () { | ||
| 193 | + setState(() { | ||
| 194 | + _talkCount++; | ||
| 195 | + isShow(); | ||
| 196 | + }); | ||
| 197 | + }, | ||
| 198 | + child: Text( | ||
| 199 | + "避", | ||
| 200 | + style: TextStyle( | ||
| 201 | + color: Colors.white, | ||
| 202 | + fontSize: 12.px, | ||
| 203 | + ), | ||
| 204 | + )) | ||
| 205 | + ], | ||
| 206 | + )), | ||
| 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 | + )) | ||
| 235 | + ], | ||
| 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, | ||
| 250 | + ), | ||
| 251 | + InkWell( | ||
| 252 | + onTap: () { | ||
| 253 | + setState(() { | ||
| 254 | + _talkCount++; | ||
| 255 | + isShow(); | ||
| 256 | + }); | ||
| 257 | + }, | ||
| 258 | + child: Text( | ||
| 259 | + "评", | ||
| 260 | + style: TextStyle( | ||
| 261 | + color: Colors.white, | ||
| 262 | + fontSize: 12.px, | ||
| 263 | + ), | ||
| 264 | + )) | ||
| 265 | + ], | ||
| 266 | + )), | ||
| 267 | + ], | ||
| 268 | + )), | ||
| 269 | + SizedBox( | ||
| 270 | + width: 10.px, | ||
| 271 | + ), | ||
| 272 | + InkWell( | ||
| 273 | + onTap: () { | ||
| 274 | + isShow(); | ||
| 275 | + }, | ||
| 276 | + child: Image.asset( | ||
| 277 | + "assets/data/friends/button.png", | ||
| 278 | + width: 22.px, | ||
| 279 | + height: 18.px, | ||
| 280 | + )), | ||
| 281 | + ], | ||
| 282 | + ), | ||
| 283 | + )) | ||
| 284 | + ], | ||
| 196 | ), | 285 | ), |
| 197 | - ), | 286 | + Offstage( |
| 198 | - Offstage( | 287 | + offstage: _starCount == 0 ? true : false, |
| 199 | - offstage: _talkCount == 0 ? true : false, | 288 | + child: Container( |
| 200 | - child: Container( | 289 | + constraints: const BoxConstraints(minWidth: double.infinity), |
| 201 | - constraints: BoxConstraints( | 290 | + margin: EdgeInsets.fromLTRB(70.px, 10.px, 15.px, 0.px), |
| 202 | - minWidth: double.infinity | 291 | + padding: EdgeInsets.all(5.px), |
| 292 | + color: const Color(0XFFF3F3F5), | ||
| 293 | + child: Wrap( | ||
| 294 | + alignment: WrapAlignment.start, | ||
| 295 | + runSpacing: 5.px, | ||
| 296 | + spacing: 5.px, | ||
| 297 | + children: likeView(_starCount)), | ||
| 203 | ), | 298 | ), |
| 204 | - margin: EdgeInsets.fromLTRB(70, 0, 15, 0), | 299 | + ), |
| 205 | - padding: EdgeInsets.all(5), | 300 | + Offstage( |
| 206 | - color: Color(0XFFF3F3F5), | 301 | + offstage: _talkCount == 0 ? true : false, |
| 207 | - child: Wrap( | 302 | + child: Container( |
| 208 | - alignment: WrapAlignment.start, | 303 | + constraints: const BoxConstraints(minWidth: double.infinity), |
| 209 | - runSpacing: 5, | 304 | + margin: EdgeInsets.fromLTRB(70.px, 0.px, 15.px, 0.px), |
| 210 | - spacing: 5, | 305 | + padding: EdgeInsets.all(5.px), |
| 211 | - children:talkView(_talkCount) | 306 | + color: const Color(0XFFF3F3F5), |
| 307 | + child: Wrap( | ||
| 308 | + alignment: WrapAlignment.start, | ||
| 309 | + runSpacing: 5.px, | ||
| 310 | + spacing: 5.px, | ||
| 311 | + children: talkView(_talkCount)), | ||
| 212 | ), | 312 | ), |
| 213 | ), | 313 | ), |
| 214 | - ), | 314 | + SizedBox( |
| 215 | - SizedBox(height: 10,), | 315 | + height: 10.px, |
| 216 | - Container(height: 0.5, width: double.infinity, color: Colors.black26,) | 316 | + ), |
| 217 | - ], | 317 | + Container( |
| 218 | - ) | 318 | + height: 0.5, |
| 219 | - | 319 | + width: double.infinity, |
| 220 | - | 320 | + color: Colors.black26, |
| 221 | - | 321 | + ) |
| 222 | - ); | 322 | + ], |
| 323 | + )); | ||
| 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 | ||
| 232 | var _starCount = 0; | 333 | var _starCount = 0; |
| 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 = []; | ||
| 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 = []; | 337 | List<Widget> result = []; |
| 257 | - for (int i =0 ; i< count ; i ++) { | 338 | + for (int i = 0; i < count; i++) { |
| 258 | - result.add(Container( | 339 | + result.add(SizedBox( |
| 340 | + width: 70.px, | ||
| 259 | child: Row( | 341 | child: Row( |
| 260 | children: <Widget>[ | 342 | children: <Widget>[ |
| 261 | - | 343 | + Icon( |
| 262 | - Expanded( | 344 | + Icons.favorite_border, |
| 263 | - child: Text.rich( | 345 | + size: 13.px, |
| 264 | - TextSpan( | 346 | + color: const Color(0XFF566B94), |
| 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 | ), | 347 | ), |
| 279 | - | 348 | + SizedBox( |
| 280 | - | 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 | + ) | ||
| 281 | ], | 358 | ], |
| 282 | ), | 359 | ), |
| 283 | )); | 360 | )); |
| 284 | } | 361 | } |
| 285 | 362 | ||
| 286 | - return result; | 363 | + return result; |
| 287 | } | 364 | } |
| 288 | 365 | ||
| 289 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 366 | + List<Widget> talkView(int count) { | ||
| 367 | + List<Widget> result = []; | ||
| 368 | + for (int i = 0; i < count; i++) { | ||
| 369 | + result.add(Row( | ||
| 370 | + children: <Widget>[ | ||
| 371 | + Expanded( | ||
| 372 | + child: Text.rich( | ||
| 373 | + TextSpan(children: [ | ||
| 374 | + TextSpan( | ||
| 375 | + text: "sunnytu:", | ||
| 376 | + style: TextStyle( | ||
| 377 | + fontSize: 15.px, | ||
| 378 | + fontWeight: FontWeight.w500, | ||
| 379 | + color: const Color(0XFF566B94))), | ||
| 380 | + TextSpan( | ||
| 381 | + text: "66666", | ||
| 382 | + style: TextStyle(fontSize: 14.px), | ||
| 383 | + ) | ||
| 384 | + ]), | ||
| 385 | + textAlign: TextAlign.start, | ||
| 386 | + )), | ||
| 387 | + ], | ||
| 388 | + )); | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + return result; | ||
| 392 | + } | ||
| 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