Showing
5 changed files
with
73 additions
and
49 deletions
| ... | @@ -7,6 +7,7 @@ import 'package:one_poem/tiktok/pages/user_page.dart'; | ... | @@ -7,6 +7,7 @@ import 'package:one_poem/tiktok/pages/user_page.dart'; |
| 7 | import 'package:one_poem/tiktok/style/physics.dart'; | 7 | import 'package:one_poem/tiktok/style/physics.dart'; |
| 8 | import 'package:one_poem/tiktok/views/tiktok_header.dart'; | 8 | import 'package:one_poem/tiktok/views/tiktok_header.dart'; |
| 9 | import 'package:one_poem/tiktok/views/tiktok_scaffold.dart'; | 9 | import 'package:one_poem/tiktok/views/tiktok_scaffold.dart'; |
| 10 | +import 'package:one_poem/tiktok/views/tiktok_top_info.dart'; | ||
| 10 | import 'package:one_poem/tiktok/views/tiktok_video.dart'; | 11 | import 'package:one_poem/tiktok/views/tiktok_video.dart'; |
| 11 | import 'package:one_poem/tiktok/views/tiktok_video_button_column.dart'; | 12 | import 'package:one_poem/tiktok/views/tiktok_video_button_column.dart'; |
| 12 | import 'package:video_player/video_player.dart'; | 13 | import 'package:video_player/video_player.dart'; |
| ... | @@ -142,6 +143,9 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -142,6 +143,9 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 142 | }, | 143 | }, |
| 143 | onShare: () {}, | 144 | onShare: () {}, |
| 144 | ); | 145 | ); |
| 146 | + Widget topInfo = const TikTokTopInfoColumn( | ||
| 147 | + info: "早安" | ||
| 148 | + ); | ||
| 145 | // video | 149 | // video |
| 146 | Widget currentVideo = Center( | 150 | Widget currentVideo = Center( |
| 147 | child: AspectRatio( | 151 | child: AspectRatio( |
| ... | @@ -175,6 +179,7 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -175,6 +179,7 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 175 | }); | 179 | }); |
| 176 | }, | 180 | }, |
| 177 | rightButtonColumn: buttons, | 181 | rightButtonColumn: buttons, |
| 182 | + topInfo: topInfo, | ||
| 178 | video: currentVideo, | 183 | video: currentVideo, |
| 179 | ); | 184 | ); |
| 180 | return currentVideo; | 185 | return currentVideo; | ... | ... |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:tapped/tapped.dart'; | 2 | import 'package:tapped/tapped.dart'; |
| 3 | 3 | ||
| 4 | -import 'select_text.dart'; | ||
| 5 | - | ||
| 6 | class TikTokHeader extends StatefulWidget { | 4 | class TikTokHeader extends StatefulWidget { |
| 7 | final Function? onSearch; | 5 | final Function? onSearch; |
| 8 | const TikTokHeader({ | 6 | const TikTokHeader({ |
| ... | @@ -18,28 +16,7 @@ class _TikTokHeaderState extends State<TikTokHeader> { | ... | @@ -18,28 +16,7 @@ class _TikTokHeaderState extends State<TikTokHeader> { |
| 18 | int currentSelect = 0; | 16 | int currentSelect = 0; |
| 19 | @override | 17 | @override |
| 20 | Widget build(BuildContext context) { | 18 | Widget build(BuildContext context) { |
| 21 | - List<String> list = ['推荐', '本地']; | ||
| 22 | - List<Widget> headList = []; | ||
| 23 | - for (var i = 0; i < list.length; i++) { | ||
| 24 | - headList.add(Expanded( | ||
| 25 | - child: GestureDetector( | ||
| 26 | - child: SelectText( | ||
| 27 | - title: list[i], | ||
| 28 | - isSelect: i == currentSelect, | ||
| 29 | - ), | ||
| 30 | - onTap: () { | ||
| 31 | - setState(() { | ||
| 32 | - currentSelect = i; | ||
| 33 | - }); | ||
| 34 | - }, | ||
| 35 | - ), | ||
| 36 | - )); | ||
| 37 | - } | ||
| 38 | - Widget headSwitch = Row( | ||
| 39 | - children: headList, | ||
| 40 | - ); | ||
| 41 | return Container( | 19 | return Container( |
| 42 | - // color: Colors.black.withOpacity(0.3), | ||
| 43 | padding: const EdgeInsets.symmetric(horizontal: 16), | 20 | padding: const EdgeInsets.symmetric(horizontal: 16), |
| 44 | child: Row( | 21 | child: Row( |
| 45 | mainAxisAlignment: MainAxisAlignment.center, | 22 | mainAxisAlignment: MainAxisAlignment.center, |
| ... | @@ -59,14 +36,6 @@ class _TikTokHeaderState extends State<TikTokHeader> { | ... | @@ -59,14 +36,6 @@ class _TikTokHeaderState extends State<TikTokHeader> { |
| 59 | ), | 36 | ), |
| 60 | ), | 37 | ), |
| 61 | Expanded( | 38 | Expanded( |
| 62 | - flex: 1, | ||
| 63 | - child: Container( | ||
| 64 | - color: Colors.black.withOpacity(0), | ||
| 65 | - alignment: Alignment.center, | ||
| 66 | - child: headSwitch, | ||
| 67 | - ), | ||
| 68 | - ), | ||
| 69 | - Expanded( | ||
| 70 | child: Tapped( | 39 | child: Tapped( |
| 71 | child: Container( | 40 | child: Container( |
| 72 | color: Colors.black.withOpacity(0), | 41 | color: Colors.black.withOpacity(0), | ... | ... |
lib/tiktok/views/tiktok_top_info.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_poem/tiktok/style/style.dart'; | ||
| 3 | + | ||
| 4 | +class TikTokTopInfoColumn extends StatelessWidget { | ||
| 5 | + final double? bottomPadding; | ||
| 6 | + final String? info; | ||
| 7 | + const TikTokTopInfoColumn({ | ||
| 8 | + Key? key, | ||
| 9 | + this.bottomPadding, this.info, | ||
| 10 | + }) : super(key: key); | ||
| 11 | + | ||
| 12 | + @override | ||
| 13 | + Widget build(BuildContext context) { | ||
| 14 | + return Container( | ||
| 15 | + width: SysSize.avatar, | ||
| 16 | + margin: EdgeInsets.only( | ||
| 17 | + bottom: bottomPadding ?? 50, | ||
| 18 | + right: 12, | ||
| 19 | + ), | ||
| 20 | + child: Column( | ||
| 21 | + mainAxisAlignment: MainAxisAlignment.end, | ||
| 22 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 23 | + children: <Widget>[ | ||
| 24 | + // Tapped( | ||
| 25 | + // child: const TikTokAvatar(), | ||
| 26 | + // onTap: onAvatar, | ||
| 27 | + // ), | ||
| 28 | + Text(info ?? "早安"), | ||
| 29 | + Container( | ||
| 30 | + width: SysSize.avatar, | ||
| 31 | + height: SysSize.avatar, | ||
| 32 | + margin: const EdgeInsets.only(top: 10), | ||
| 33 | + decoration: BoxDecoration( | ||
| 34 | + borderRadius: BorderRadius.circular(SysSize.avatar / 2.0), | ||
| 35 | + // color: Colors.black.withOpacity(0.8), | ||
| 36 | + ), | ||
| 37 | + ) | ||
| 38 | + ], | ||
| 39 | + ), | ||
| 40 | + ); | ||
| 41 | + } | ||
| 42 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -18,6 +18,7 @@ class TikTokVideoPage extends StatelessWidget { | ... | @@ -18,6 +18,7 @@ class TikTokVideoPage extends StatelessWidget { |
| 18 | final double bottomPadding; | 18 | final double bottomPadding; |
| 19 | 19 | ||
| 20 | final Widget? rightButtonColumn; | 20 | final Widget? rightButtonColumn; |
| 21 | + final Widget? topInfo; | ||
| 21 | final Widget? userInfoWidget; | 22 | final Widget? userInfoWidget; |
| 22 | 23 | ||
| 23 | final bool hidePauseIcon; | 24 | final bool hidePauseIcon; |
| ... | @@ -30,6 +31,7 @@ class TikTokVideoPage extends StatelessWidget { | ... | @@ -30,6 +31,7 @@ class TikTokVideoPage extends StatelessWidget { |
| 30 | this.bottomPadding = 16, | 31 | this.bottomPadding = 16, |
| 31 | this.tag, | 32 | this.tag, |
| 32 | this.rightButtonColumn, | 33 | this.rightButtonColumn, |
| 34 | + this.topInfo, | ||
| 33 | this.userInfoWidget, | 35 | this.userInfoWidget, |
| 34 | this.onAddFavorite, | 36 | this.onAddFavorite, |
| 35 | this.onSingleTap, | 37 | this.onSingleTap, |
| ... | @@ -90,6 +92,12 @@ class TikTokVideoPage extends StatelessWidget { | ... | @@ -90,6 +92,12 @@ class TikTokVideoPage extends StatelessWidget { |
| 90 | Container( | 92 | Container( |
| 91 | height: double.infinity, | 93 | height: double.infinity, |
| 92 | width: double.infinity, | 94 | width: double.infinity, |
| 95 | + alignment: Alignment.topCenter, | ||
| 96 | + child: topInfo, | ||
| 97 | + ), | ||
| 98 | + Container( | ||
| 99 | + height: double.infinity, | ||
| 100 | + width: double.infinity, | ||
| 93 | alignment: Alignment.bottomRight, | 101 | alignment: Alignment.bottomRight, |
| 94 | child: rightButtons, | 102 | child: rightButtons, |
| 95 | ), | 103 | ), | ... | ... |
| ... | @@ -31,24 +31,24 @@ class TikTokButtonColumn extends StatelessWidget { | ... | @@ -31,24 +31,24 @@ class TikTokButtonColumn extends StatelessWidget { |
| 31 | mainAxisAlignment: MainAxisAlignment.end, | 31 | mainAxisAlignment: MainAxisAlignment.end, |
| 32 | crossAxisAlignment: CrossAxisAlignment.end, | 32 | crossAxisAlignment: CrossAxisAlignment.end, |
| 33 | children: <Widget>[ | 33 | children: <Widget>[ |
| 34 | - Tapped( | 34 | + // Tapped( |
| 35 | - child: const TikTokAvatar(), | 35 | + // child: const TikTokAvatar(), |
| 36 | - onTap: onAvatar, | 36 | + // onTap: onAvatar, |
| 37 | - ), | 37 | + // ), |
| 38 | - FavoriteIcon( | 38 | + // FavoriteIcon( |
| 39 | - onFavorite: onFavorite, | 39 | + // onFavorite: onFavorite, |
| 40 | - isFavorite: isFavorite, | 40 | + // isFavorite: isFavorite, |
| 41 | - ), | 41 | + // ), |
| 42 | - _IconButton( | 42 | + // _IconButton( |
| 43 | - icon: const IconToText(Icons.mode_comment, size: SysSize.iconBig - 4), | 43 | + // icon: const IconToText(Icons.mode_comment, size: SysSize.iconBig - 4), |
| 44 | - text: '4213', | 44 | + // text: '4213', |
| 45 | - onTap: onComment, | 45 | + // onTap: onComment, |
| 46 | - ), | 46 | + // ), |
| 47 | - _IconButton( | 47 | + // _IconButton( |
| 48 | - icon: const IconToText(Icons.share, size: SysSize.iconBig), | 48 | + // icon: const IconToText(Icons.share, size: SysSize.iconBig), |
| 49 | - text: '346', | 49 | + // text: '346', |
| 50 | - onTap: onShare, | 50 | + // onTap: onShare, |
| 51 | - ), | 51 | + // ), |
| 52 | Container( | 52 | Container( |
| 53 | width: SysSize.avatar, | 53 | width: SysSize.avatar, |
| 54 | height: SysSize.avatar, | 54 | height: SysSize.avatar, | ... | ... |
-
Please register or login to post a comment