Showing
8 changed files
with
145 additions
and
7 deletions
| ... | @@ -63,6 +63,17 @@ | ... | @@ -63,6 +63,17 @@ |
| 63 | <meta-data | 63 | <meta-data |
| 64 | android:name="com.facebook.sdk.ClientToken" | 64 | android:name="com.facebook.sdk.ClientToken" |
| 65 | android:value="@string/facebook_client_token" /> | 65 | android:value="@string/facebook_client_token" /> |
| 66 | + | ||
| 67 | + <provider | ||
| 68 | + android:name="androidx.core.content.FileProvider" | ||
| 69 | + android:authorities="${applicationId}.com.shekarmudaliyar.social_share" | ||
| 70 | + android:exported="false" | ||
| 71 | + android:grantUriPermissions="true" | ||
| 72 | + tools:replace="android:authorities"> | ||
| 73 | + <meta-data | ||
| 74 | + android:name="android.support.FILE_PROVIDER_PATHS" | ||
| 75 | + android:resource="@xml/filepaths" /> | ||
| 76 | + </provider> | ||
| 66 | </application> | 77 | </application> |
| 67 | 78 | ||
| 68 | <queries> | 79 | <queries> | ... | ... |
android/app/src/main/res/xml/filepaths.xml
0 → 100644
1.43 KB
1.41 KB
| ... | @@ -63,7 +63,7 @@ class _SplashPageState extends State<SplashPage> { | ... | @@ -63,7 +63,7 @@ class _SplashPageState extends State<SplashPage> { |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | ///创建 JPush | 65 | ///创建 JPush |
| 66 | - JPush jpush = new JPush(); | 66 | + JPush jpush = JPush(); |
| 67 | 67 | ||
| 68 | ///配置应用 Key | 68 | ///配置应用 Key |
| 69 | jpush.setup( | 69 | jpush.setup( |
| ... | @@ -74,6 +74,9 @@ class _SplashPageState extends State<SplashPage> { | ... | @@ -74,6 +74,9 @@ class _SplashPageState extends State<SplashPage> { |
| 74 | /// 设置是否打印 debug 日志 | 74 | /// 设置是否打印 debug 日志 |
| 75 | debug: true, | 75 | debug: true, |
| 76 | ); | 76 | ); |
| 77 | + jpush.applyPushAuthority( | ||
| 78 | + const NotificationSettingsIOS(sound: true, alert: true, badge: true), | ||
| 79 | + ); | ||
| 77 | } | 80 | } |
| 78 | 81 | ||
| 79 | @override | 82 | @override | ... | ... |
| 1 | import 'dart:async'; | 1 | import 'dart:async'; |
| 2 | +import 'dart:io'; | ||
| 3 | +import 'dart:typed_data'; | ||
| 2 | 4 | ||
| 3 | import 'package:Parlando/account/account_router.dart'; | 5 | import 'package:Parlando/account/account_router.dart'; |
| 4 | import 'package:Parlando/events/trans_event.dart'; | 6 | import 'package:Parlando/events/trans_event.dart'; |
| ... | @@ -23,8 +25,12 @@ import 'package:Parlando/tiktok/widgets/tiktok_video_button_column.dart'; | ... | @@ -23,8 +25,12 @@ import 'package:Parlando/tiktok/widgets/tiktok_video_button_column.dart'; |
| 23 | import 'package:Parlando/tiktok/widgets/tiktok_video_poem.dart'; | 25 | import 'package:Parlando/tiktok/widgets/tiktok_video_poem.dart'; |
| 24 | import 'package:Parlando/widgets/bars/home_types_bar.dart'; | 26 | import 'package:Parlando/widgets/bars/home_types_bar.dart'; |
| 25 | import 'package:Parlando/widgets/my_app_bar.dart'; | 27 | import 'package:Parlando/widgets/my_app_bar.dart'; |
| 28 | +import 'package:flutter/services.dart'; | ||
| 26 | import 'package:getwidget/getwidget.dart'; | 29 | import 'package:getwidget/getwidget.dart'; |
| 30 | +import 'package:path_provider/path_provider.dart'; | ||
| 27 | import 'package:provider/provider.dart'; | 31 | import 'package:provider/provider.dart'; |
| 32 | +import 'package:screenshot/screenshot.dart'; | ||
| 33 | +import 'package:social_share/social_share.dart'; | ||
| 28 | import 'package:video_player/video_player.dart'; | 34 | import 'package:video_player/video_player.dart'; |
| 29 | 35 | ||
| 30 | import 'poem_detail.dart'; | 36 | import 'poem_detail.dart'; |
| ... | @@ -48,6 +54,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -48,6 +54,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 48 | late StreamSubscription bus; | 54 | late StreamSubscription bus; |
| 49 | bool isLoading = false; | 55 | bool isLoading = false; |
| 50 | 56 | ||
| 57 | + int currentId = 0; | ||
| 51 | String currentPoemId = ''; | 58 | String currentPoemId = ''; |
| 52 | String currentPoemType = ''; | 59 | String currentPoemType = ''; |
| 53 | 60 | ||
| ... | @@ -97,6 +104,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -97,6 +104,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 97 | } | 104 | } |
| 98 | currentPoemId = videoDataList.first.poemId; | 105 | currentPoemId = videoDataList.first.poemId; |
| 99 | currentPoemType = videoDataList.first.poemType; | 106 | currentPoemType = videoDataList.first.poemType; |
| 107 | + currentId = videoDataList.first.id; | ||
| 100 | _videoListController.init( | 108 | _videoListController.init( |
| 101 | pageController: _pageController, | 109 | pageController: _pageController, |
| 102 | initialList: videoDataList | 110 | initialList: videoDataList |
| ... | @@ -157,7 +165,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -157,7 +165,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 157 | Widget? currentPage; | 165 | Widget? currentPage; |
| 158 | double a = MediaQuery.of(context).size.aspectRatio; | 166 | double a = MediaQuery.of(context).size.aspectRatio; |
| 159 | bool hasBottomPadding = a < 0.55; | 167 | bool hasBottomPadding = a < 0.55; |
| 160 | - | 168 | + ScreenshotController screenshotController = ScreenshotController(); |
| 161 | var detailPage = PoemDetailPage( | 169 | var detailPage = PoemDetailPage( |
| 162 | onPop: () { | 170 | onPop: () { |
| 163 | tkController.animateToMiddle(); | 171 | tkController.animateToMiddle(); |
| ... | @@ -208,7 +216,8 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -208,7 +216,8 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 208 | _videoListController.currentPlayer.videoInfo!.poemId; | 216 | _videoListController.currentPlayer.videoInfo!.poemId; |
| 209 | currentPoemType = | 217 | currentPoemType = |
| 210 | _videoListController.currentPlayer.videoInfo!.poemType; | 218 | _videoListController.currentPlayer.videoInfo!.poemType; |
| 211 | - | 219 | + currentId = |
| 220 | + _videoListController.currentPlayer.videoInfo!.id; | ||
| 212 | String url = | 221 | String url = |
| 213 | '${HttpApi.addView}/${_videoListController.currentPlayer.videoInfo!.id}'; | 222 | '${HttpApi.addView}/${_videoListController.currentPlayer.videoInfo!.id}'; |
| 214 | // 统计观看数 | 223 | // 统计观看数 |
| ... | @@ -260,7 +269,9 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -260,7 +269,9 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 260 | onError: (code, msg) {}, | 269 | onError: (code, msg) {}, |
| 261 | ); | 270 | ); |
| 262 | }, | 271 | }, |
| 263 | - onShare: () {}, | 272 | + onShare: () async { |
| 273 | + showShareView(context); | ||
| 274 | + }, | ||
| 264 | ); | 275 | ); |
| 265 | Widget poem = TikTokVidePoem( | 276 | Widget poem = TikTokVidePoem( |
| 266 | title: "每日一言", | 277 | title: "每日一言", |
| ... | @@ -316,7 +327,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -316,7 +327,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 316 | buttonColor: Colors.teal, | 327 | buttonColor: Colors.teal, |
| 317 | onPress: () { | 328 | onPress: () { |
| 318 | String url = | 329 | String url = |
| 319 | - '${PoemRouter.poemRecordVideoPage}?id=$currentPoemId&type=$currentPoemType'; | 330 | + '${PoemRouter.poemRecordVideoPage}?id=$currentId&type=$currentPoemType'; |
| 320 | eventBus.fire(TransEvent()); | 331 | eventBus.fire(TransEvent()); |
| 321 | NavigatorUtils.push( | 332 | NavigatorUtils.push( |
| 322 | context, | 333 | context, |
| ... | @@ -330,7 +341,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -330,7 +341,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 330 | eventBus.fire(TransEvent()); | 341 | eventBus.fire(TransEvent()); |
| 331 | NavigatorUtils.push( | 342 | NavigatorUtils.push( |
| 332 | context, | 343 | context, |
| 333 | - '${PoemRouter.poemRecordAudioPage}?id=$currentPoemId&type=$currentPoemType', | 344 | + '${PoemRouter.poemRecordAudioPage}?id=$currentId&type=$currentPoemType', |
| 334 | ); | 345 | ); |
| 335 | }), | 346 | }), |
| 336 | ], | 347 | ], |
| ... | @@ -388,4 +399,108 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -388,4 +399,108 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 388 | FloatingActionButtonLocation.centerDocked, | 399 | FloatingActionButtonLocation.centerDocked, |
| 389 | ); | 400 | ); |
| 390 | } | 401 | } |
| 402 | + | ||
| 403 | + static showShareView(BuildContext context) { | ||
| 404 | + final List buttonTitles = [ | ||
| 405 | + "Twitter", | ||
| 406 | + "Facebook", | ||
| 407 | + ]; | ||
| 408 | + final List buttonImages = [ | ||
| 409 | + "jiguang_socialize_twitter.png", | ||
| 410 | + "jiguang_socialize_facebook.png", | ||
| 411 | + ]; | ||
| 412 | + showModalBottomSheet( | ||
| 413 | + context: context, | ||
| 414 | + backgroundColor: Colors.white.withAlpha(0), | ||
| 415 | + elevation: 2, | ||
| 416 | + builder: (BuildContext context) { | ||
| 417 | + return ClipRRect( | ||
| 418 | + borderRadius: const BorderRadius.only( | ||
| 419 | + topLeft: Radius.circular(10), topRight: Radius.circular(10)), | ||
| 420 | + child: Container( | ||
| 421 | + width: double.infinity, | ||
| 422 | + height: 180, | ||
| 423 | + color: const Color.fromRGBO(255, 255, 255, 1), | ||
| 424 | + child: Stack( | ||
| 425 | + children: [ | ||
| 426 | + Padding( | ||
| 427 | + padding: | ||
| 428 | + const EdgeInsets.only(top: 14, left: 15, right: 15), | ||
| 429 | + child: Row( | ||
| 430 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 431 | + children: const [ | ||
| 432 | + Text( | ||
| 433 | + "分享到", | ||
| 434 | + style: TextStyle( | ||
| 435 | + fontSize: 20, | ||
| 436 | + fontWeight: FontWeight.bold, | ||
| 437 | + color: Color.fromRGBO(51, 51, 51, 1)), | ||
| 438 | + ), | ||
| 439 | + ], | ||
| 440 | + )), | ||
| 441 | + Padding( | ||
| 442 | + padding: const EdgeInsets.only(left: 0, right: 0, top: 0), | ||
| 443 | + child: Row( | ||
| 444 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 445 | + children: List.generate(buttonTitles.length, (index) { | ||
| 446 | + return Container( | ||
| 447 | + child: buttonWidget(context, buttonTitles[index], | ||
| 448 | + buttonImages[index], index), | ||
| 449 | + ); | ||
| 450 | + }).toList(), | ||
| 451 | + ), | ||
| 452 | + ) | ||
| 453 | + ], | ||
| 454 | + ), | ||
| 455 | + ), | ||
| 456 | + ); | ||
| 457 | + }); | ||
| 458 | + } | ||
| 459 | + | ||
| 460 | + static buttonWidget( | ||
| 461 | + BuildContext context, String title, String imageName, int index) { | ||
| 462 | + return GestureDetector( | ||
| 463 | + onTap: () { | ||
| 464 | + switch (index) { | ||
| 465 | + case 0: | ||
| 466 | + dismiss(context); | ||
| 467 | + SocialShare.shareTwitter( | ||
| 468 | + "This is Social Share twitter example", | ||
| 469 | + hashtags: ["hello", "world", "foo", "bar"], | ||
| 470 | + url: "https://google.com/#/hello", | ||
| 471 | + trailingText: "\nhello", | ||
| 472 | + ).then((data) { | ||
| 473 | + print(data); | ||
| 474 | + }); | ||
| 475 | + break; | ||
| 476 | + case 1: //Facebook | ||
| 477 | + print("朋友圈"); | ||
| 478 | + dismiss(context); | ||
| 479 | + break; | ||
| 480 | + default: | ||
| 481 | + break; | ||
| 482 | + } | ||
| 483 | + }, | ||
| 484 | + child: Column( | ||
| 485 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 486 | + children: [ | ||
| 487 | + Image.asset( | ||
| 488 | + "assets/images/share/$imageName", | ||
| 489 | + height: 64, | ||
| 490 | + width: 64, | ||
| 491 | + ), | ||
| 492 | + Padding( | ||
| 493 | + padding: const EdgeInsets.only(top: 5), | ||
| 494 | + child: Text(title, | ||
| 495 | + style: const TextStyle( | ||
| 496 | + fontSize: 12, color: Color.fromRGBO(51, 51, 51, 1))), | ||
| 497 | + ) | ||
| 498 | + ], | ||
| 499 | + ), | ||
| 500 | + ); | ||
| 501 | + } | ||
| 502 | + | ||
| 503 | + static dismiss(BuildContext context) { | ||
| 504 | + Navigator.pop(context); | ||
| 505 | + } | ||
| 391 | } | 506 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ... | @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev |
| 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. | 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. |
| 16 | # Read more about iOS versioning at | 16 | # Read more about iOS versioning at |
| 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html | 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html |
| 18 | -version: 1.0.0+2 | 18 | +version: 1.0.0+3 |
| 19 | 19 | ||
| 20 | environment: | 20 | environment: |
| 21 | sdk: ">=2.16.2 <3.0.0" | 21 | sdk: ">=2.16.2 <3.0.0" |
| ... | @@ -119,6 +119,8 @@ dependencies: | ... | @@ -119,6 +119,8 @@ dependencies: |
| 119 | flutter_inapp_purchase: ^5.3.0 | 119 | flutter_inapp_purchase: ^5.3.0 |
| 120 | 120 | ||
| 121 | jpush_flutter: ^2.2.9 | 121 | jpush_flutter: ^2.2.9 |
| 122 | + social_share: ^2.2.1 | ||
| 123 | + screenshot: ^1.2.3 | ||
| 122 | 124 | ||
| 123 | dependency_overrides: | 125 | dependency_overrides: |
| 124 | decimal: 1.5.0 | 126 | decimal: 1.5.0 |
| ... | @@ -201,6 +203,7 @@ flutter: | ... | @@ -201,6 +203,7 @@ flutter: |
| 201 | - assets/images/poem/ | 203 | - assets/images/poem/ |
| 202 | - assets/images/category/ | 204 | - assets/images/category/ |
| 203 | - assets/images/membership/ | 205 | - assets/images/membership/ |
| 206 | + - assets/images/share/ | ||
| 204 | - assets/data/ | 207 | - assets/data/ |
| 205 | - assets/data/Data.json | 208 | - assets/data/Data.json |
| 206 | - assets/data/friends/ | 209 | - assets/data/friends/ | ... | ... |
-
Please register or login to post a comment