Showing
4 changed files
with
69 additions
and
75 deletions
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:one_poem/widgets/my_app_bar.dart'; | ||
| 2 | 3 | ||
| 3 | class PoemDetailPage extends StatefulWidget { | 4 | class PoemDetailPage extends StatefulWidget { |
| 4 | 5 | ||
| ... | @@ -16,7 +17,11 @@ class PoemDetailPage extends StatefulWidget { | ... | @@ -16,7 +17,11 @@ class PoemDetailPage extends StatefulWidget { |
| 16 | class _PoemDetailPageState extends State<PoemDetailPage>{ | 17 | class _PoemDetailPageState extends State<PoemDetailPage>{ |
| 17 | @override | 18 | @override |
| 18 | Widget build(BuildContext context) { | 19 | Widget build(BuildContext context) { |
| 19 | - // TODO: implement build | 20 | + return const Scaffold( |
| 20 | - throw UnimplementedError(); | 21 | + appBar: MyAppBar( |
| 22 | + title: '一言|译解|临境', | ||
| 23 | + ), | ||
| 24 | + body: Text("题 破山此后禅院"), | ||
| 25 | + ); | ||
| 21 | } | 26 | } |
| 22 | } | 27 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -10,6 +10,7 @@ import 'package:one_poem/tiktok/widgets/tiktok_scaffold.dart'; | ... | @@ -10,6 +10,7 @@ import 'package:one_poem/tiktok/widgets/tiktok_scaffold.dart'; |
| 10 | import 'package:one_poem/tiktok/widgets/tiktok_top_info.dart'; | 10 | import 'package:one_poem/tiktok/widgets/tiktok_top_info.dart'; |
| 11 | import 'package:one_poem/tiktok/widgets/tiktok_video.dart'; | 11 | import 'package:one_poem/tiktok/widgets/tiktok_video.dart'; |
| 12 | import 'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart'; | 12 | import 'package:one_poem/tiktok/widgets/tiktok_video_button_column.dart'; |
| 13 | +import 'package:one_poem/tiktok/widgets/tiktok_video_poem.dart'; | ||
| 13 | import 'package:video_player/video_player.dart'; | 14 | import 'package:video_player/video_player.dart'; |
| 14 | 15 | ||
| 15 | class PoemPage extends StatefulWidget { | 16 | class PoemPage extends StatefulWidget { |
| ... | @@ -20,12 +21,12 @@ class PoemPage extends StatefulWidget { | ... | @@ -20,12 +21,12 @@ class PoemPage extends StatefulWidget { |
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | 23 | class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 23 | - | ||
| 24 | TikTokScaffoldController tkController = TikTokScaffoldController(); | 24 | TikTokScaffoldController tkController = TikTokScaffoldController(); |
| 25 | 25 | ||
| 26 | final PageController _pageController = PageController(); | 26 | final PageController _pageController = PageController(); |
| 27 | 27 | ||
| 28 | - final TikTokVideoListController _videoListController = TikTokVideoListController(); | 28 | + final TikTokVideoListController _videoListController = |
| 29 | + TikTokVideoListController(); | ||
| 29 | 30 | ||
| 30 | /// 记录点赞 | 31 | /// 记录点赞 |
| 31 | Map<int, bool> favoriteMap = {}; | 32 | Map<int, bool> favoriteMap = {}; |
| ... | @@ -118,7 +119,6 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -118,7 +119,6 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 118 | rightPage: userPage, | 119 | rightPage: userPage, |
| 119 | enableGesture: true, | 120 | enableGesture: true, |
| 120 | page: Stack( | 121 | page: Stack( |
| 121 | - // index: currentPage == null ? 0 : 1, | ||
| 122 | children: <Widget>[ | 122 | children: <Widget>[ |
| 123 | PageView.builder( | 123 | PageView.builder( |
| 124 | key: const Key('home'), | 124 | key: const Key('home'), |
| ... | @@ -137,15 +137,14 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -137,15 +137,14 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 137 | tkController.animateToPage(TikTokPagePosition.right); | 137 | tkController.animateToPage(TikTokPagePosition.right); |
| 138 | }, | 138 | }, |
| 139 | onFavorite: () { | 139 | onFavorite: () { |
| 140 | - setState(() { | 140 | + setState(() {}); |
| 141 | - }); | ||
| 142 | - // showAboutDialog(context: context); | ||
| 143 | }, | 141 | }, |
| 144 | onShare: () {}, | 142 | onShare: () {}, |
| 145 | ); | 143 | ); |
| 146 | - Widget topInfo = const TikTokTopInfoColumn( | 144 | + Widget poem = const TikTokVidePoem( |
| 147 | - info: "早安" | 145 | + desc: "清晨入古寺,初日照高林。\n竹径通幽处,禅房花木深。", |
| 148 | ); | 146 | ); |
| 147 | + Widget topInfo = const TikTokTopInfoColumn(info: "早安"); | ||
| 149 | // video | 148 | // video |
| 150 | Widget currentVideo = Center( | 149 | Widget currentVideo = Center( |
| 151 | child: AspectRatio( | 150 | child: AspectRatio( |
| ... | @@ -161,10 +160,6 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -161,10 +160,6 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 161 | key: Key(data.url + '$i'), | 160 | key: Key(data.url + '$i'), |
| 162 | tag: data.url, | 161 | tag: data.url, |
| 163 | bottomPadding: hasBottomPadding ? 16.0 : 16.0, | 162 | bottomPadding: hasBottomPadding ? 16.0 : 16.0, |
| 164 | - userInfoWidget: VideoUserInfo( | ||
| 165 | - desc: data.desc, | ||
| 166 | - bottomPadding: hasBottomPadding ? 16.0 : 50.0, | ||
| 167 | - ), | ||
| 168 | onSingleTap: () async { | 163 | onSingleTap: () async { |
| 169 | if (player.controller.value.isPlaying) { | 164 | if (player.controller.value.isPlaying) { |
| 170 | await player.pause(); | 165 | await player.pause(); |
| ... | @@ -179,6 +174,7 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -179,6 +174,7 @@ class _PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 179 | }); | 174 | }); |
| 180 | }, | 175 | }, |
| 181 | rightButtonColumn: buttons, | 176 | rightButtonColumn: buttons, |
| 177 | + leftPoemArea: poem, | ||
| 182 | topInfo: topInfo, | 178 | topInfo: topInfo, |
| 183 | video: currentVideo, | 179 | video: currentVideo, |
| 184 | ); | 180 | ); | ... | ... |
| ... | @@ -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? leftPoemArea; | ||
| 21 | final Widget? topInfo; | 22 | final Widget? topInfo; |
| 22 | final Widget? userInfoWidget; | 23 | final Widget? userInfoWidget; |
| 23 | 24 | ||
| ... | @@ -38,16 +39,13 @@ class TikTokVideoPage extends StatelessWidget { | ... | @@ -38,16 +39,13 @@ class TikTokVideoPage extends StatelessWidget { |
| 38 | this.video, | 39 | this.video, |
| 39 | this.aspectRatio = 9 / 16.0, | 40 | this.aspectRatio = 9 / 16.0, |
| 40 | this.hidePauseIcon = false, | 41 | this.hidePauseIcon = false, |
| 42 | + this.leftPoemArea, | ||
| 41 | }) : super(key: key); | 43 | }) : super(key: key); |
| 42 | @override | 44 | @override |
| 43 | Widget build(BuildContext context) { | 45 | Widget build(BuildContext context) { |
| 44 | // 右边的按钮列表 | 46 | // 右边的按钮列表 |
| 45 | Widget rightButtons = rightButtonColumn ?? Container(); | 47 | Widget rightButtons = rightButtonColumn ?? Container(); |
| 46 | - // 用户信息 | 48 | + Widget leftPoem = leftPoemArea ?? Container(); |
| 47 | - Widget userInfo = userInfoWidget ?? | ||
| 48 | - VideoUserInfo( | ||
| 49 | - bottomPadding: bottomPadding, | ||
| 50 | - ); | ||
| 51 | // 视频加载的动画 | 49 | // 视频加载的动画 |
| 52 | // Widget videoLoading = VideoLoadingPlaceHolder(tag: tag); | 50 | // Widget videoLoading = VideoLoadingPlaceHolder(tag: tag); |
| 53 | // 视频播放页 | 51 | // 视频播放页 |
| ... | @@ -98,14 +96,14 @@ class TikTokVideoPage extends StatelessWidget { | ... | @@ -98,14 +96,14 @@ class TikTokVideoPage extends StatelessWidget { |
| 98 | Container( | 96 | Container( |
| 99 | height: double.infinity, | 97 | height: double.infinity, |
| 100 | width: double.infinity, | 98 | width: double.infinity, |
| 101 | - alignment: Alignment.bottomRight, | 99 | + alignment: Alignment.bottomLeft, |
| 102 | - child: rightButtons, | 100 | + child: leftPoem, |
| 103 | ), | 101 | ), |
| 104 | Container( | 102 | Container( |
| 105 | height: double.infinity, | 103 | height: double.infinity, |
| 106 | width: double.infinity, | 104 | width: double.infinity, |
| 107 | - alignment: Alignment.bottomLeft, | 105 | + alignment: Alignment.bottomRight, |
| 108 | - child: userInfo, | 106 | + child: rightButtons, |
| 109 | ), | 107 | ), |
| 110 | ], | 108 | ], |
| 111 | ); | 109 | ); |
| ... | @@ -152,55 +150,3 @@ class VideoLoadingPlaceHolder extends StatelessWidget { | ... | @@ -152,55 +150,3 @@ class VideoLoadingPlaceHolder extends StatelessWidget { |
| 152 | ); | 150 | ); |
| 153 | } | 151 | } |
| 154 | } | 152 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 155 | - | ||
| 156 | -class VideoUserInfo extends StatelessWidget { | ||
| 157 | - final String? desc; | ||
| 158 | - // final Function onGoodGift; | ||
| 159 | - const VideoUserInfo({ | ||
| 160 | - Key? key, | ||
| 161 | - required this.bottomPadding, | ||
| 162 | - // @required this.onGoodGift, | ||
| 163 | - this.desc, | ||
| 164 | - }) : super(key: key); | ||
| 165 | - | ||
| 166 | - final double bottomPadding; | ||
| 167 | - | ||
| 168 | - @override | ||
| 169 | - Widget build(BuildContext context) { | ||
| 170 | - return Container( | ||
| 171 | - padding: EdgeInsets.only( | ||
| 172 | - left: 12, | ||
| 173 | - bottom: bottomPadding, | ||
| 174 | - ), | ||
| 175 | - margin: const EdgeInsets.only(right: 80), | ||
| 176 | - child: Column( | ||
| 177 | - mainAxisAlignment: MainAxisAlignment.end, | ||
| 178 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 179 | - children: <Widget>[ | ||
| 180 | - const Text( | ||
| 181 | - '每日一言', | ||
| 182 | - style: StandardTextStyle.big, | ||
| 183 | - ), | ||
| 184 | - Container(height: 6), | ||
| 185 | - Text( | ||
| 186 | - desc ?? '#一言 临境', | ||
| 187 | - style: StandardTextStyle.normal, | ||
| 188 | - ), | ||
| 189 | - Container(height: 6), | ||
| 190 | - Row( | ||
| 191 | - children: const <Widget>[ | ||
| 192 | - // Icon(Icons.music_note, size: 14), | ||
| 193 | - Expanded( | ||
| 194 | - child: Text( | ||
| 195 | - '宜 · 安静/看书/喝茶', | ||
| 196 | - maxLines: 9, | ||
| 197 | - style: StandardTextStyle.normal, | ||
| 198 | - ), | ||
| 199 | - ) | ||
| 200 | - ], | ||
| 201 | - ) | ||
| 202 | - ], | ||
| 203 | - ), | ||
| 204 | - ); | ||
| 205 | - } | ||
| 206 | -} | ... | ... |
lib/tiktok/widgets/tiktok_video_poem.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_poem/tiktok/style/style.dart'; | ||
| 3 | + | ||
| 4 | +class TikTokVidePoem extends StatelessWidget { | ||
| 5 | + final double? bottomPadding; | ||
| 6 | + final Function? onShowDetail; | ||
| 7 | + final String? desc; | ||
| 8 | + const TikTokVidePoem({ | ||
| 9 | + Key? key, | ||
| 10 | + this.bottomPadding, | ||
| 11 | + this.onShowDetail, | ||
| 12 | + this.desc, | ||
| 13 | + }) : super(key: key); | ||
| 14 | + | ||
| 15 | + @override | ||
| 16 | + Widget build(BuildContext context) { | ||
| 17 | + return Container( | ||
| 18 | + width: SysSize.avatar, | ||
| 19 | + margin: EdgeInsets.only( | ||
| 20 | + bottom: bottomPadding ?? 50, | ||
| 21 | + right: 12, | ||
| 22 | + ), | ||
| 23 | + child: Column( | ||
| 24 | + mainAxisAlignment: MainAxisAlignment.end, | ||
| 25 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 26 | + children: <Widget>[ | ||
| 27 | + InkWell( | ||
| 28 | + child: Text( | ||
| 29 | + desc ?? '#一言 临境', | ||
| 30 | + style: StandardTextStyle.normal, | ||
| 31 | + ), | ||
| 32 | + onTap: (){}, | ||
| 33 | + ), | ||
| 34 | + Container( | ||
| 35 | + width: SysSize.avatar, | ||
| 36 | + height: SysSize.avatar, | ||
| 37 | + margin: const EdgeInsets.only(top: 10), | ||
| 38 | + decoration: BoxDecoration( | ||
| 39 | + borderRadius: BorderRadius.circular(SysSize.avatar / 2.0), | ||
| 40 | + // color: Colors.black.withOpacity(0.8), | ||
| 41 | + ), | ||
| 42 | + ) | ||
| 43 | + ], | ||
| 44 | + ), | ||
| 45 | + ); | ||
| 46 | + } | ||
| 47 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment