Init
This commit is contained in:
43
.gitignore
vendored
Normal file
43
.gitignore
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
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
|
||||
.flutter-plugins-dependencies
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# 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
|
||||
30
.metadata
Normal file
30
.metadata
Normal file
@@ -0,0 +1,30 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "b0850beeb25f6d5b10426284f506557f66181b36"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: b0850beeb25f6d5b10426284f506557f66181b36
|
||||
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
|
||||
- platform: android
|
||||
create_revision: b0850beeb25f6d5b10426284f506557f66181b36
|
||||
base_revision: b0850beeb25f6d5b10426284f506557f66181b36
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
16
README.md
Normal file
16
README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# xapk_installer
|
||||
|
||||
A quick app to install XAPK files
|
||||
|
||||
## 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.
|
||||
28
analysis_options.yaml
Normal file
28
analysis_options.yaml
Normal file
@@ -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
|
||||
13
android/.gitignore
vendored
Normal file
13
android/.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
gradle-wrapper.jar
|
||||
/.gradle
|
||||
/captures/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
|
||||
# Remember to never publicly share your keystore.
|
||||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
|
||||
key.properties
|
||||
**/*.keystore
|
||||
**/*.jks
|
||||
58
android/app/build.gradle
Normal file
58
android/app/build.gradle
Normal file
@@ -0,0 +1,58 @@
|
||||
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"
|
||||
}
|
||||
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file("local.properties")
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader("UTF-8") { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = "1"
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = "1.0"
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "dev.brammie15.xapk_installer"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "dev.brammie15.xapk_installer"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdk = 19
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutterVersionCode.toInteger()
|
||||
versionName = flutterVersionName
|
||||
}
|
||||
|
||||
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.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
7
android/app/src/debug/AndroidManifest.xml
Normal file
7
android/app/src/debug/AndroidManifest.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
48
android/app/src/main/AndroidManifest.xml
Normal file
48
android/app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<application
|
||||
android:label="xapk_installer"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
|
||||
|
||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
@@ -0,0 +1,5 @@
|
||||
package dev.brammie15.xapk_installer
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity()
|
||||
12
android/app/src/main/res/drawable-v21/launch_background.xml
Normal file
12
android/app/src/main/res/drawable-v21/launch_background.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
12
android/app/src/main/res/drawable/launch_background.xml
Normal file
12
android/app/src/main/res/drawable/launch_background.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 544 B |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 442 B |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 721 B |
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
18
android/app/src/main/res/values-night/styles.xml
Normal file
18
android/app/src/main/res/values-night/styles.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
18
android/app/src/main/res/values/styles.xml
Normal file
18
android/app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
7
android/app/src/profile/AndroidManifest.xml
Normal file
7
android/app/src/profile/AndroidManifest.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
18
android/build.gradle
Normal file
18
android/build.gradle
Normal file
@@ -0,0 +1,18 @@
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = "../build"
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(":app")
|
||||
}
|
||||
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
3
android/gradle.properties
Normal file
3
android/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
5
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -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-7.6.3-all.zip
|
||||
25
android/settings.gradle
Normal file
25
android/settings.gradle
Normal file
@@ -0,0 +1,25 @@
|
||||
pluginManagement {
|
||||
def flutterSdkPath = {
|
||||
def properties = new Properties()
|
||||
file("local.properties").withInputStream { properties.load(it) }
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
return 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 "7.3.0" apply false
|
||||
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
||||
47
lib/AppStateModel.dart
Normal file
47
lib/AppStateModel.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bluetooth_classic/models/device.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppStateModel extends ChangeNotifier {
|
||||
bool _scanning = false;
|
||||
List<Device> _discoveredDevices = [];
|
||||
int _deviceStatus = 0;
|
||||
|
||||
|
||||
bool get scanning => _scanning;
|
||||
List<Device> get discoveredDevices => _discoveredDevices;
|
||||
int get deviceStatus => _deviceStatus;
|
||||
|
||||
void setScanning(bool value) {
|
||||
_scanning = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setDiscoveredDevices(List<Device> value) {
|
||||
_discoveredDevices = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void addDiscoveredDevice(Device value) {
|
||||
_discoveredDevices.add(value);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void clearDiscoveredDevices() {
|
||||
_discoveredDevices.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setDeviceStatus(int value) {
|
||||
_deviceStatus = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// listen?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
10
lib/BluetoothUtils.dart
Normal file
10
lib/BluetoothUtils.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
//
|
||||
// bool isAlreadyConnectedToDevice(Device device, List<Device> connectedDevices) {
|
||||
// for (final connectedDevice in connectedDevices) {
|
||||
// if (connectedDevice.address == device.address) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
18
lib/ConnectionScreenDialogs.dart
Normal file
18
lib/ConnectionScreenDialogs.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void showAlreadyConnectedDialog(BuildContext context) {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Already connected'),
|
||||
content: const Text('This device is already connected'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('OK'))
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
25
lib/CustomBluetoothService.dart
Normal file
25
lib/CustomBluetoothService.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
import 'package:bluetooth_classic/bluetooth_classic.dart';
|
||||
import 'package:bluetooth_classic/models/device.dart';
|
||||
|
||||
class Custombluetoothservice extends BluetoothClassic {
|
||||
// @override
|
||||
// Stream<Uint8List> onDeviceDataReceived() {
|
||||
// return _onDeviceDataReceived ??=
|
||||
// super.onDeviceDataReceived().asBroadcastStream();
|
||||
// }
|
||||
|
||||
// Stream<Uint8List>? _onDeviceDataReceived;
|
||||
|
||||
@override
|
||||
Stream<Device> onDeviceDiscovered() =>
|
||||
_onDeviceDiscovered ??= super.onDeviceDiscovered().asBroadcastStream();
|
||||
Stream<Device>? _onDeviceDiscovered;
|
||||
|
||||
@override
|
||||
Stream<int> onDeviceStatusChanged() =>
|
||||
_onDeviceStatusChanged ??=
|
||||
super.onDeviceStatusChanged().asBroadcastStream();
|
||||
Stream<int>? _onDeviceStatusChanged;
|
||||
|
||||
}
|
||||
119
lib/MainControlScreen.dart
Normal file
119
lib/MainControlScreen.dart
Normal file
@@ -0,0 +1,119 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:xapk_installer/AppStateModel.dart';
|
||||
import 'package:xapk_installer/connectPage.dart';
|
||||
import 'package:xapk_installer/pickers/block_picker.dart';
|
||||
|
||||
class Maincontrolscreen extends StatefulWidget {
|
||||
const Maincontrolscreen({super.key});
|
||||
|
||||
@override
|
||||
State<Maincontrolscreen> createState() => _MaincontrolscreenState();
|
||||
}
|
||||
|
||||
class _MaincontrolscreenState extends State<Maincontrolscreen> {
|
||||
// final _bluetoothClassicPlugin = BluetoothClassic();
|
||||
|
||||
List<List<Color>> gridColors = List.generate(
|
||||
5,
|
||||
(i) => List.generate(5, (j) => Colors.grey), // Initialize with grey color
|
||||
);
|
||||
|
||||
// Method to toggle the color of a button
|
||||
void toggleButtonColor(int i, int j) {
|
||||
setState(() {
|
||||
gridColors[i][j] = currentColor;
|
||||
});
|
||||
}
|
||||
|
||||
bool isConnected = false;
|
||||
|
||||
Color currentColor = Colors.grey;
|
||||
|
||||
// Widget buildStatusIcon(){
|
||||
// if(Provider.of<AppStateModel>(context).name == Device.connected){
|
||||
// return Icon(Icons.bluetooth_connected);
|
||||
// }
|
||||
// else if( == Device.connecting){
|
||||
// return Icon(Icons.bluetooth_searching);
|
||||
// }
|
||||
// else{
|
||||
// return Icon(Icons.bluetooth_disabled);
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Connect Page'),
|
||||
actions: [
|
||||
IconButton(onPressed: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => ConnectPage()));
|
||||
}, icon: Icon(Icons.bluetooth)),
|
||||
IconButton(onPressed: (){
|
||||
|
||||
}, icon: Icon(Icons.upload)),
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 5,
|
||||
childAspectRatio: 1.0,
|
||||
crossAxisSpacing: 8.0,
|
||||
mainAxisSpacing: 8.0,
|
||||
),
|
||||
itemCount: 25, // 5x5 grid
|
||||
itemBuilder: (context, index) {
|
||||
int row = index ~/ 5;
|
||||
int col = index % 5;
|
||||
return GestureDetector(
|
||||
onTap: () => toggleButtonColor(row, col),
|
||||
child: Container(
|
||||
color: gridColors[row][col],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
// ColorPicker(
|
||||
// hexInputBar: false,
|
||||
// pickerAreaBorderRadius: const BorderRadius.all(
|
||||
// Radius.circular(10)),
|
||||
// portraitOnly: true,
|
||||
// pickerColor: currentColor,
|
||||
// onColorChanged: (color) {
|
||||
// currentColor = color;
|
||||
// },
|
||||
// enableAlpha: false,
|
||||
// colorPickerWidth: 100,
|
||||
// displayThumbColor: true,
|
||||
//
|
||||
//
|
||||
// )
|
||||
Center(
|
||||
child: BlockPicker(
|
||||
pickerColor: currentColor,
|
||||
onColorChanged: (color) {
|
||||
currentColor = color;
|
||||
},
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
34
lib/NoDeviceScreen.dart
Normal file
34
lib/NoDeviceScreen.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NoDevicesScreen extends StatelessWidget {
|
||||
const NoDevicesScreen({super.key, required this.onScanPressed});
|
||||
|
||||
final VoidCallback onScanPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.bluetooth_disabled,
|
||||
size: 100,
|
||||
color: Colors.grey,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text('No devices found', style: TextStyle(fontSize: 20)),
|
||||
const SizedBox(height: 10),
|
||||
// Button to scan for devices
|
||||
ElevatedButton(
|
||||
onPressed: onScanPressed,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: const Text('Scan for devices', style: TextStyle(fontSize: 15)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
368
lib/connectPage.dart
Normal file
368
lib/connectPage.dart
Normal file
@@ -0,0 +1,368 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bluetooth_classic/bluetooth_classic.dart';
|
||||
import 'package:bluetooth_classic/models/device.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:xapk_installer/AppStateModel.dart';
|
||||
import 'package:xapk_installer/BluetoothUtils.dart';
|
||||
import 'package:xapk_installer/ConnectionScreenDialogs.dart';
|
||||
import 'package:xapk_installer/CustomBluetoothService.dart';
|
||||
|
||||
import 'NoDeviceScreen.dart';
|
||||
|
||||
class ConnectPage extends StatefulWidget {
|
||||
const ConnectPage({super.key});
|
||||
|
||||
@override
|
||||
State<ConnectPage> createState() => _ConnectPageState();
|
||||
}
|
||||
|
||||
class _ConnectPageState extends State<ConnectPage> {
|
||||
final _bluetoothClassicPlugin = Custombluetoothservice();
|
||||
|
||||
//a bool to hide the no devices found screen when the user presses the scan button
|
||||
bool _hideNoDevicesScreen = false;
|
||||
|
||||
bool _scanning = false;
|
||||
|
||||
Icon _statusIcon = const Icon(Icons.restart_alt);
|
||||
|
||||
int _deviceStatus = Device.disconnected;
|
||||
|
||||
Device _connectedDevice = Device(name: 'Unknown', address: 'Unknown');
|
||||
|
||||
StreamSubscription? deviceListen;
|
||||
StreamSubscription? deviceChangeListen;
|
||||
|
||||
|
||||
|
||||
//Init
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_bluetoothClassicPlugin.initPermissions();
|
||||
_bluetoothClassicPlugin.onDeviceStatusChanged().listen((event) {
|
||||
setState(() {
|
||||
Provider.of<AppStateModel>(context, listen: false).setDeviceStatus(event);
|
||||
_deviceStatus = event;
|
||||
});
|
||||
});
|
||||
_bluetoothClassicPlugin.onDeviceDiscovered().listen(
|
||||
(event) {
|
||||
if (kDebugMode) {
|
||||
print('Device discovered: ${event.name}');
|
||||
}
|
||||
if (_scanning) {
|
||||
Provider.of<AppStateModel>(context, listen: false)
|
||||
.addDiscoveredDevice(event);
|
||||
//Sort list put Unknowns at the end
|
||||
Provider.of<AppStateModel>(context, listen: false)
|
||||
.discoveredDevices
|
||||
.sort((a, b) {
|
||||
if (a.name == null) {
|
||||
return 1;
|
||||
}
|
||||
if (b.name == null) {
|
||||
return -1;
|
||||
}
|
||||
return a.name!.compareTo(b.name!);
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//Dispose
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
// Provider.of<AppStateModel>(context, listen: false).listen?.cancel();
|
||||
|
||||
}
|
||||
|
||||
Future<void> _scan() async {
|
||||
if (_scanning) {
|
||||
await _bluetoothClassicPlugin.stopScan();
|
||||
if (kDebugMode) {
|
||||
print('Scanning stopped');
|
||||
}
|
||||
setState(() {
|
||||
_scanning = false;
|
||||
_statusIcon = const Icon(Icons.restart_alt);
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
Provider.of<AppStateModel>(context, listen: false).clearDiscoveredDevices();
|
||||
_hideNoDevicesScreen = true;
|
||||
_statusIcon = const Icon(Icons.cancel);
|
||||
});
|
||||
await _bluetoothClassicPlugin.startScan();
|
||||
if (kDebugMode) {
|
||||
print('Scanning started');
|
||||
}
|
||||
setState(() {
|
||||
_scanning = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _stopScan() async {
|
||||
await _bluetoothClassicPlugin.stopScan();
|
||||
if (kDebugMode) {
|
||||
print('Scanning stopped');
|
||||
}
|
||||
await _bluetoothClassicPlugin.disconnect();
|
||||
setState(() {
|
||||
_scanning = false;
|
||||
_statusIcon = const Icon(Icons.restart_alt);
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool?> _showConnectConfirmDialog(
|
||||
BuildContext context, String deviceName, String deviceAddress) {
|
||||
return showDialog<bool?>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Connect'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text('Do you want to connect to this device?'),
|
||||
Container(height: 10),
|
||||
Text(deviceName,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.underline,
|
||||
fontSize: 20)),
|
||||
Text(deviceAddress, style: const TextStyle(fontSize: 12)),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
child: const Text('No')),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: const Text('Yes')),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _connect(Device device) async {
|
||||
final connect = await _showConnectConfirmDialog(
|
||||
context, device.name ?? 'Unknown', device.address);
|
||||
if (connect == null || !connect) {
|
||||
return;
|
||||
}
|
||||
bool connected = false;
|
||||
bool error = false;
|
||||
List<Device> alreadyConnectedDevices = [];
|
||||
try {
|
||||
alreadyConnectedDevices =
|
||||
await _bluetoothClassicPlugin.getPairedDevices();
|
||||
} catch (e) {
|
||||
error = true;
|
||||
}
|
||||
if(error){
|
||||
if (context.mounted) {
|
||||
if (kDebugMode) {
|
||||
print('Failed to get paired devices');
|
||||
}
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Failed to get paired devices'),
|
||||
content: const Text('Failed to get paired devices'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('OK'))
|
||||
],
|
||||
);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
// //If the device is already connected, tell the user
|
||||
// if (alreadyConnectedDevices
|
||||
// .any((element) => element.address == device.address)) {
|
||||
// if (context.mounted) {
|
||||
// if (kDebugMode) {
|
||||
// print('Device already connected');
|
||||
// }
|
||||
// showAlreadyConnectedDialog(context);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(_deviceStatus == Device.connected){
|
||||
if (context.mounted) {
|
||||
if (kDebugMode) {
|
||||
print('Device already connected');
|
||||
}
|
||||
showAlreadyConnectedDialog(context);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
connected = await _bluetoothClassicPlugin.connect(
|
||||
device.address, "00001101-0000-1000-8000-00805f9b34fb");
|
||||
} catch (e) {
|
||||
error = true;
|
||||
}
|
||||
if (error || !connected) {
|
||||
if (context.mounted) {
|
||||
if (kDebugMode) {
|
||||
print('Failed to connect');
|
||||
}
|
||||
}
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Failed to connect'),
|
||||
content: const Text('Failed to connect to the device'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('OK'))
|
||||
],
|
||||
);
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_statusIcon = const Icon(Icons.restart_alt);
|
||||
_connectedDevice = device;
|
||||
});
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Connected'),
|
||||
content: const Text('You are now connected to the device'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('OK'))
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
await _bluetoothClassicPlugin.write("setPix 1 1 255 0 0\n"); //TODO: remove this
|
||||
}
|
||||
|
||||
|
||||
Future<void> _disconnect() async {
|
||||
await _bluetoothClassicPlugin.disconnect();
|
||||
setState(() {
|
||||
_statusIcon = const Icon(Icons.restart_alt);
|
||||
_connectedDevice = Device(name: 'Unknown', address: 'Unknown');
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Connect Page'),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: _statusIcon,
|
||||
onPressed: () {
|
||||
_scan();
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_stopScan();
|
||||
Provider.of<AppStateModel>(context, listen: false)
|
||||
.clearDiscoveredDevices();
|
||||
},
|
||||
icon: const Icon(Icons.star_purple500_outlined))
|
||||
],
|
||||
),
|
||||
body: !_hideNoDevicesScreen
|
||||
? NoDevicesScreen(onScanPressed: () {
|
||||
setState(() {
|
||||
_hideNoDevicesScreen = true;
|
||||
});
|
||||
_scan();
|
||||
})
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Consumer<AppStateModel>(
|
||||
builder: (context, appstate, child) {
|
||||
final List<Device> _discoveredDevices =
|
||||
appstate.discoveredDevices;
|
||||
return ListView.builder(itemBuilder: (context, index) {
|
||||
if (index >= _discoveredDevices.length) {
|
||||
return null;
|
||||
}
|
||||
return ListTile(
|
||||
title: Text(_discoveredDevices[index].name ?? 'Unknown', style: TextStyle(
|
||||
fontWeight: _discoveredDevices[index].name == _connectedDevice.name ? FontWeight.bold : FontWeight.normal,
|
||||
color: _discoveredDevices[index].name == _connectedDevice.name ? Colors.green : Colors.white
|
||||
),),
|
||||
subtitle: Text(_discoveredDevices[index].address),
|
||||
leading: _discoveredDevices[index].name == null ? const Icon(Icons.question_mark) : const Icon(
|
||||
Icons.bluetooth,
|
||||
color: Colors.blueAccent,
|
||||
),
|
||||
style: ListTileStyle.list,
|
||||
onTap: () async {
|
||||
if(_discoveredDevices[index].name == _connectedDevice.name){
|
||||
await _disconnect();
|
||||
} else {
|
||||
await _connect(_discoveredDevices[index]);
|
||||
}
|
||||
},
|
||||
onLongPress: () async {
|
||||
// if (isAlreadyConnectedToDevice(_discoveredDevices[index],
|
||||
// await _bluetoothClassicPlugin.getPairedDevices())) {
|
||||
// _bluetoothClassicPlugin.disconnect();
|
||||
// }
|
||||
Fluttertoast.showToast(
|
||||
msg: Provider.of<AppStateModel>(context, listen: false).deviceStatus.toString(),
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 1,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0
|
||||
);
|
||||
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
39
lib/main.dart
Normal file
39
lib/main.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:xapk_installer/MainControlScreen.dart';
|
||||
import 'package:xapk_installer/connectPage.dart';
|
||||
|
||||
import 'AppStateModel.dart';
|
||||
|
||||
void main() {
|
||||
runApp(ChangeNotifierProvider(
|
||||
create: (context) => AppStateModel(),
|
||||
child: const MyApp(),
|
||||
));
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
darkTheme: ThemeData.dark(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: Maincontrolscreen(),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
419
lib/pickers/block_picker.dart
Normal file
419
lib/pickers/block_picker.dart
Normal file
@@ -0,0 +1,419 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
|
||||
const List<Color> colors = [
|
||||
Colors.red,
|
||||
Colors.pink,
|
||||
Colors.purple,
|
||||
Colors.deepPurple,
|
||||
Colors.indigo,
|
||||
Colors.blue,
|
||||
Colors.lightBlue,
|
||||
Colors.cyan,
|
||||
Colors.teal,
|
||||
Colors.green,
|
||||
Colors.lightGreen,
|
||||
Colors.lime,
|
||||
Colors.yellow,
|
||||
Colors.amber,
|
||||
Colors.orange,
|
||||
Colors.deepOrange,
|
||||
Colors.brown,
|
||||
Colors.grey,
|
||||
Colors.blueGrey,
|
||||
Colors.black,
|
||||
];
|
||||
|
||||
class BlockColorPickerExample extends StatefulWidget {
|
||||
const BlockColorPickerExample({
|
||||
Key? key,
|
||||
required this.pickerColor,
|
||||
required this.onColorChanged,
|
||||
required this.pickerColors,
|
||||
required this.onColorsChanged,
|
||||
required this.colorHistory,
|
||||
}) : super(key: key);
|
||||
|
||||
final Color pickerColor;
|
||||
final ValueChanged<Color> onColorChanged;
|
||||
final List<Color> pickerColors;
|
||||
final ValueChanged<List<Color>> onColorsChanged;
|
||||
final List<Color> colorHistory;
|
||||
|
||||
@override
|
||||
State<BlockColorPickerExample> createState() => _BlockColorPickerExampleState();
|
||||
}
|
||||
|
||||
class _BlockColorPickerExampleState extends State<BlockColorPickerExample> {
|
||||
int _portraitCrossAxisCount = 4;
|
||||
int _landscapeCrossAxisCount = 5;
|
||||
double _borderRadius = 30;
|
||||
double _blurRadius = 5;
|
||||
double _iconSize = 24;
|
||||
|
||||
Widget pickerLayoutBuilder(BuildContext context, List<Color> colors, PickerItem child) {
|
||||
Orientation orientation = MediaQuery.of(context).orientation;
|
||||
|
||||
return SizedBox(
|
||||
width: 300,
|
||||
height: orientation == Orientation.portrait ? 360 : 240,
|
||||
child: GridView.count(
|
||||
crossAxisCount: orientation == Orientation.portrait ? _portraitCrossAxisCount : _landscapeCrossAxisCount,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 5,
|
||||
children: [for (Color color in colors) child(color)],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget pickerItemBuilder(Color color, bool isCurrentColor, void Function() changeColor) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(_borderRadius),
|
||||
color: color,
|
||||
boxShadow: [BoxShadow(color: color.withOpacity(0.8), offset: const Offset(1, 2), blurRadius: _blurRadius)],
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: changeColor,
|
||||
borderRadius: BorderRadius.circular(_borderRadius),
|
||||
child: AnimatedOpacity(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
opacity: isCurrentColor ? 1 : 0,
|
||||
child: Icon(
|
||||
Icons.done,
|
||||
size: _iconSize,
|
||||
color: useWhiteForeground(color) ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
titlePadding: const EdgeInsets.all(0),
|
||||
contentPadding: const EdgeInsets.all(25),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(
|
||||
'''
|
||||
Widget pickerLayoutBuilder(BuildContext context, List<Color> colors, PickerItem child) {
|
||||
Orientation orientation = MediaQuery.of(context).orientation;
|
||||
|
||||
return SizedBox(
|
||||
width: 300,
|
||||
height: orientation == Orientation.portrait ? 360 : 240,
|
||||
child: GridView.count(
|
||||
crossAxisCount: orientation == Orientation.portrait ? $_portraitCrossAxisCount : $_landscapeCrossAxisCount,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 5,
|
||||
children: [for (Color color in colors) child(color)],
|
||||
),
|
||||
);
|
||||
}
|
||||
''',
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.code, color: useWhiteForeground(widget.pickerColor) ? Colors.white : Colors.black),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.pickerColor,
|
||||
shadowColor: widget.pickerColor.withOpacity(1),
|
||||
elevation: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Portrait Cross Axis Count'),
|
||||
subtitle: Text(_portraitCrossAxisCount.toString()),
|
||||
trailing: SizedBox(
|
||||
width: 200,
|
||||
child: Slider(
|
||||
value: _portraitCrossAxisCount.toDouble(),
|
||||
min: 1,
|
||||
max: 10,
|
||||
divisions: 9,
|
||||
label: _portraitCrossAxisCount.toString(),
|
||||
onChanged: (double value) => setState(() => _portraitCrossAxisCount = value.round()),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Landscape Cross Axis Count'),
|
||||
subtitle: Text(_landscapeCrossAxisCount.toString()),
|
||||
trailing: SizedBox(
|
||||
width: 200,
|
||||
child: Slider(
|
||||
value: _landscapeCrossAxisCount.toDouble(),
|
||||
min: 1,
|
||||
max: 10,
|
||||
divisions: 9,
|
||||
label: _landscapeCrossAxisCount.toString(),
|
||||
onChanged: (double value) => setState(() => _landscapeCrossAxisCount = value.round()),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
titlePadding: const EdgeInsets.all(0),
|
||||
contentPadding: const EdgeInsets.all(25),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(
|
||||
'''
|
||||
Widget pickerItemBuilder(Color color, bool isCurrentColor, void Function() changeColor) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular($_borderRadius),
|
||||
color: color,
|
||||
boxShadow: [BoxShadow(color: color.withOpacity(0.8), offset: const Offset(1, 2), blurRadius: $_blurRadius)],
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: changeColor,
|
||||
borderRadius: BorderRadius.circular(_borderRadius),
|
||||
child: AnimatedOpacity(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
opacity: isCurrentColor ? 1 : 0,
|
||||
child: Icon(
|
||||
Icons.done,
|
||||
size: $_iconSize,
|
||||
color: useWhiteForeground(color) ? Colors.white : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
''',
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.code, color: useWhiteForeground(widget.pickerColor) ? Colors.white : Colors.black),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.pickerColor,
|
||||
shadowColor: widget.pickerColor.withOpacity(1),
|
||||
elevation: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Border Radius'),
|
||||
subtitle: Text(_borderRadius.toString()),
|
||||
trailing: SizedBox(
|
||||
width: 200,
|
||||
child: Slider(
|
||||
value: _borderRadius,
|
||||
min: 0,
|
||||
max: 30,
|
||||
divisions: 30,
|
||||
label: _borderRadius.toString(),
|
||||
onChanged: (double value) => setState(() => _borderRadius = value.round().toDouble()),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Blur Radius'),
|
||||
subtitle: Text(_blurRadius.toString()),
|
||||
trailing: SizedBox(
|
||||
width: 200,
|
||||
child: Slider(
|
||||
value: _blurRadius,
|
||||
min: 0,
|
||||
max: 5,
|
||||
divisions: 5,
|
||||
label: _blurRadius.toString(),
|
||||
onChanged: (double value) => setState(() => _blurRadius = value.round().toDouble()),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Icon Size'),
|
||||
subtitle: Text(_iconSize.toString()),
|
||||
trailing: SizedBox(
|
||||
width: 200,
|
||||
child: Slider(
|
||||
value: _iconSize,
|
||||
min: 1,
|
||||
max: 50,
|
||||
divisions: 49,
|
||||
label: _iconSize.toString(),
|
||||
onChanged: (double value) => setState(() => _iconSize = value.round().toDouble()),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Select a color'),
|
||||
content: SingleChildScrollView(
|
||||
child: BlockPicker(
|
||||
pickerColor: widget.pickerColor,
|
||||
onColorChanged: widget.onColorChanged,
|
||||
availableColors: widget.colorHistory.isNotEmpty ? widget.colorHistory : colors,
|
||||
layoutBuilder: pickerLayoutBuilder,
|
||||
itemBuilder: pickerItemBuilder,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'Blocky Color Picker',
|
||||
style: TextStyle(color: useWhiteForeground(widget.pickerColor) ? Colors.white : Colors.black),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.pickerColor,
|
||||
shadowColor: widget.pickerColor.withOpacity(1),
|
||||
elevation: 10,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return const AlertDialog(
|
||||
titlePadding: EdgeInsets.all(0),
|
||||
contentPadding: EdgeInsets.all(25),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(
|
||||
'''
|
||||
BlockPicker(
|
||||
pickerColor: color,
|
||||
onColorChanged: changeColor,
|
||||
availableColors: colors,
|
||||
layoutBuilder: pickerLayoutBuilder,
|
||||
itemBuilder: pickerItemBuilder,
|
||||
)
|
||||
''',
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.code, color: useWhiteForeground(widget.pickerColor) ? Colors.white : Colors.black),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.pickerColor,
|
||||
shadowColor: widget.pickerColor.withOpacity(1),
|
||||
elevation: 10,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Divider(),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Select colors'),
|
||||
content: SingleChildScrollView(
|
||||
child: MultipleChoiceBlockPicker(
|
||||
pickerColors: widget.pickerColors,
|
||||
onColorsChanged: widget.onColorsChanged,
|
||||
availableColors: widget.colorHistory.isNotEmpty ? widget.colorHistory : colors,
|
||||
layoutBuilder: pickerLayoutBuilder,
|
||||
itemBuilder: pickerItemBuilder,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'Multiple selection Blocky Color Picker',
|
||||
style: TextStyle(color: useWhiteForeground(widget.pickerColor) ? Colors.white : Colors.black),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.pickerColor,
|
||||
shadowColor: widget.pickerColor.withOpacity(1),
|
||||
elevation: 10,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return const AlertDialog(
|
||||
titlePadding: EdgeInsets.all(0),
|
||||
contentPadding: EdgeInsets.all(25),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(
|
||||
'''
|
||||
MultipleChoiceBlockPicker(
|
||||
pickerColors: colors,
|
||||
onColorsChanged: changeColors,
|
||||
availableColors: colors,
|
||||
layoutBuilder: pickerLayoutBuilder,
|
||||
itemBuilder: pickerItemBuilder,
|
||||
)
|
||||
''',
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.code, color: useWhiteForeground(widget.pickerColor) ? Colors.white : Colors.black),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: widget.pickerColor,
|
||||
shadowColor: widget.pickerColor.withOpacity(1),
|
||||
elevation: 10,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
0
lib/widgets.dart
Normal file
0
lib/widgets.dart
Normal file
282
pubspec.lock
Normal file
282
pubspec.lock
Normal file
@@ -0,0 +1,282 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.11.0"
|
||||
bluetooth_classic:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: bluetooth_classic
|
||||
sha256: "0c73a487517b69acb90e2f1c9a21b563fb11771aa1a41ad0fe7d5563b5fb2877"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.18.0"
|
||||
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: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_bluetooth_serial:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_bluetooth_serial
|
||||
sha256: "248608f777e92e867b642c88327c030fd5eacafb9841d4aa3e34d04ae314de20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.2"
|
||||
flutter_colorpicker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_colorpicker
|
||||
sha256: "969de5f6f9e2a570ac660fb7b501551451ea2a1ab9e2097e89475f60e07816ea"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
fluttertoast:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: fluttertoast
|
||||
sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.2.8"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.4"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.16+1"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.12.0"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: plugin_platform_interface
|
||||
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: provider
|
||||
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.2"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.1"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
sdks:
|
||||
dart: ">=3.4.4 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
95
pubspec.yaml
Normal file
95
pubspec.yaml
Normal file
@@ -0,0 +1,95 @@
|
||||
name: xapk_installer
|
||||
description: "A quick app to install XAPK files"
|
||||
# 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.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=3.4.4 <4.0.0'
|
||||
|
||||
# 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.6
|
||||
bluetooth_classic: ^0.0.1
|
||||
flutter_colorpicker: ^1.1.0
|
||||
provider: ^6.1.2
|
||||
fluttertoast: ^8.2.8
|
||||
flutter_bluetooth_serial: ^0.3.2
|
||||
|
||||
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: ^3.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/assets-and-images/#resolution-aware
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
|
||||
# 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/custom-fonts/#from-packages
|
||||
30
test/widget_test.dart
Normal file
30
test/widget_test.dart
Normal file
@@ -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:xapk_installer/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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user