Showing
6 changed files
with
268 additions
and
122 deletions
| ... | @@ -287,7 +287,7 @@ class AccountPageState extends State<AccountPage> { | ... | @@ -287,7 +287,7 @@ class AccountPageState extends State<AccountPage> { |
| 287 | children: <Widget>[ | 287 | children: <Widget>[ |
| 288 | InkWell( | 288 | InkWell( |
| 289 | onTap: () { | 289 | onTap: () { |
| 290 | - NavigatorUtils.push(context, Routes.home, | 290 | + NavigatorUtils.push(context, Routes.navBarPage, |
| 291 | clearStack: true); | 291 | clearStack: true); |
| 292 | }, | 292 | }, |
| 293 | child: Container( | 293 | child: Container( |
| ... | @@ -298,7 +298,7 @@ class AccountPageState extends State<AccountPage> { | ... | @@ -298,7 +298,7 @@ class AccountPageState extends State<AccountPage> { |
| 298 | .onePoemBottomNavigationBarItemTitle, | 298 | .onePoemBottomNavigationBarItemTitle, |
| 299 | style: const TextStyle( | 299 | style: const TextStyle( |
| 300 | color: Colors.white54, | 300 | color: Colors.white54, |
| 301 | - fontSize: 15.0, | 301 | + fontSize: 20.0, |
| 302 | ), | 302 | ), |
| 303 | ), | 303 | ), |
| 304 | ), | 304 | ), |
| ... | @@ -313,7 +313,7 @@ class AccountPageState extends State<AccountPage> { | ... | @@ -313,7 +313,7 @@ class AccountPageState extends State<AccountPage> { |
| 313 | .profileBottomNavigationBarItemTitle, | 313 | .profileBottomNavigationBarItemTitle, |
| 314 | style: const TextStyle( | 314 | style: const TextStyle( |
| 315 | color: Colors.white54, | 315 | color: Colors.white54, |
| 316 | - fontSize: 15.0, | 316 | + fontSize: 20.0, |
| 317 | ), | 317 | ), |
| 318 | ), | 318 | ), |
| 319 | ), | 319 | ), | ... | ... |
| 1 | +import 'dart:async'; | ||
| 2 | + | ||
| 1 | import 'package:Parlando/poem/components/video_slides.dart'; | 3 | import 'package:Parlando/poem/components/video_slides.dart'; |
| 2 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 5 | +import 'package:getwidget/getwidget.dart'; | ||
| 6 | + | ||
| 7 | +import '../category/category_router.dart'; | ||
| 8 | +import '../events/trans_event.dart'; | ||
| 9 | +import '../net/dio_utils.dart'; | ||
| 10 | +import '../net/http_api.dart'; | ||
| 11 | +import '../routers/fluro_navigator.dart'; | ||
| 12 | +import 'package:flutter_easy_permission/easy_permissions.dart'; | ||
| 13 | + | ||
| 14 | +import '../util/toast_utils.dart'; | ||
| 15 | +import 'models/home_entity.dart'; | ||
| 3 | 16 | ||
| 4 | class Home extends StatefulWidget { | 17 | class Home extends StatefulWidget { |
| 5 | const Home({Key? key}) : super(key: key); | 18 | const Home({Key? key}) : super(key: key); |
| ... | @@ -8,9 +21,43 @@ class Home extends StatefulWidget { | ... | @@ -8,9 +21,43 @@ class Home extends StatefulWidget { |
| 8 | HomeState createState() => HomeState(); | 21 | HomeState createState() => HomeState(); |
| 9 | } | 22 | } |
| 10 | 23 | ||
| 11 | -class HomeState extends State<Home> { | 24 | +class HomeState extends State<Home> with WidgetsBindingObserver { |
| 12 | final PageController _controller = PageController(); | 25 | final PageController _controller = PageController(); |
| 13 | 26 | ||
| 27 | + bool isLoading = false; | ||
| 28 | + int currentId = 0; | ||
| 29 | + int currentPage = 0; | ||
| 30 | + String currentPoemId = ''; | ||
| 31 | + String currentPoemType = ''; | ||
| 32 | + bool isFav = false; | ||
| 33 | + bool isPraise = false; | ||
| 34 | + bool isSharing = false; | ||
| 35 | + | ||
| 36 | + late StreamSubscription bus; | ||
| 37 | + List<Widget> videos = []; | ||
| 38 | + | ||
| 39 | + static const permissions = [ | ||
| 40 | + Permissions.CAMERA, | ||
| 41 | + Permissions.READ_EXTERNAL_STORAGE, | ||
| 42 | + Permissions.RECORD_AUDIO, | ||
| 43 | + Permissions.WRITE_EXTERNAL_STORAGE | ||
| 44 | + ]; | ||
| 45 | + static const permissionGroup = [ | ||
| 46 | + PermissionGroup.Camera, | ||
| 47 | + PermissionGroup.Camera, | ||
| 48 | + PermissionGroup.Microphone | ||
| 49 | + ]; | ||
| 50 | + | ||
| 51 | + late FlutterEasyPermission _easyPermission; | ||
| 52 | + | ||
| 53 | + @override | ||
| 54 | + void dispose() { | ||
| 55 | + WidgetsBinding.instance.removeObserver(this); | ||
| 56 | + bus.cancel(); | ||
| 57 | + _easyPermission.dispose(); | ||
| 58 | + super.dispose(); | ||
| 59 | + } | ||
| 60 | + | ||
| 14 | @override | 61 | @override |
| 15 | void initState() { | 62 | void initState() { |
| 16 | super.initState(); | 63 | super.initState(); |
| ... | @@ -21,43 +68,111 @@ class HomeState extends State<Home> { | ... | @@ -21,43 +68,111 @@ class HomeState extends State<Home> { |
| 21 | _getMore(); | 68 | _getMore(); |
| 22 | } | 69 | } |
| 23 | }); | 70 | }); |
| 71 | + | ||
| 72 | + FlutterEasyPermission.has(perms: permissions, permsGroup: permissionGroup) | ||
| 73 | + .then((value) { | ||
| 74 | + if (value) { | ||
| 75 | + FlutterEasyPermission.request( | ||
| 76 | + perms: permissions, | ||
| 77 | + permsGroup: permissionGroup, | ||
| 78 | + rationale: "需要使用如下权限"); | ||
| 79 | + } | ||
| 80 | + }); | ||
| 81 | + _easyPermission = FlutterEasyPermission() | ||
| 82 | + ..addPermissionCallback(onGranted: (requestCode, perms, perm) { | ||
| 83 | + debugPrint("android获得授权:$perms"); | ||
| 84 | + debugPrint("iOS获得授权:$perm"); | ||
| 85 | + }, onDenied: (requestCode, perms, perm, isPermanent) { | ||
| 86 | + if (isPermanent) { | ||
| 87 | + FlutterEasyPermission.showAppSettingsDialog(title: "Camera"); | ||
| 88 | + } else { | ||
| 89 | + debugPrint("android授权失败:$perms"); | ||
| 90 | + debugPrint("iOS授权失败:$perm"); | ||
| 91 | + } | ||
| 92 | + }, onSettingsReturned: () { | ||
| 93 | + FlutterEasyPermission.has(perms: permissions, permsGroup: []).then( | ||
| 94 | + (value) => value | ||
| 95 | + ? debugPrint("已获得授权:$permissions") | ||
| 96 | + : debugPrint("未获得授权:$permissions")); | ||
| 97 | + }); | ||
| 98 | + _onRefresh(); | ||
| 24 | } | 99 | } |
| 25 | 100 | ||
| 26 | /// 下拉刷新方法,为list重新赋值 | 101 | /// 下拉刷新方法,为list重新赋值 |
| 27 | Future<void> _onRefresh() async { | 102 | Future<void> _onRefresh() async { |
| 28 | - await Future.delayed(const Duration(seconds: 1), () { | 103 | + isLoading = true; |
| 29 | - print('refresh'); | 104 | + currentPage = 0; |
| 30 | - setState(() {}); | 105 | + DioUtils.instance.asyncRequestNetwork<HomeEntity>( |
| 31 | - }); | 106 | + Method.get, |
| 107 | + HttpApi.home, | ||
| 108 | + params: {'page_size': 80}, | ||
| 109 | + onSuccess: (data) { | ||
| 110 | + isLoading = false; | ||
| 111 | + videos.clear(); | ||
| 112 | + for (HomeData data in data!.data!) { | ||
| 113 | + videos.add(VideoSlides( | ||
| 114 | + poemId: data.poemId!, | ||
| 115 | + poemType: data.type!, | ||
| 116 | + url: data.url!, | ||
| 117 | + )); | ||
| 118 | + } | ||
| 119 | + setState(() {}); | ||
| 120 | + | ||
| 121 | + bus = eventBus.on<TransEvent>().listen((event) {}); | ||
| 122 | + }, | ||
| 123 | + onError: (code, msg) { | ||
| 124 | + Toast.show("获取数据失败,请稍候再试..."); | ||
| 125 | + isLoading = false; | ||
| 126 | + }, | ||
| 127 | + ); | ||
| 32 | } | 128 | } |
| 33 | 129 | ||
| 34 | /// 上拉加载更多 | 130 | /// 上拉加载更多 |
| 35 | Future<void> _getMore() async { | 131 | Future<void> _getMore() async { |
| 36 | - await Future.delayed(const Duration(seconds: 1), () { | 132 | + currentPage += 1; |
| 37 | - print('_getMore'); | 133 | + isLoading = true; |
| 38 | - setState(() {}); | 134 | + DioUtils.instance.asyncRequestNetwork<HomeEntity>( |
| 39 | - }); | 135 | + Method.get, |
| 136 | + HttpApi.home, | ||
| 137 | + params: {'page_size': 80, 'page': currentPage}, | ||
| 138 | + onSuccess: (data) { | ||
| 139 | + isLoading = false; | ||
| 140 | + | ||
| 141 | + for (HomeData data in data!.data!) { | ||
| 142 | + videos.add(VideoSlides( | ||
| 143 | + poemId: data.poemId!, | ||
| 144 | + poemType: data.type!, | ||
| 145 | + url: data.url!, | ||
| 146 | + )); | ||
| 147 | + } | ||
| 148 | + setState(() {}); | ||
| 149 | + | ||
| 150 | + bus = eventBus.on<TransEvent>().listen((event) {}); | ||
| 151 | + }, | ||
| 152 | + onError: (code, msg) { | ||
| 153 | + Toast.show("获取数据失败,请稍候再试..."); | ||
| 154 | + isLoading = false; | ||
| 155 | + }, | ||
| 156 | + ); | ||
| 40 | } | 157 | } |
| 41 | 158 | ||
| 42 | @override | 159 | @override |
| 43 | Widget build(BuildContext context) { | 160 | Widget build(BuildContext context) { |
| 44 | return Stack( | 161 | return Stack( |
| 45 | children: [ | 162 | children: [ |
| 46 | - RefreshIndicator( | 163 | + isLoading |
| 47 | - //下拉刷新触发方法 | 164 | + ? const GFLoader() |
| 48 | - onRefresh: _onRefresh, | 165 | + : RefreshIndicator( |
| 49 | - //设置listView | 166 | + //下拉刷新触发方法 |
| 50 | - child: PageView( | 167 | + onRefresh: _onRefresh, |
| 51 | - controller: _controller, | 168 | + //设置listView |
| 52 | - //设置滑动方向 | 169 | + child: PageView( |
| 53 | - scrollDirection: Axis.vertical, | 170 | + controller: _controller, |
| 54 | - children: const [ | 171 | + //设置滑动方向 |
| 55 | - VideoSlides(), | 172 | + scrollDirection: Axis.vertical, |
| 56 | - VideoSlides(), | 173 | + children: videos, |
| 57 | - VideoSlides(), | 174 | + ), |
| 58 | - ], | 175 | + ), |
| 59 | - ), | ||
| 60 | - ), | ||
| 61 | Positioned( | 176 | Positioned( |
| 62 | top: 18.0, | 177 | top: 18.0, |
| 63 | left: 10.0, | 178 | left: 10.0, |
| ... | @@ -81,7 +196,12 @@ class HomeState extends State<Home> { | ... | @@ -81,7 +196,12 @@ class HomeState extends State<Home> { |
| 81 | style: TextStyle(color: Colors.white), | 196 | style: TextStyle(color: Colors.white), |
| 82 | ), | 197 | ), |
| 83 | TextButton( | 198 | TextButton( |
| 84 | - onPressed: () {}, | 199 | + onPressed: () { |
| 200 | + NavigatorUtils.push( | ||
| 201 | + context, | ||
| 202 | + CategoryRouter.categoryPage, | ||
| 203 | + ); | ||
| 204 | + }, | ||
| 85 | child: const Text( | 205 | child: const Text( |
| 86 | "妙众", | 206 | "妙众", |
| 87 | style: TextStyle( | 207 | style: TextStyle( | ... | ... |
| 1 | import 'package:Parlando/account/page/account_page.dart'; | 1 | import 'package:Parlando/account/page/account_page.dart'; |
| 2 | import 'package:Parlando/home/home_page.dart'; | 2 | import 'package:Parlando/home/home_page.dart'; |
| 3 | import 'package:Parlando/poem/theme/tik_theme.dart'; | 3 | import 'package:Parlando/poem/theme/tik_theme.dart'; |
| 4 | +import 'package:animated_radial_menu/animated_radial_menu.dart'; | ||
| 4 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
| 6 | +import 'package:flutter_gen/gen_l10n/Parlando_localizations.dart'; | ||
| 7 | +import 'package:provider/provider.dart'; | ||
| 8 | + | ||
| 9 | +import '../../account/account_router.dart'; | ||
| 10 | +import '../../events/trans_event.dart'; | ||
| 11 | +import '../../routers/fluro_navigator.dart'; | ||
| 12 | +import '../../routers/routers.dart'; | ||
| 5 | 13 | ||
| 6 | class NavBarPage extends StatefulWidget { | 14 | class NavBarPage extends StatefulWidget { |
| 7 | const NavBarPage({Key? key, required this.initialPage}) : super(key: key); | 15 | const NavBarPage({Key? key, required this.initialPage}) : super(key: key); |
| ... | @@ -31,46 +39,77 @@ class NavBarPageState extends State<NavBarPage> { | ... | @@ -31,46 +39,77 @@ class NavBarPageState extends State<NavBarPage> { |
| 31 | }; | 39 | }; |
| 32 | return Scaffold( | 40 | return Scaffold( |
| 33 | body: tabs[_currentPage], | 41 | body: tabs[_currentPage], |
| 34 | - bottomNavigationBar: BottomNavigationBar( | 42 | + bottomNavigationBar: Consumer( |
| 35 | - items: const <BottomNavigationBarItem>[ | 43 | + builder: (_, provider, __) { |
| 36 | - BottomNavigationBarItem( | 44 | + return BottomAppBar( |
| 37 | - icon: Icon( | 45 | + color: Colors.grey, |
| 38 | - Icons.home_filled, | 46 | + child: Row( |
| 39 | - size: 24, | 47 | + mainAxisSize: MainAxisSize.max, |
| 40 | - ), | 48 | + mainAxisAlignment: MainAxisAlignment.spaceAround, |
| 41 | - label: 'Home', | 49 | + children: <Widget>[ |
| 42 | - tooltip: '', | 50 | + InkWell( |
| 43 | - ), | 51 | + onTap: () { |
| 44 | - BottomNavigationBarItem( | 52 | + NavigatorUtils.push(context, Routes.navBarPage, |
| 45 | - icon: Icon( | 53 | + clearStack: true); |
| 46 | - Icons.add_circle_outline_rounded, | 54 | + }, |
| 47 | - size: 50, | 55 | + child: Container( |
| 48 | - ), | 56 | + alignment: Alignment.center, |
| 49 | - activeIcon: Icon( | 57 | + height: 36.0, |
| 50 | - Icons.add_circle_rounded, | 58 | + child: Text( |
| 51 | - size: 50, | 59 | + ParlandoLocalizations.of(context) |
| 52 | - ), | 60 | + .onePoemBottomNavigationBarItemTitle, |
| 53 | - label: '', | 61 | + style: const TextStyle( |
| 54 | - tooltip: '', | 62 | + color: Colors.white54, |
| 55 | - ), | 63 | + fontSize: 20.0, |
| 56 | - BottomNavigationBarItem( | 64 | + ), |
| 57 | - icon: Icon( | 65 | + ), |
| 58 | - Icons.person_rounded, | 66 | + ), |
| 59 | - size: 26, | 67 | + ), |
| 60 | - ), | 68 | + InkWell( |
| 61 | - label: 'Profile', | 69 | + onTap: () { |
| 62 | - tooltip: '', | 70 | + eventBus.fire(TransEvent()); |
| 63 | - ) | 71 | + NavigatorUtils.push( |
| 64 | - ], | 72 | + context, |
| 65 | - backgroundColor: TikTheme.tertiaryColor, | 73 | + AccountRouter.accountPage, |
| 66 | - currentIndex: tabs.keys.toList().indexOf(_currentPage), | 74 | + ); |
| 67 | - selectedItemColor: TikTheme.primaryColor, | 75 | + }, |
| 68 | - unselectedItemColor: const Color(0x53FFFFFF), | 76 | + child: Container( |
| 69 | - onTap: (i) => setState(() => _currentPage = tabs.keys.toList()[i]), | 77 | + alignment: Alignment.center, |
| 70 | - showSelectedLabels: true, | 78 | + height: 36.0, |
| 71 | - showUnselectedLabels: true, | 79 | + child: Text( |
| 72 | - type: BottomNavigationBarType.fixed, | 80 | + ParlandoLocalizations.of(context) |
| 81 | + .profileBottomNavigationBarItemTitle, | ||
| 82 | + style: const TextStyle( | ||
| 83 | + color: Colors.white54, | ||
| 84 | + fontSize: 20.0, | ||
| 85 | + ), | ||
| 86 | + ), | ||
| 87 | + ), | ||
| 88 | + ), | ||
| 89 | + ]), | ||
| 90 | + ); | ||
| 91 | + }, | ||
| 92 | + ), | ||
| 93 | + floatingActionButton: SizedBox( | ||
| 94 | + height: 60, | ||
| 95 | + child: RadialMenu( | ||
| 96 | + children: [ | ||
| 97 | + RadialButton( | ||
| 98 | + icon: const Icon(Icons.video_call_outlined), | ||
| 99 | + buttonColor: Colors.teal, | ||
| 100 | + onPress: () { | ||
| 101 | + eventBus.fire(TransEvent()); | ||
| 102 | + }), | ||
| 103 | + RadialButton( | ||
| 104 | + icon: const Icon(Icons.mic_none_outlined), | ||
| 105 | + buttonColor: Colors.green, | ||
| 106 | + onPress: () { | ||
| 107 | + eventBus.fire(TransEvent()); | ||
| 108 | + }), | ||
| 109 | + ], | ||
| 110 | + ), | ||
| 73 | ), | 111 | ), |
| 112 | + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, | ||
| 74 | ); | 113 | ); |
| 75 | } | 114 | } |
| 76 | } | 115 | } | ... | ... |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:getwidget/getwidget.dart'; | ||
| 2 | import 'package:share_plus/share_plus.dart'; | 3 | import 'package:share_plus/share_plus.dart'; |
| 3 | - | ||
| 4 | -import '../theme/tik_theme.dart'; | ||
| 5 | import '../theme/tik_video_player.dart'; | 4 | import '../theme/tik_video_player.dart'; |
| 6 | 5 | ||
| 7 | class VideoSlides extends StatefulWidget { | 6 | class VideoSlides extends StatefulWidget { |
| 8 | - const VideoSlides({Key? key}) : super(key: key); | 7 | + const VideoSlides({ |
| 8 | + Key? key, | ||
| 9 | + required this.poemId, | ||
| 10 | + required this.poemType, | ||
| 11 | + required this.url, | ||
| 12 | + this.isPraise = false, | ||
| 13 | + this.isCollect = false, | ||
| 14 | + }) : super(key: key); | ||
| 15 | + final int poemId; | ||
| 16 | + final int poemType; | ||
| 17 | + final String url; | ||
| 18 | + final bool isPraise; | ||
| 19 | + final bool isCollect; | ||
| 9 | 20 | ||
| 10 | @override | 21 | @override |
| 11 | VideoSlidesState createState() => VideoSlidesState(); | 22 | VideoSlidesState createState() => VideoSlidesState(); |
| ... | @@ -29,8 +40,8 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -29,8 +40,8 @@ class VideoSlidesState extends State<VideoSlides> { |
| 29 | color: Colors.black, | 40 | color: Colors.black, |
| 30 | ), | 41 | ), |
| 31 | child: TikVideoPlayer( | 42 | child: TikVideoPlayer( |
| 32 | - path: 'assets/video/1656599376238999.mp4', | 43 | + path: widget.url, |
| 33 | - videoType: VideoType.asset, | 44 | + videoType: VideoType.network, |
| 34 | width: MediaQuery.of(context).size.width, | 45 | width: MediaQuery.of(context).size.width, |
| 35 | height: MediaQuery.of(context).size.height * 1, | 46 | height: MediaQuery.of(context).size.height * 1, |
| 36 | autoPlay: true, | 47 | autoPlay: true, |
| ... | @@ -50,8 +61,8 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -50,8 +61,8 @@ class VideoSlidesState extends State<VideoSlides> { |
| 50 | mainAxisAlignment: MainAxisAlignment.center, | 61 | mainAxisAlignment: MainAxisAlignment.center, |
| 51 | children: [ | 62 | children: [ |
| 52 | Container( | 63 | Container( |
| 53 | - width: 70, | 64 | + width: 60, |
| 54 | - height: 330, | 65 | + height: 240, |
| 55 | decoration: const BoxDecoration( | 66 | decoration: const BoxDecoration( |
| 56 | color: Color(0x4DC4C4C4), | 67 | color: Color(0x4DC4C4C4), |
| 57 | borderRadius: BorderRadius.only( | 68 | borderRadius: BorderRadius.only( |
| ... | @@ -80,8 +91,8 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -80,8 +91,8 @@ class VideoSlidesState extends State<VideoSlides> { |
| 80 | padding: const EdgeInsetsDirectional.fromSTEB( | 91 | padding: const EdgeInsetsDirectional.fromSTEB( |
| 81 | 0, 20, 0, 0), | 92 | 0, 20, 0, 0), |
| 82 | child: Container( | 93 | child: Container( |
| 83 | - width: 50, | 94 | + width: 40, |
| 84 | - height: 50, | 95 | + height: 40, |
| 85 | decoration: const BoxDecoration( | 96 | decoration: const BoxDecoration( |
| 86 | color: Color(0x69EEEEEE), | 97 | color: Color(0x69EEEEEE), |
| 87 | shape: BoxShape.circle, | 98 | shape: BoxShape.circle, |
| ... | @@ -89,19 +100,10 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -89,19 +100,10 @@ class VideoSlidesState extends State<VideoSlides> { |
| 89 | child: const Icon( | 100 | child: const Icon( |
| 90 | Icons.favorite_rounded, | 101 | Icons.favorite_rounded, |
| 91 | color: Colors.white, | 102 | color: Colors.white, |
| 92 | - size: 24, | 103 | + size: 20, |
| 93 | ), | 104 | ), |
| 94 | ), | 105 | ), |
| 95 | ), | 106 | ), |
| 96 | - Text( | ||
| 97 | - '121.9k', | ||
| 98 | - style: TikTheme.bodyText1.override( | ||
| 99 | - fontFamily: 'Poppins', | ||
| 100 | - color: Colors.white, | ||
| 101 | - fontSize: 16, | ||
| 102 | - fontWeight: FontWeight.w300, | ||
| 103 | - ), | ||
| 104 | - ), | ||
| 105 | ], | 107 | ], |
| 106 | ), | 108 | ), |
| 107 | ], | 109 | ], |
| ... | @@ -124,8 +126,8 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -124,8 +126,8 @@ class VideoSlidesState extends State<VideoSlides> { |
| 124 | child: InkWell( | 126 | child: InkWell( |
| 125 | onTap: () async {}, | 127 | onTap: () async {}, |
| 126 | child: Container( | 128 | child: Container( |
| 127 | - width: 50, | 129 | + width: 40, |
| 128 | - height: 50, | 130 | + height: 40, |
| 129 | decoration: const BoxDecoration( | 131 | decoration: const BoxDecoration( |
| 130 | color: Color(0x69EEEEEE), | 132 | color: Color(0x69EEEEEE), |
| 131 | shape: BoxShape.circle, | 133 | shape: BoxShape.circle, |
| ... | @@ -133,20 +135,11 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -133,20 +135,11 @@ class VideoSlidesState extends State<VideoSlides> { |
| 133 | child: const Icon( | 135 | child: const Icon( |
| 134 | Icons.star, | 136 | Icons.star, |
| 135 | color: Colors.white, | 137 | color: Colors.white, |
| 136 | - size: 34, | 138 | + size: 20, |
| 137 | ), | 139 | ), |
| 138 | ), | 140 | ), |
| 139 | ), | 141 | ), |
| 140 | ), | 142 | ), |
| 141 | - Text( | ||
| 142 | - '+8.5', | ||
| 143 | - style: TikTheme.bodyText1.override( | ||
| 144 | - fontFamily: 'Poppins', | ||
| 145 | - color: Colors.white, | ||
| 146 | - fontSize: 16, | ||
| 147 | - fontWeight: FontWeight.w300, | ||
| 148 | - ), | ||
| 149 | - ), | ||
| 150 | ], | 143 | ], |
| 151 | ), | 144 | ), |
| 152 | ], | 145 | ], |
| ... | @@ -172,36 +165,29 @@ class VideoSlidesState extends State<VideoSlides> { | ... | @@ -172,36 +165,29 @@ class VideoSlidesState extends State<VideoSlides> { |
| 172 | setState(() {}); | 165 | setState(() {}); |
| 173 | Future.delayed(const Duration(seconds: 3), | 166 | Future.delayed(const Duration(seconds: 3), |
| 174 | () async { | 167 | () async { |
| 175 | - setState(() => isSharing = false); | 168 | + setState(() => isSharing = false); |
| 176 | - await Share.share('Share Me'); | 169 | + await Share.share('一言以世界 临境不蹉跎'); |
| 177 | }); | 170 | }); |
| 178 | }, | 171 | }, |
| 179 | child: Container( | 172 | child: Container( |
| 180 | - width: 50, | 173 | + width: 40, |
| 181 | - height: 50, | 174 | + height: 40, |
| 182 | decoration: const BoxDecoration( | 175 | decoration: const BoxDecoration( |
| 183 | color: Color(0x69EEEEEE), | 176 | color: Color(0x69EEEEEE), |
| 184 | shape: BoxShape.circle, | 177 | shape: BoxShape.circle, |
| 185 | ), | 178 | ), |
| 186 | child: isSharing | 179 | child: isSharing |
| 187 | - ? const Text("I") | 180 | + ? const GFLoader( |
| 181 | + type: GFLoaderType.ios, | ||
| 182 | + ) | ||
| 188 | : const Icon( | 183 | : const Icon( |
| 189 | Icons.share_rounded, | 184 | Icons.share_rounded, |
| 190 | color: Colors.white, | 185 | color: Colors.white, |
| 191 | - size: 24, | 186 | + size: 20, |
| 192 | ), | 187 | ), |
| 193 | ), | 188 | ), |
| 194 | ), | 189 | ), |
| 195 | ), | 190 | ), |
| 196 | - Text( | ||
| 197 | - '分享', | ||
| 198 | - style: TikTheme.bodyText1.override( | ||
| 199 | - fontFamily: 'Poppins', | ||
| 200 | - color: Colors.white, | ||
| 201 | - fontSize: 16, | ||
| 202 | - fontWeight: FontWeight.w300, | ||
| 203 | - ), | ||
| 204 | - ), | ||
| 205 | ], | 191 | ], |
| 206 | ), | 192 | ), |
| 207 | ], | 193 | ], | ... | ... |
| ... | @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; | ... | @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; |
| 2 | import 'package:google_fonts/google_fonts.dart'; | 2 | import 'package:google_fonts/google_fonts.dart'; |
| 3 | 3 | ||
| 4 | class TikTheme { | 4 | class TikTheme { |
| 5 | - static const Color primaryColor = Color(0xFFE48900); | 5 | + static const Color primaryColor = Colors.grey; |
| 6 | - static const Color secondaryColor = Color(0xFF1C1C4F); | 6 | + static const Color secondaryColor = Colors.grey; |
| 7 | - static const Color tertiaryColor = Color(0xFF131B41); | 7 | + static const Color tertiaryColor = Colors.grey; |
| 8 | 8 | ||
| 9 | String primaryFontFamily = 'Poppins'; | 9 | String primaryFontFamily = 'Poppins'; |
| 10 | String secondaryFontFamily = 'Roboto'; | 10 | String secondaryFontFamily = 'Roboto'; | ... | ... |
| ... | @@ -42,18 +42,18 @@ class TikVideoPlayer extends StatefulWidget { | ... | @@ -42,18 +42,18 @@ class TikVideoPlayer extends StatefulWidget { |
| 42 | 42 | ||
| 43 | class _TikVideoPlayerState extends State<TikVideoPlayer> { | 43 | class _TikVideoPlayerState extends State<TikVideoPlayer> { |
| 44 | late VideoPlayerController _videoPlayerController; | 44 | late VideoPlayerController _videoPlayerController; |
| 45 | - late ChewieController _chewieController; | 45 | + ChewieController? _chewieController; |
| 46 | 46 | ||
| 47 | @override | 47 | @override |
| 48 | void initState() { | 48 | void initState() { |
| 49 | - super.initState(); | ||
| 50 | initializePlayer(); | 49 | initializePlayer(); |
| 50 | + super.initState(); | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | @override | 53 | @override |
| 54 | void dispose() { | 54 | void dispose() { |
| 55 | _videoPlayerController.dispose(); | 55 | _videoPlayerController.dispose(); |
| 56 | - _chewieController.dispose(); | 56 | + _chewieController!.dispose(); |
| 57 | super.dispose(); | 57 | super.dispose(); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| ... | @@ -67,7 +67,7 @@ class _TikVideoPlayerState extends State<TikVideoPlayer> { | ... | @@ -67,7 +67,7 @@ class _TikVideoPlayerState extends State<TikVideoPlayer> { |
| 67 | : widget.height; | 67 | : widget.height; |
| 68 | 68 | ||
| 69 | double get aspectRatio => | 69 | double get aspectRatio => |
| 70 | - _chewieController.videoPlayerController.value.aspectRatio; | 70 | + _chewieController!.videoPlayerController.value.aspectRatio; |
| 71 | 71 | ||
| 72 | Future initializePlayer() async { | 72 | Future initializePlayer() async { |
| 73 | _videoPlayerController = widget.videoType == VideoType.network | 73 | _videoPlayerController = widget.videoType == VideoType.network |
| ... | @@ -97,8 +97,9 @@ class _TikVideoPlayerState extends State<TikVideoPlayer> { | ... | @@ -97,8 +97,9 @@ class _TikVideoPlayerState extends State<TikVideoPlayer> { |
| 97 | child: SizedBox( | 97 | child: SizedBox( |
| 98 | height: height, | 98 | height: height, |
| 99 | width: width, | 99 | width: width, |
| 100 | - child: _chewieController.videoPlayerController.value.isInitialized | 100 | + child: _chewieController != null && |
| 101 | - ? Chewie(controller: _chewieController) | 101 | + _chewieController!.videoPlayerController.value.isInitialized |
| 102 | + ? Chewie(controller: _chewieController!) | ||
| 102 | : Column( | 103 | : Column( |
| 103 | mainAxisAlignment: MainAxisAlignment.center, | 104 | mainAxisAlignment: MainAxisAlignment.center, |
| 104 | children: const [ | 105 | children: const [ | ... | ... |
-
Please register or login to post a comment