diff --git a/PP-tools/password-generator/android/.gitignore b/PP-tools/password-generator/android/.gitignore new file mode 100755 index 0000000..3820a95 --- /dev/null +++ b/PP-tools/password-generator/android/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/PP-tools/password-generator/android/README.md b/PP-tools/password-generator/android/README.md new file mode 100755 index 0000000..d7fb564 --- /dev/null +++ b/PP-tools/password-generator/android/README.md @@ -0,0 +1,16 @@ +# password_generator + +password generator + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/PP-tools/password-generator/android/analysis_options.yaml b/PP-tools/password-generator/android/analysis_options.yaml new file mode 100755 index 0000000..0d29021 --- /dev/null +++ b/PP-tools/password-generator/android/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/PP-tools/password-generator/android/android/.gitignore b/PP-tools/password-generator/android/android/.gitignore new file mode 100755 index 0000000..be3943c --- /dev/null +++ b/PP-tools/password-generator/android/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/PP-tools/password-generator/android/android/app/build.gradle.kts b/PP-tools/password-generator/android/android/app/build.gradle.kts new file mode 100755 index 0000000..bbcc421 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "org.cancerai.password_generator" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "org.cancerai.password_generator" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/PP-tools/password-generator/android/android/app/src/debug/AndroidManifest.xml b/PP-tools/password-generator/android/android/app/src/debug/AndroidManifest.xml new file mode 100755 index 0000000..399f698 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/PP-tools/password-generator/android/android/app/src/main/AndroidManifest.xml b/PP-tools/password-generator/android/android/app/src/main/AndroidManifest.xml new file mode 100755 index 0000000..9025b80 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/PP-tools/password-generator/android/android/app/src/main/icon-playstore.png b/PP-tools/password-generator/android/android/app/src/main/icon-playstore.png new file mode 100755 index 0000000..4941176 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/icon-playstore.png differ diff --git a/PP-tools/password-generator/android/android/app/src/main/kotlin/org/cancerai/password_generator/MainActivity.kt b/PP-tools/password-generator/android/android/app/src/main/kotlin/org/cancerai/password_generator/MainActivity.kt new file mode 100755 index 0000000..cd2e474 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/kotlin/org/cancerai/password_generator/MainActivity.kt @@ -0,0 +1,5 @@ +package org.cancerai.password_generator + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/PP-tools/password-generator/android/android/app/src/main/res/drawable-v21/launch_background.xml b/PP-tools/password-generator/android/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100755 index 0000000..f74085f --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/PP-tools/password-generator/android/android/app/src/main/res/drawable/icon_background.xml b/PP-tools/password-generator/android/android/app/src/main/res/drawable/icon_background.xml new file mode 100755 index 0000000..ca3826a --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/drawable/icon_background.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PP-tools/password-generator/android/android/app/src/main/res/drawable/icon_foreground.xml b/PP-tools/password-generator/android/android/app/src/main/res/drawable/icon_foreground.xml new file mode 100755 index 0000000..4b82114 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/drawable/icon_foreground.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/PP-tools/password-generator/android/android/app/src/main/res/drawable/launch_background.xml b/PP-tools/password-generator/android/android/app/src/main/res/drawable/launch_background.xml new file mode 100755 index 0000000..304732f --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-anydpi-v26/icon.xml b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-anydpi-v26/icon.xml new file mode 100755 index 0000000..e9984d8 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-anydpi-v26/icon.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-anydpi-v26/icon_round.xml b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-anydpi-v26/icon_round.xml new file mode 100755 index 0000000..e9984d8 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-anydpi-v26/icon_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100755 index 0000000..db77bb4 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/icon.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/icon.webp new file mode 100755 index 0000000..55e7359 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/icon.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/icon_round.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/icon_round.webp new file mode 100755 index 0000000..da3eef5 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-hdpi/icon_round.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100755 index 0000000..17987b7 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/icon.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/icon.webp new file mode 100755 index 0000000..3eb88a1 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/icon.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/icon_round.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/icon_round.webp new file mode 100755 index 0000000..58a2f35 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-mdpi/icon_round.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100755 index 0000000..09d4391 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/icon.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/icon.webp new file mode 100755 index 0000000..8604be1 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/icon.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/icon_round.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/icon_round.webp new file mode 100755 index 0000000..94a4634 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xhdpi/icon_round.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100755 index 0000000..d5f1c8d Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/icon.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/icon.webp new file mode 100755 index 0000000..f8aca4c Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/icon.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/icon_round.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/icon_round.webp new file mode 100755 index 0000000..848afae Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxhdpi/icon_round.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100755 index 0000000..4d6372e Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/icon.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/icon.webp new file mode 100755 index 0000000..e953655 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/icon.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/icon_round.webp b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/icon_round.webp new file mode 100755 index 0000000..d2e1e31 Binary files /dev/null and b/PP-tools/password-generator/android/android/app/src/main/res/mipmap-xxxhdpi/icon_round.webp differ diff --git a/PP-tools/password-generator/android/android/app/src/main/res/values-night/styles.xml b/PP-tools/password-generator/android/android/app/src/main/res/values-night/styles.xml new file mode 100755 index 0000000..06952be --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/PP-tools/password-generator/android/android/app/src/main/res/values/icon_background.xml b/PP-tools/password-generator/android/android/app/src/main/res/values/icon_background.xml new file mode 100755 index 0000000..5e90b05 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/values/icon_background.xml @@ -0,0 +1,4 @@ + + + #F4F4F4 + \ No newline at end of file diff --git a/PP-tools/password-generator/android/android/app/src/main/res/values/styles.xml b/PP-tools/password-generator/android/android/app/src/main/res/values/styles.xml new file mode 100755 index 0000000..cb1ef88 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/PP-tools/password-generator/android/android/app/src/profile/AndroidManifest.xml b/PP-tools/password-generator/android/android/app/src/profile/AndroidManifest.xml new file mode 100755 index 0000000..399f698 --- /dev/null +++ b/PP-tools/password-generator/android/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/PP-tools/password-generator/android/android/build.gradle.kts b/PP-tools/password-generator/android/android/build.gradle.kts new file mode 100755 index 0000000..dbee657 --- /dev/null +++ b/PP-tools/password-generator/android/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/PP-tools/password-generator/android/android/gradle.properties b/PP-tools/password-generator/android/android/gradle.properties new file mode 100755 index 0000000..fbee1d8 --- /dev/null +++ b/PP-tools/password-generator/android/android/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true diff --git a/PP-tools/password-generator/android/android/gradle/wrapper/gradle-wrapper.properties b/PP-tools/password-generator/android/android/gradle/wrapper/gradle-wrapper.properties new file mode 100755 index 0000000..e4ef43f --- /dev/null +++ b/PP-tools/password-generator/android/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip diff --git a/PP-tools/password-generator/android/android/settings.gradle.kts b/PP-tools/password-generator/android/android/settings.gradle.kts new file mode 100755 index 0000000..733fdd2 --- /dev/null +++ b/PP-tools/password-generator/android/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.10.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false +} + +include(":app") diff --git a/PP-tools/password-generator/android/lib/main.dart b/PP-tools/password-generator/android/lib/main.dart new file mode 100755 index 0000000..3283e5f --- /dev/null +++ b/PP-tools/password-generator/android/lib/main.dart @@ -0,0 +1,284 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + TextEditingController categoryController = TextEditingController(); + TextEditingController changeDataController = TextEditingController(); + ScrollController scrollController = ScrollController(); + String resultStr = ""; + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar(title: Text("密码生成器")), + body: Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: ListView( + scrollDirection: Axis.vertical, + controller: scrollController, + children: [ + DefaultTextStyle( + style: TextStyle(color: Colors.black, fontSize: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "C (communication)", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + color: Colors.green, + ), + ), + Text("社交类: 该类软件包含以文本,语音,图片,音视频等方式进行社交,典型如微信,qq,电子邮箱 "), + SizedBox(height: 20), + Text( + "T (technology)", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + color: Colors.green, + ), + ), + Text( + "科技/技术类: 该类软件包含以提供计算机技术等其他工程类技术支持/论坛为主的服务,典型如csdn,华为 ", + ), + SizedBox(height: 20), + Text( + "S (shopping)", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + color: Colors.green, + ), + ), + Text("购物/外卖类: 该类软件包含各种以线上购买实体商品为主的服务,典型如淘宝,京东 "), + SizedBox(height: 20), + Text( + "EDU (education)", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + color: Colors.green, + ), + ), + Text("教育/学习类: 该类软件专注于提供教育,学术,辅导等的支持/资料,典型如扇贝英语,作业帮 "), + SizedBox(height: 20), + Text( + "E (entertainment)", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + color: Colors.green, + ), + ), + Text("游戏/娱乐类: 该类软件专注于以提供电子游戏,休闲娱乐为主的服务,典型如王者荣耀,抖音 "), + SizedBox(height: 20), + Text( + "O (other)", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + color: Colors.green, + ), + ), + Text("其他: 当一个服务不属于以上任何类别,那么归属于此类,典型如processon,工商银行 "), + ], + ), + SizedBox(height: 20), + + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded(flex: 2, child: Text("Category:")), + Expanded( + flex: 3, + child: SizedBox( + width: 200, + height: 50, + child: TextField(controller: categoryController), + ), + ), + ], + ), + SizedBox(height: 20), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded(flex: 2, child: Text("Change date: ")), + Expanded( + flex: 3, + child: SizedBox( + width: 200, + height: 50, + child: TextField(controller: changeDataController), + ), + ), + ], + ), + SizedBox(height: 20), + Center( + child: GestureDetector( + onTap: () { + setState(() { + resultStr = genPasswd(); + }); + WidgetsBinding.instance.addPostFrameCallback((val) { + scrollController.jumpTo( + scrollController.position.maxScrollExtent, + ); + }); + }, + child: Container( + width: MediaQuery.of(context).size.width / 2, + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFF8447D5), + borderRadius: BorderRadiusGeometry.circular(20), + ), + child: Text( + "generate password", + style: TextStyle(fontSize: 18, color: Colors.white), + ), + ), + ), + ), + + resultStr.isEmpty + ? SizedBox() + : Center( + child: Builder( + builder: (BuildContext context) { + return GestureDetector( + onLongPress: () { + Clipboard.setData( + ClipboardData(text: resultStr), + ).then((val) { + double offsetTop = + MediaQuery.of(context).size.height - + 200; + ScaffoldMessenger.of( + context, + ).showSnackBar( + SnackBar( + backgroundColor: Color(0xE4616161), + behavior: SnackBarBehavior.floating, + margin: EdgeInsets.only( + bottom: offsetTop, + left: 100, + right: 100 + ), + content: Center( + child: Text("saved to clipboard"), + ), + ), + ); + }); + }, + child: Container( + margin: EdgeInsets.only(top: 10), + child: Text( + resultStr, + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.w900, + letterSpacing: 2, + ), + ), + ), + ); + }, + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + String genRandomString(int length) { + String re = ""; + Random random = Random(); + + for (int i = 0; i < length; i++) { + int de = random.nextInt(2) + 1; + + switch (de) { + case 1: + int lowerCase = random.nextInt(122 - 97 + 1) + 97; + re += String.fromCharCode(lowerCase); + break; + case 2: + int upperCase = random.nextInt(90 - 65 + 1) + 65; + re += String.fromCharCode(upperCase); + break; + default: + print("Unexpected value: $de"); + break; + } + } + return re; + } + + String genLowerLetter(int length) { + String re = ""; + Random random = Random(); + + for (int i = 0; i < length; i++) { + int lowerCase = random.nextInt(122 - 97 + 1) + 97; + re += String.fromCharCode(lowerCase); + } + return re; + } + + String genPasswd() { + String categoryText = categoryController.text; + String dateText = changeDataController.text; + if (categoryText.isEmpty || dateText.isEmpty) { + return "Please done the form"; + } + + // verify if the field valid + // ================== START ================== + const categoryList = ["C", "T", "S", "EDU", "E", "O"]; + if (!categoryList.contains(categoryText)) { + return "Category: input not valid"; + } + + if (dateText.length != 4) { + return "Date: the length must be 4"; + } + var dateList = dateText.split(''); + for (var i = 0; i < dateList.length; i++) { + if (!(dateList[i].codeUnitAt(0) >= 48 && + dateList[i].codeUnitAt(0) <= 57)) { + return "Date: all digit must be a number"; + } + } + // ================== END ================== + + return "${categoryText}${dateText}${genLowerLetter(2)}_${genRandomString(8)}"; + } +} diff --git a/PP-tools/password-generator/android/pubspec.lock b/PP-tools/password-generator/android/pubspec.lock new file mode 100755 index 0000000..3decd54 --- /dev/null +++ b/PP-tools/password-generator/android/pubspec.lock @@ -0,0 +1,213 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" + source: hosted + version: "1.17.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + url: "https://pub.dev" + source: hosted + version: "0.7.7" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" +sdks: + dart: ">=3.10.4 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/PP-tools/password-generator/android/pubspec.yaml b/PP-tools/password-generator/android/pubspec.yaml new file mode 100755 index 0000000..c1acd32 --- /dev/null +++ b/PP-tools/password-generator/android/pubspec.yaml @@ -0,0 +1,89 @@ +name: password_generator +description: "password generator" +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# 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 is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.1.0 + +environment: + sdk: ^3.10.4 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^6.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/PP-tools/password-generator/android/test/widget_test.dart b/PP-tools/password-generator/android/test/widget_test.dart new file mode 100755 index 0000000..c9efdaf --- /dev/null +++ b/PP-tools/password-generator/android/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:password_generator/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}