From a04bc84c429e0469aed2a287baac5efbdc756eaa Mon Sep 17 00:00:00 2001 From: WinUser01 Date: Fri, 18 Feb 2022 16:55:36 +0800 Subject: [PATCH] =?UTF-8?q?hyzp=5Fybqx-Commit101=EF=BC=9A=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E6=B7=BB=E5=8A=A0=E8=AF=95=E7=94=A8=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/tabs/Tabs.dart | 12 ++++- pubspec.lock | 7 +++ pubspec.yaml | 103 ++++++++++++++++++++------------------- 3 files changed, 71 insertions(+), 51 deletions(-) diff --git a/lib/pages/tabs/Tabs.dart b/lib/pages/tabs/Tabs.dart index c2b6b00..07c9c22 100644 --- a/lib/pages/tabs/Tabs.dart +++ b/lib/pages/tabs/Tabs.dart @@ -1,4 +1,5 @@ import 'package:badges/badges.dart'; +import 'package:disable_screenshots/disable_screenshots.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hyzp_ybqx/pages/tabs/page4_myMsics_new.dart'; @@ -18,10 +19,19 @@ class Tabs extends StatefulWidget { } class _TabsState extends State { + // 初始化插件 + DisableScreenshots _watermarkPlugin = DisableScreenshots(); + //try_setState(); //避免如下异常报错 try_setState() { try { - setState(() {}); + if (mounted) { + setState(() {}); + // 添加默认样式的水印 + _watermarkPlugin.addWatermark(context, "试用版本水印", rowCount: 4, columnCount: 8); + // _watermarkPlugin必须放在这里,放在Widget build(BuildContext context)函数中会报错: + // Dart Unhandled Exception: setState() or markNeedsBuild() called during build. + } } catch (e) { print('setState(() {})异常:${e}'); } diff --git a/pubspec.lock b/pubspec.lock index 696ade1..09920b6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -169,6 +169,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.0.10" + disable_screenshots: + dependency: "direct main" + description: + name: disable_screenshots + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.0" encrypt: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index f5ae071..db4db18 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,56 +5,56 @@ description: HeiYanZhuaPai_qx_name Flutter application . # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -# 开发人员信息: -# 技术人员: 闵军 -# By: ybmj@vip.163.com , -# QQ: 153248043 -# https://www.cnblogs.com/ybmj/ - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# 版本名称: 1.2.7 版本号:1 -# R:\FlutterProject\FlutterProject33\hyzp_ybqx\lib\components\commonFun.dart -# String dateAppCompile = '2021.05.18'; //1.2.7 -# String dateAppCompile = '2021.05.15'; //1.3.1 -# 版本号保存在该文件中:r:\FlutterProject\FlutterProject33\hyzp_ybqx\pubspec.yaml -# version: 1.3.1+20210508 +号前面是版本号,+号后面是时间(yyyymmdd 小版本号) 对应 hyzp_ybqx-Commit802-Branch.031 -# version: 1.3.0+20210526 -# version: 1.3.1+20210527 -# version: 1.3.2+20210528 -# version: 1.3.4+20210529 -# version: 1.3.5+20210530 -# version: 1.3.6+20210601 -# version: 1.3.7+20210604 -# version: 1.3.10+20210604 -# version: 1.3.11+20210729 -# 关键是在通过接口 App.Car_Upload.Apk 上传新版本 apk 时,ver参数的版本号必须为1.3.12,而不能为1.3.12+20210729 -# 否则老版本1.3.10+20210604无法更新。新版本1.3.12+20210729已经解决该问题 -# version: 1.3.12+20210729 -# version: 1.3.13+20211026 -# version: 1.4.1+20211226 -# version: 1.4.2+20211227 -# version: 1.4.4+20211230 -# version: 1.4.6+20211231 -# version: 1.4.7+20220101 -# version: 1.4.9+20220103 -# version: 1.4.10+20220104 -# version: 1.4.11+20220106 -#version: 1.4.12+20220107 -# version: 1.4.13+20220121 -# 用下划线编译报错: -# Error on line 53, column 10 of pubspec.yaml: Invalid version number: Could not parse "1.4.14_20220124". -# version: 1.4.14 # 为规范起见,从该版本起取消后面的 +20220124 -#version: 1.4.14+20220124 # 無法獲取flutter编译时间,只有通过这种方式获取,所以还是保留后面的 +20220124。 - # 上传软件时可以不加后面的 +20220124,否则二维码扫码后无法直接下载 + # 开发人员信息: + # 技术人员: 闵军 + # By: ybmj@vip.163.com , + # QQ: 153248043 + # https://www.cnblogs.com/ybmj/ + + # The following defines the version and build number for your application. + # A version number is three numbers separated by dots, like 1.2.43 + # followed by an optional build number separated by a +. + # Both the version and the builder number may be overridden in flutter + # build by specifying --build-name and --build-number, respectively. + # In Android, build-name is used as versionName while build-number used as versionCode. + # Read more about Android versioning at https://developer.android.com/studio/publish/versioning + # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. + # Read more about iOS versioning at + # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html + # 版本名称: 1.2.7 版本号:1 + # R:\FlutterProject\FlutterProject33\hyzp_ybqx\lib\components\commonFun.dart + # String dateAppCompile = '2021.05.18'; //1.2.7 + # String dateAppCompile = '2021.05.15'; //1.3.1 + # 版本号保存在该文件中:r:\FlutterProject\FlutterProject33\hyzp_ybqx\pubspec.yaml + # version: 1.3.1+20210508 +号前面是版本号,+号后面是时间(yyyymmdd 小版本号) 对应 hyzp_ybqx-Commit802-Branch.031 + # version: 1.3.0+20210526 + # version: 1.3.1+20210527 + # version: 1.3.2+20210528 + # version: 1.3.4+20210529 + # version: 1.3.5+20210530 + # version: 1.3.6+20210601 + # version: 1.3.7+20210604 + # version: 1.3.10+20210604 + # version: 1.3.11+20210729 + # 关键是在通过接口 App.Car_Upload.Apk 上传新版本 apk 时,ver参数的版本号必须为1.3.12,而不能为1.3.12+20210729 + # 否则老版本1.3.10+20210604无法更新。新版本1.3.12+20210729已经解决该问题 + # version: 1.3.12+20210729 + # version: 1.3.13+20211026 + # version: 1.4.1+20211226 + # version: 1.4.2+20211227 + # version: 1.4.4+20211230 + # version: 1.4.6+20211231 + # version: 1.4.7+20220101 + # version: 1.4.9+20220103 + # version: 1.4.10+20220104 + # version: 1.4.11+20220106 + #version: 1.4.12+20220107 + # version: 1.4.13+20220121 + # 用下划线编译报错: + # Error on line 53, column 10 of pubspec.yaml: Invalid version number: Could not parse "1.4.14_20220124". + # version: 1.4.14 # 为规范起见,从该版本起取消后面的 +20220124 + #version: 1.4.14+20220124 # 無法獲取flutter编译时间,只有通过这种方式获取,所以还是保留后面的 +20220124。 +# 上传软件时可以不加后面的 +20220124,否则二维码扫码后无法直接下载 #version: 1.4.15+20220124 version: 1.4.16+20220126 @@ -180,6 +180,9 @@ dependencies: # Flutter 保存用户登录历史记录 ai_save_account ai_save_account: ^1.0.1 + # 添加水印插件 + disable_screenshots: ^0.1.0 + dev_dependencies: flutter_test: sdk: flutter