hyzp_ybqx-Commit101:已经添加试用版本水印
This commit is contained in:
@@ -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<Tabs> {
|
||||
// 初始化插件
|
||||
DisableScreenshots _watermarkPlugin = DisableScreenshots();
|
||||
|
||||
//try_setState(); //避免如下异常报错
|
||||
try_setState() {
|
||||
try {
|
||||
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}');
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user