diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies
index 7ab864c..cc175ec 100644
--- a/.flutter-plugins-dependencies
+++ b/.flutter-plugins-dependencies
@@ -1 +1 @@
-{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"url_launcher","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.5/","dependencies":[]}],"android":[{"name":"path_provider","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"url_launcher","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.5/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+1/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"url_launcher_web","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1+2/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-05-26 09:17:49.337371","version":"1.19.0-1.0.pre"}
\ No newline at end of file
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"url_launcher","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/","dependencies":[]}],"android":[{"name":"path_provider","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.7/","dependencies":[]},{"name":"url_launcher","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+1/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[{"name":"url_launcher_linux","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+4/","dependencies":[]}],"windows":[{"name":"url_launcher_windows","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-0.0.1+3/","dependencies":[]}],"web":[{"name":"url_launcher_web","path":"/Users/snoopy/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.5+3/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2021-01-31 12:13:56.270850","version":"1.22.5"}
\ No newline at end of file
diff --git a/android/.gitignore b/android/.gitignore
index bc2100d..0a741cb 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -5,3 +5,7 @@ gradle-wrapper.jar
/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
diff --git a/android/app/build.gradle b/android/app/build.gradle
index fb40303..aa3b506 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 28
+ compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -40,10 +40,9 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "hr.knezzz.ff.flutter_factory"
minSdkVersion 16
- targetSdkVersion 28
+ targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -61,7 +60,4 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.1.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
diff --git a/android/app/release/app.aab b/android/app/release/app.aab
deleted file mode 100644
index 6cfe187..0000000
Binary files a/android/app/release/app.aab and /dev/null differ
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 7f96982..a39ec7c 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,6 +1,5 @@
-
+
+ android:name="io.flutter.embedding.android.NormalTheme"
+ android:resource="@style/NormalTheme"
+ />
+
+
+
+
diff --git a/android/app/src/main/kotlin/hr/knezzz/ff/FlutterFactory/MainActivity.kt b/android/app/src/main/kotlin/hr/knezzz/ff/FlutterFactory/MainActivity.kt
deleted file mode 100644
index 0689e09..0000000
--- a/android/app/src/main/kotlin/hr/knezzz/ff/FlutterFactory/MainActivity.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package hr.knezzz.ff.FlutterFactory
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity() {
-}
diff --git a/android/app/src/main/kotlin/hr/knezzz/ff/flutter_factory/MainActivity.kt b/android/app/src/main/kotlin/hr/knezzz/ff/flutter_factory/MainActivity.kt
index 4f8181c..8399b04 100644
--- a/android/app/src/main/kotlin/hr/knezzz/ff/flutter_factory/MainActivity.kt
+++ b/android/app/src/main/kotlin/hr/knezzz/ff/flutter_factory/MainActivity.kt
@@ -1,13 +1,6 @@
package hr.knezzz.ff.flutter_factory
-import android.os.Bundle
-
-import io.flutter.app.FlutterActivity
-import io.flutter.plugins.GeneratedPluginRegistrant
+import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- GeneratedPluginRegistrant.registerWith(this)
- }
}
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
index 00fa441..1f83a33 100644
--- a/android/app/src/main/res/values/styles.xml
+++ b/android/app/src/main/res/values/styles.xml
@@ -1,8 +1,18 @@
+
+
+
diff --git a/android/build.gradle b/android/build.gradle
index b7faad8..3100ad2 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,12 +1,12 @@
buildscript {
- ext.kotlin_version = '1.2.71'
+ ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
+ classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 7faadba..a673820 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
-8android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
+android.enableR8=true
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 2819f02..296b146 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
diff --git a/android/settings.gradle b/android/settings.gradle
index 5a2f14f..44e62bc 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -1,15 +1,11 @@
include ':app'
-def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()
-def plugins = new Properties()
-def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
-if (pluginsFile.exists()) {
- pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
-}
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
-plugins.each { name, path ->
- def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
- include ":$name"
- project(":$name").projectDir = pluginDirectory
-}
+def flutterSdkPath = properties.getProperty("flutter.sdk")
+assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/flutter_01.skp b/flutter_01.skp
new file mode 100644
index 0000000..a1f9d08
Binary files /dev/null and b/flutter_01.skp differ
diff --git a/flutter_02.skp b/flutter_02.skp
new file mode 100644
index 0000000..bdf302f
Binary files /dev/null and b/flutter_02.skp differ
diff --git a/flutter_03.skp b/flutter_03.skp
new file mode 100644
index 0000000..ffcd8b8
Binary files /dev/null and b/flutter_03.skp differ
diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id
new file mode 100644
index 0000000..1f390dd
--- /dev/null
+++ b/ios/Flutter/.last_build_id
@@ -0,0 +1 @@
+f725a4bbb88c794d2c39e768e8993700
\ No newline at end of file
diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh
index 509704d..87e673b 100755
--- a/ios/Flutter/flutter_export_environment.sh
+++ b/ios/Flutter/flutter_export_environment.sh
@@ -6,9 +6,10 @@ export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
-export "FLUTTER_FRAMEWORK_DIR=/Users/snoopy/flutter/bin/cache/artifacts/engine/ios"
+export "FLUTTER_FRAMEWORK_DIR=/Users/snoopy/flutter/bin/cache/artifacts/engine/ios-release"
export "FLUTTER_BUILD_NAME=0.1.3"
-export "FLUTTER_BUILD_NUMBER=2"
+export "FLUTTER_BUILD_NUMBER=3"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
-export "TREE_SHAKE_ICONS=false"
+export "TREE_SHAKE_ICONS=true"
+export "PACKAGE_CONFIG=.packages"
diff --git a/ios/Podfile b/ios/Podfile
index b30a428..1e8c3c9 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -10,81 +10,32 @@ project 'Runner', {
'Release' => :release,
}
-def parse_KV_file(file, separator='=')
- file_abs_path = File.expand_path(file)
- if !File.exists? file_abs_path
- return [];
+def flutter_root
+ generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
+ unless File.exist?(generated_xcode_build_settings_path)
+ raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
- generated_key_values = {}
- skip_line_start_symbols = ["#", "/"]
- File.foreach(file_abs_path) do |line|
- next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
- plugin = line.split(pattern=separator)
- if plugin.length == 2
- podname = plugin[0].strip()
- path = plugin[1].strip()
- podpath = File.expand_path("#{path}", file_abs_path)
- generated_key_values[podname] = podpath
- else
- puts "Invalid plugin specification: #{line}"
- end
+
+ File.foreach(generated_xcode_build_settings_path) do |line|
+ matches = line.match(/FLUTTER_ROOT\=(.*)/)
+ return matches[1].strip if matches
end
- generated_key_values
+ raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
+
+flutter_ios_podfile_setup
+
target 'Runner' do
use_frameworks!
use_modular_headers!
-
- # Flutter Pod
- copied_flutter_dir = File.join(__dir__, 'Flutter')
- copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
- copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
- unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
- # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
- # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
- # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
-
- generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
- unless File.exist?(generated_xcode_build_settings_path)
- raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
- end
- generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
- cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
-
- unless File.exist?(copied_framework_path)
- FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
- end
- unless File.exist?(copied_podspec_path)
- FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
- end
- end
-
- # Keep pod path relative so it can be checked into Podfile.lock.
- pod 'Flutter', :path => 'Flutter'
-
- # Plugin Pods
-
- # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
- # referring to absolute paths on developers' machines.
- system('rm -rf .symlinks')
- system('mkdir -p .symlinks/plugins')
- plugin_pods = parse_KV_file('../.flutter-plugins')
- plugin_pods.each do |name, path|
- symlink = File.join('.symlinks', 'plugins', name)
- File.symlink(path, symlink)
- pod name, :path => File.join(symlink, 'ios')
- end
+ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
-# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
-install! 'cocoapods', :disable_input_output_paths => true
-
post_install do |installer|
installer.pods_project.targets.each do |target|
- target.build_configurations.each do |config|
- config.build_settings['ENABLE_BITCODE'] = 'NO'
- end
+ flutter_additional_ios_build_settings(target)
end
end
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 64d20b5..946bdda 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -4,17 +4,11 @@ PODS:
- Flutter
- url_launcher (0.0.1):
- Flutter
- - url_launcher_macos (0.0.1):
- - Flutter
- - url_launcher_web (0.0.1):
- - Flutter
DEPENDENCIES:
- Flutter (from `Flutter`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
- - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)
EXTERNAL SOURCES:
Flutter:
@@ -23,18 +17,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider/ios"
url_launcher:
:path: ".symlinks/plugins/url_launcher/ios"
- url_launcher_macos:
- :path: ".symlinks/plugins/url_launcher_macos/ios"
- url_launcher_web:
- :path: ".symlinks/plugins/url_launcher_web/ios"
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
- path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
- url_launcher: a1c0cc845906122c4784c542523d8cacbded5626
- url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313
- url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c
+ path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
+ url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
-PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83
+PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
-COCOAPODS: 1.9.1
+COCOAPODS: 1.10.0
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index ef09818..7edc393 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -229,9 +229,16 @@
files = (
);
inputPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
+ "${PODS_ROOT}/../Flutter/Flutter.framework",
+ "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
+ "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@@ -310,7 +317,6 @@
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -383,7 +389,6 @@
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -437,7 +442,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
diff --git a/lib/game/equipment/crafter.dart b/lib/game/equipment/crafter.dart
index 61c177c..ecea93c 100644
--- a/lib/game/equipment/crafter.dart
+++ b/lib/game/equipment/crafter.dart
@@ -30,7 +30,6 @@ class Crafter extends FactoryEquipmentModel{
@override
List tick() {
if(tickDuration > 1 && counter % tickDuration != 1 && _crafted == null){
- print('Not ticking!');
return [];
}
diff --git a/lib/game/equipment/cutter.dart b/lib/game/equipment/cutter.dart
index ec0f30a..8ddb375 100644
--- a/lib/game/equipment/cutter.dart
+++ b/lib/game/equipment/cutter.dart
@@ -19,7 +19,6 @@ class Cutter extends FactoryEquipmentModel{
@override
List tick() {
if(tickDuration > 1 && counter % tickDuration != 1 && _outputMaterial.isEmpty){
- print('Not ticking!');
return [];
}
diff --git a/lib/game/equipment/dispenser.dart b/lib/game/equipment/dispenser.dart
index f294e00..abca752 100644
--- a/lib/game/equipment/dispenser.dart
+++ b/lib/game/equipment/dispenser.dart
@@ -65,6 +65,16 @@ class Dispenser extends FactoryEquipmentModel {
}
}
+ @override
+ void drawTrack(GameTheme theme, Offset offset, Canvas canvas, double size, double progress) {
+ canvas.save();
+ canvas.translate(offset.dx, offset.dy);
+
+ drawSplitter(theme, direction, canvas, size, _materials.isNotEmpty ? progress : 0.0);
+
+ canvas.restore();
+ }
+
@override
void drawEquipment(GameTheme theme, Offset offset, Canvas canvas, double size, double progress) {
double _myProgress = ((counter % tickDuration) / tickDuration) + (progress / tickDuration);
diff --git a/lib/game/equipment/hydraulic_press.dart b/lib/game/equipment/hydraulic_press.dart
index 7230c0a..3b75646 100644
--- a/lib/game/equipment/hydraulic_press.dart
+++ b/lib/game/equipment/hydraulic_press.dart
@@ -19,7 +19,6 @@ class HydraulicPress extends FactoryEquipmentModel{
@override
List tick() {
if(tickDuration > 1 && counter % tickDuration != 1 && _outputMaterial.isEmpty){
- print('Not ticking!');
return [];
}
diff --git a/lib/game/equipment/melter.dart b/lib/game/equipment/melter.dart
index 7a9c934..9d6dd64 100644
--- a/lib/game/equipment/melter.dart
+++ b/lib/game/equipment/melter.dart
@@ -19,7 +19,6 @@ class Melter extends FactoryEquipmentModel{
@override
List tick() {
if(tickDuration > 1 && counter % tickDuration != 1 && _outputMaterial.isEmpty){
- print('Not ticking!');
return [];
}
diff --git a/lib/game/equipment/wire_bender.dart b/lib/game/equipment/wire_bender.dart
index d215e5b..cfc0ccf 100644
--- a/lib/game/equipment/wire_bender.dart
+++ b/lib/game/equipment/wire_bender.dart
@@ -1,7 +1,8 @@
part of factory_equipment;
-class WireBender extends FactoryEquipmentModel{
- WireBender(Coordinates coordinates, Direction direction, {this.wireCapacity = 1, int tickDuration = 1}) : super(coordinates, direction, EquipmentType.wire_bender, tickDuration: tickDuration);
+class WireBender extends FactoryEquipmentModel {
+ WireBender(Coordinates coordinates, Direction direction, {this.wireCapacity = 1, int tickDuration = 1})
+ : super(coordinates, direction, EquipmentType.wire_bender, tickDuration: tickDuration);
final int wireCapacity;
@@ -9,26 +10,22 @@ class WireBender extends FactoryEquipmentModel{
@override
WireBender copyWith({Coordinates coordinates, Direction direction, int wireCapacity}) {
- return WireBender(
- coordinates ?? this.coordinates,
- direction ?? this.direction,
- wireCapacity: wireCapacity ?? this.wireCapacity
- );
+ return WireBender(coordinates ?? this.coordinates, direction ?? this.direction,
+ wireCapacity: wireCapacity ?? this.wireCapacity);
}
@override
List tick() {
- if(tickDuration > 1 && counter % tickDuration != 1 && _outputMaterial.isEmpty){
- print('Not ticking!');
+ if (tickDuration > 1 && counter % tickDuration != 1 && _outputMaterial.isEmpty) {
return [];
}
- if(tickDuration == 1){
+ if (tickDuration == 1) {
final List _fm = []..addAll(_outputMaterial);
_outputMaterial.clear();
_processMaterial();
- _fm.map((FactoryMaterialModel fm){
+ _fm.map((FactoryMaterialModel fm) {
fm.direction = direction;
fm.moveMaterial(type);
}).toList();
@@ -36,7 +33,7 @@ class WireBender extends FactoryEquipmentModel{
return _fm;
}
- if(_outputMaterial.isEmpty){
+ if (_outputMaterial.isEmpty) {
_processMaterial();
return [];
}
@@ -44,7 +41,7 @@ class WireBender extends FactoryEquipmentModel{
final List _material = []..addAll(_outputMaterial);
_outputMaterial.clear();
- _material.map((FactoryMaterialModel fm){
+ _material.map((FactoryMaterialModel fm) {
fm.direction = direction;
fm.moveMaterial(type);
}).toList();
@@ -52,10 +49,10 @@ class WireBender extends FactoryEquipmentModel{
return _material;
}
- void _processMaterial(){
+ void _processMaterial() {
_outputMaterial = objects.getRange(0, min(wireCapacity, objects.length)).toList();
objects.removeRange(0, min(wireCapacity, objects.length));
- _outputMaterial.forEach((FactoryMaterialModel m)=> m.changeState(FactoryMaterialState.spring));
+ _outputMaterial.forEach((FactoryMaterialModel m) => m.changeState(FactoryMaterialState.spring));
}
@override
@@ -63,18 +60,21 @@ class WireBender extends FactoryEquipmentModel{
double _myProgress = ((counter % tickDuration) / tickDuration) + (progress / tickDuration);
double _machineProgress = (counter % tickDuration) >= (tickDuration / 2) ? _myProgress : (1 - _myProgress);
- if(tickDuration == 1){
+ if (tickDuration == 1) {
_machineProgress = (_myProgress > 0.5) ? ((_myProgress * 2) - 1) : (1 - (_myProgress * 2));
}
- if(objects.isEmpty && _outputMaterial.isEmpty){
+ if (objects.isEmpty && _outputMaterial.isEmpty) {
_machineProgress = 0.0;
}
canvas.save();
canvas.translate(offset.dx, offset.dy);
- canvas.drawRRect(RRect.fromRectAndRadius(Rect.fromPoints(Offset(size / 2.4, size / 2.4), Offset(-size / 2.4, -size / 2.4)), Radius.circular(size / 2.4 / 2)), Paint()..color = theme.machineAccentColor);
+ canvas.drawRRect(
+ RRect.fromRectAndRadius(Rect.fromPoints(Offset(size / 2.4, size / 2.4), Offset(-size / 2.4, -size / 2.4)),
+ Radius.circular(size / 2.4 / 2)),
+ Paint()..color = theme.machineAccentColor);
final double _change = Curves.elasticInOut.transform(_machineProgress) * 6.28;
final double _size = size / 4.2;
@@ -105,15 +105,15 @@ class WireBender extends FactoryEquipmentModel{
}
@override
- void drawMaterial(GameTheme theme, Offset offset, Canvas canvas, double size, double progress){
+ void drawMaterial(GameTheme theme, Offset offset, Canvas canvas, double size, double progress) {
double _moveX = 0.0;
double _moveY = 0.0;
- if(_outputMaterial.isEmpty){
+ if (_outputMaterial.isEmpty) {
return;
}
- switch(direction){
+ switch (direction) {
case Direction.east:
_moveX = progress * size;
break;
@@ -128,16 +128,14 @@ class WireBender extends FactoryEquipmentModel{
break;
}
- _outputMaterial.forEach((FactoryMaterialModel fm) => fm.drawMaterial(offset + Offset(_moveX + fm.offsetX, _moveY + fm.offsetY), canvas, progress));
+ _outputMaterial.forEach((FactoryMaterialModel fm) =>
+ fm.drawMaterial(offset + Offset(_moveX + fm.offsetX, _moveY + fm.offsetY), canvas, progress));
}
-
@override
Map toMap() {
final Map _map = super.toMap();
- _map.addAll({
- 'wire_capacity': wireCapacity
- });
+ _map.addAll({'wire_capacity': wireCapacity});
return _map;
}
-}
\ No newline at end of file
+}
diff --git a/lib/game_bloc.dart b/lib/game_bloc.dart
index 433abc0..ec707dc 100644
--- a/lib/game_bloc.dart
+++ b/lib/game_bloc.dart
@@ -565,15 +565,22 @@ class GameBloc {
moneyManager.buyEquipment(e.type, bulkBuy: selectedTiles.length);
}
+ /// TODO: Save and load current upgrades (tick duration/cost/dispenseAmount)
switch (buildSelectedEquipmentType) {
case EquipmentType.dispenser:
- _addEquipment(Dispenser(Coordinates(0, 0), buildSelectedEquipmentDirection, FactoryMaterialType.iron));
+ _addEquipment(Dispenser(
+ Coordinates(0, 0),
+ buildSelectedEquipmentDirection,
+ FactoryMaterialType.iron,
+ dispenseAmount: 1,
+ dispenseTickDuration: 3,
+ ));
break;
case EquipmentType.roller:
_addEquipment(Roller(Coordinates(0, 0), buildSelectedEquipmentDirection));
break;
case EquipmentType.crafter:
- _addEquipment(Crafter(Coordinates(0, 0), buildSelectedEquipmentDirection, null));
+ _addEquipment(Crafter(Coordinates(0, 0), buildSelectedEquipmentDirection, null, craftingTickDuration: 3));
break;
case EquipmentType.splitter:
_addEquipment(
@@ -587,16 +594,16 @@ class GameBloc {
_addEquipment(Seller(Coordinates(0, 0), buildSelectedEquipmentDirection));
break;
case EquipmentType.hydraulic_press:
- _addEquipment(HydraulicPress(Coordinates(0, 0), buildSelectedEquipmentDirection));
+ _addEquipment(HydraulicPress(Coordinates(0, 0), buildSelectedEquipmentDirection, tickDuration: 3));
break;
case EquipmentType.wire_bender:
- _addEquipment(WireBender(Coordinates(0, 0), buildSelectedEquipmentDirection));
+ _addEquipment(WireBender(Coordinates(0, 0), buildSelectedEquipmentDirection, tickDuration: 3));
break;
case EquipmentType.cutter:
- _addEquipment(Cutter(Coordinates(0, 0), buildSelectedEquipmentDirection));
+ _addEquipment(Cutter(Coordinates(0, 0), buildSelectedEquipmentDirection, tickDuration: 3));
break;
case EquipmentType.melter:
- _addEquipment(Melter(Coordinates(0, 0), buildSelectedEquipmentDirection));
+ _addEquipment(Melter(Coordinates(0, 0), buildSelectedEquipmentDirection, tickDuration: 3));
break;
case EquipmentType.freeRoller:
_addEquipment(FreeRoller(Coordinates(0, 0), buildSelectedEquipmentDirection));
diff --git a/lib/ui/screens/floors_screen.dart b/lib/ui/screens/floors_screen.dart
new file mode 100644
index 0000000..7f76629
--- /dev/null
+++ b/lib/ui/screens/floors_screen.dart
@@ -0,0 +1,84 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_factory/game_bloc.dart';
+import 'package:flutter_factory/ui/theme/dynamic_theme.dart';
+import 'package:flutter_factory/ui/theme/theme_provider.dart';
+import 'package:provider/provider.dart';
+
+class FloorsScreen extends StatelessWidget {
+ FloorsScreen({Key key}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ GameBloc _bloc = Provider.of(context);
+
+ return Container(
+ width: MediaQuery.of(context).size.width * 0.8,
+ color: DynamicTheme.of(context).data.menuColor,
+ child: Column(
+ mainAxisSize: MainAxisSize.max,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ SizedBox.shrink(),
+ Container(
+ child: Material(
+ type: MaterialType.transparency,
+ child: InkWell(
+ onTap: () {
+ Navigator.popUntil(context, (Route route) => route.isFirst);
+ },
+ child: Padding(
+ padding: const EdgeInsets.all(24.0),
+ child: Icon(
+ Icons.chevron_left,
+ color: ThemeProvider.of(context).textColor,
+ ),
+ ),
+ ),
+ ),
+ ),
+ Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 8.0),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'Current floor:',
+ style: Theme.of(context).textTheme.button,
+ ),
+ Text(
+ '${_bloc.floor}',
+ style: Theme.of(context).textTheme.button,
+ ),
+ ],
+ ),
+ ),
+ SizedBox(
+ height: 60.0,
+ ),
+ Divider(),
+ Column(
+ children: List.generate(4, (int index) {
+ return Material(
+ type: MaterialType.transparency,
+ child: InkWell(
+ onTap: () {
+ Navigator.pop(context);
+ _bloc.changeFloor(index);
+ },
+ child: Container(height: 80.0, child: Center(child: Text(_bloc.getFloorName(floor: index)))),
+ ),
+ );
+ }),
+ ),
+ ],
+ ),
+ SizedBox.shrink()
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/ui/screens/main_page.dart b/lib/ui/screens/main_page.dart
index 3ac86fc..0acba62 100644
--- a/lib/ui/screens/main_page.dart
+++ b/lib/ui/screens/main_page.dart
@@ -1,11 +1,10 @@
import 'dart:ui';
import 'package:flutter/material.dart';
-import 'package:flutter_factory/game/factory_equipment.dart';
-import 'package:flutter_factory/game/model/factory_equipment_model.dart';
import 'package:flutter_factory/game_bloc.dart';
+import 'package:flutter_factory/ui/screens/floors_screen.dart';
+import 'package:flutter_factory/ui/screens/settings_screen.dart';
import 'package:flutter_factory/ui/theme/dynamic_theme.dart';
-import 'package:flutter_factory/ui/theme/theme_provider.dart';
import 'package:flutter_factory/ui/widgets/game_provider.dart';
import 'package:flutter_factory/ui/widgets/game_widget.dart';
import 'package:flutter_factory/ui/widgets/slide_game_panel.dart';
@@ -38,356 +37,6 @@ class _BackdropHolderState extends State with SingleTickerProvid
super.dispose();
}
- Widget _showSettings() {
- Color _textColor = DynamicTheme.of(context).data.textColor;
-
- return Container(
- padding: const EdgeInsets.all(12.0),
- width: MediaQuery.of(context).size.width * 0.8,
- height: MediaQuery.of(context).size.height,
- color: ThemeProvider.of(context).menuColor,
- child: SingleChildScrollView(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- SizedBox(
- height: 40.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- FloatingActionButton(
- backgroundColor: DynamicTheme.of(context).data.neutralActionButtonColor,
- onPressed: _bloc.increaseGameSpeed,
- child: Icon(
- Icons.chevron_left,
- color: DynamicTheme.of(context).data.neutralActionIconColor,
- ),
- ),
- Text('Tick speed: ${_bloc.gameSpeed} ms',
- style: Theme.of(context).textTheme.subtitle.copyWith(color: _textColor)),
- FloatingActionButton(
- backgroundColor: DynamicTheme.of(context).data.neutralActionButtonColor,
- onPressed: _bloc.decreaseGameSpeed,
- child: Icon(
- Icons.chevron_right,
- color: DynamicTheme.of(context).data.neutralActionIconColor,
- ),
- ),
- ],
- ),
- SwitchListTile(
- contentPadding: EdgeInsets.zero,
- title: Text(
- 'Show arrows',
- style: Theme.of(context).textTheme.subtitle.copyWith(color: _textColor),
- ),
- subtitle: Text(
- 'Visual representation on equipment',
- style: Theme.of(context).textTheme.caption.copyWith(color: _textColor),
- ),
- onChanged: (bool value) {
- setState(() {
- _bloc.showArrows = value;
- });
- },
- value: _bloc.showArrows,
- ),
- SizedBox(
- height: 24.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- 'Select type:',
- style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
- ),
- Stack(
- children: [
- DropdownButton(
- onChanged: (SelectMode tt) {
- _bloc.selectMode = tt;
- },
- style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
- value: _bloc.selectMode,
- items: SelectMode.values.map((SelectMode tt) {
- TextStyle _style = Theme.of(context).textTheme.button;
-
- return DropdownMenuItem(
- value: tt,
- child: Text(
- tt.toString(),
- style: _style,
- ),
- );
- }).toList(),
- ),
- ],
- ),
- ],
- ),
- Column(
- children: [
- Container(
- width: MediaQuery.of(context).size.width,
- height: 60.0,
- child: RaisedButton(
- color: DynamicTheme.of(context).data.positiveActionButtonColor,
- onPressed: () {
- _bloc.equipment
- .where((FactoryEquipmentModel fem) => fem is Dispenser)
- .map((FactoryEquipmentModel fem) => fem)
- .forEach((Dispenser d) {
- d.isWorking = true;
- });
- },
- child: Text(
- 'Turn on all dispensers',
- style: Theme.of(context)
- .textTheme
- .subhead
- .copyWith(color: DynamicTheme.of(context).data.positiveActionIconColor),
- ),
- ),
- ),
- SizedBox(
- height: 8.0,
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- height: 60.0,
- child: RaisedButton(
- color: DynamicTheme.of(context).data.negativeActionButtonColor,
- onPressed: () {
- _bloc.equipment
- .where((FactoryEquipmentModel fem) => fem is Dispenser)
- .map((FactoryEquipmentModel fem) => fem)
- .forEach((Dispenser d) {
- d.isWorking = false;
- });
- },
- child: Text(
- 'Turn off all dispensers',
- style: Theme.of(context)
- .textTheme
- .subhead
- .copyWith(color: DynamicTheme.of(context).data.negativeActionIconColor),
- ),
- ),
- ),
- SizedBox(
- height: 24.0,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- 'Theme:',
- style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
- ),
- Stack(
- children: [
- DropdownButton(
- onChanged: (ThemeType tt) {
- DynamicTheme.of(context).setThemeType(tt);
- },
- style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
- value: DynamicTheme.of(context).data.type,
- items: ThemeType.values.map((ThemeType tt) {
- TextStyle _style = Theme.of(context).textTheme.button;
-
- return DropdownMenuItem(
- value: tt,
- child: Text(
- getThemeName(tt),
- style: _style,
- ),
- );
- }).toList(),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- Container(
- padding: const EdgeInsets.symmetric(horizontal: 12.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisSize: MainAxisSize.max,
- children: [
- Text('Machines: ${_bloc.equipment.length}',
- style: Theme.of(context)
- .textTheme
- .caption
- .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
- Text('Materials: ${_bloc.material.length}',
- style: Theme.of(context)
- .textTheme
- .caption
- .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
- Text('Excess Materials: ${_bloc.getExcessMaterial.length}',
- style: Theme.of(context)
- .textTheme
- .caption
- .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
- Text('FPT: ${_bloc.frameRate}',
- style: Theme.of(context)
- .textTheme
- .caption
- .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
- ],
- ),
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- height: 80.0,
- child: FlatButton(
- onPressed: () {
- _bloc.equipment.forEach((FactoryEquipmentModel fem) {
- fem.objects.clear();
- });
- },
- child: Text(
- 'Vaporize all material on this floor',
- style: Theme.of(context).textTheme.subhead.copyWith(
- color: DynamicTheme.of(context).data.negativeActionButtonColor, fontWeight: FontWeight.w400),
- ),
- ),
- ),
- SizedBox(height: 28.0),
- Container(
- width: MediaQuery.of(context).size.width,
- height: 80.0,
- child: RaisedButton(
- color: DynamicTheme.of(context).data.negativeActionButtonColor,
- onPressed: () async {
- bool _clear = await showDialog(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- title: Text('Clear?'),
- content: Text('Are you sure you want to clear this whole floor?'),
- actions: [
- FlatButton(
- child: Text(
- 'CLEAR',
- style: Theme.of(context)
- .textTheme
- .button
- .copyWith(color: DynamicTheme.of(context).data.negativeActionButtonColor),
- ),
- onPressed: () {
- Navigator.pop(context, true);
- },
- ),
- SizedBox(
- width: 12.0,
- ),
- FlatButton(
- child: Text('CANCEL'),
- onPressed: () {
- Navigator.pop(context, false);
- },
- ),
- ],
- );
- }) ??
- false;
-
- if (_clear) {
- _bloc.clearLine();
- }
- },
- child: Text(
- 'CLEAR LINE',
- style: Theme.of(context)
- .textTheme
- .subhead
- .copyWith(color: DynamicTheme.of(context).data.negativeActionIconColor),
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
-
- Widget _showFloors() {
- return Container(
- width: MediaQuery.of(context).size.width * 0.8,
- color: DynamicTheme.of(context).data.menuColor,
- child: Column(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- SizedBox.shrink(),
- Container(
- child: Material(
- type: MaterialType.transparency,
- child: InkWell(
- onTap: () {
- Navigator.popUntil(context, (Route route) => route.isFirst);
- },
- child: Padding(
- padding: const EdgeInsets.all(24.0),
- child: Icon(
- Icons.chevron_left,
- color: ThemeProvider.of(context).textColor,
- ),
- ),
- ),
- ),
- ),
- Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 8.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- 'Current floor:',
- style: Theme.of(context).textTheme.button,
- ),
- Text(
- '${_bloc.floor}',
- style: Theme.of(context).textTheme.button,
- ),
- ],
- ),
- ),
- SizedBox(
- height: 60.0,
- ),
- Divider(),
- Column(
- children: List.generate(4, (int index) {
- return Material(
- type: MaterialType.transparency,
- child: InkWell(
- onTap: () {
- Navigator.pop(context);
- _bloc.changeFloor(index);
- },
- child: Container(height: 80.0, child: Center(child: Text(_bloc.getFloorName(floor: index)))),
- ),
- );
- }),
- ),
- ],
- ),
- SizedBox.shrink()
- ],
- ),
- );
- }
-
@override
Widget build(BuildContext context) {
_bloc = Provider.of(context);
@@ -395,10 +44,11 @@ class _BackdropHolderState extends State with SingleTickerProvid
return StreamBuilder(
stream: _bloc.gameUpdate,
builder: (BuildContext context, AsyncSnapshot snapshot) {
+ /// TODO: Add bottom navigation bar (game/upgrades/receipts/floors)
return Scaffold(
key: _key,
- drawer: _showFloors(),
- endDrawer: _showSettings(),
+ drawer: FloorsScreen(),
+ endDrawer: SettingsScreen(),
body: GameProvider(
bloc: _bloc,
child: Stack(
diff --git a/lib/ui/screens/settings_screen.dart b/lib/ui/screens/settings_screen.dart
new file mode 100644
index 0000000..a5f5706
--- /dev/null
+++ b/lib/ui/screens/settings_screen.dart
@@ -0,0 +1,289 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_factory/game/factory_equipment.dart';
+import 'package:flutter_factory/game/model/factory_equipment_model.dart';
+import 'package:flutter_factory/game_bloc.dart';
+import 'package:flutter_factory/ui/theme/dynamic_theme.dart';
+import 'package:flutter_factory/ui/theme/theme_provider.dart';
+import 'package:provider/provider.dart';
+
+class SettingsScreen extends StatelessWidget {
+ SettingsScreen({Key key}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ Color _textColor = DynamicTheme.of(context).data.textColor;
+ GameBloc _bloc = Provider.of(context);
+
+ return Container(
+ padding: const EdgeInsets.all(12.0),
+ width: MediaQuery.of(context).size.width * 0.8,
+ height: MediaQuery.of(context).size.height,
+ color: ThemeProvider.of(context).menuColor,
+ child: SingleChildScrollView(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ SizedBox(
+ height: 40.0,
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ FloatingActionButton(
+ backgroundColor: DynamicTheme.of(context).data.neutralActionButtonColor,
+ onPressed: _bloc.increaseGameSpeed,
+ child: Icon(
+ Icons.chevron_left,
+ color: DynamicTheme.of(context).data.neutralActionIconColor,
+ ),
+ ),
+ Text('Tick speed: ${_bloc.gameSpeed} ms',
+ style: Theme.of(context).textTheme.subtitle.copyWith(color: _textColor)),
+ FloatingActionButton(
+ backgroundColor: DynamicTheme.of(context).data.neutralActionButtonColor,
+ onPressed: _bloc.decreaseGameSpeed,
+ child: Icon(
+ Icons.chevron_right,
+ color: DynamicTheme.of(context).data.neutralActionIconColor,
+ ),
+ ),
+ ],
+ ),
+ SwitchListTile(
+ contentPadding: EdgeInsets.zero,
+ title: Text(
+ 'Show arrows',
+ style: Theme.of(context).textTheme.subtitle.copyWith(color: _textColor),
+ ),
+ subtitle: Text(
+ 'Visual representation on equipment',
+ style: Theme.of(context).textTheme.caption.copyWith(color: _textColor),
+ ),
+ onChanged: (bool value) {
+ _bloc.showArrows = value;
+ },
+ value: _bloc.showArrows,
+ ),
+ SizedBox(
+ height: 24.0,
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'Select type:',
+ style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
+ ),
+ Stack(
+ children: [
+ DropdownButton(
+ onChanged: (SelectMode tt) {
+ _bloc.selectMode = tt;
+ },
+ style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
+ value: _bloc.selectMode,
+ items: SelectMode.values.map((SelectMode tt) {
+ TextStyle _style = Theme.of(context).textTheme.button;
+
+ return DropdownMenuItem(
+ value: tt,
+ child: Text(
+ tt.toString(),
+ style: _style,
+ ),
+ );
+ }).toList(),
+ ),
+ ],
+ ),
+ ],
+ ),
+ Column(
+ children: [
+ Container(
+ width: MediaQuery.of(context).size.width,
+ height: 60.0,
+ child: RaisedButton(
+ color: DynamicTheme.of(context).data.positiveActionButtonColor,
+ onPressed: () {
+ _bloc.equipment
+ .where((FactoryEquipmentModel fem) => fem is Dispenser)
+ .map((FactoryEquipmentModel fem) => fem)
+ .forEach((Dispenser d) {
+ d.isWorking = true;
+ });
+ },
+ child: Text(
+ 'Turn on all dispensers',
+ style: Theme.of(context)
+ .textTheme
+ .subhead
+ .copyWith(color: DynamicTheme.of(context).data.positiveActionIconColor),
+ ),
+ ),
+ ),
+ SizedBox(
+ height: 8.0,
+ ),
+ Container(
+ width: MediaQuery.of(context).size.width,
+ height: 60.0,
+ child: RaisedButton(
+ color: DynamicTheme.of(context).data.negativeActionButtonColor,
+ onPressed: () {
+ _bloc.equipment
+ .where((FactoryEquipmentModel fem) => fem is Dispenser)
+ .map((FactoryEquipmentModel fem) => fem)
+ .forEach((Dispenser d) {
+ d.isWorking = false;
+ });
+ },
+ child: Text(
+ 'Turn off all dispensers',
+ style: Theme.of(context)
+ .textTheme
+ .subhead
+ .copyWith(color: DynamicTheme.of(context).data.negativeActionIconColor),
+ ),
+ ),
+ ),
+ SizedBox(
+ height: 24.0,
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'Theme:',
+ style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
+ ),
+ Stack(
+ children: [
+ DropdownButton(
+ onChanged: (ThemeType tt) {
+ DynamicTheme.of(context).setThemeType(tt);
+ },
+ style: Theme.of(context).textTheme.button.copyWith(color: _textColor),
+ value: DynamicTheme.of(context).data.type,
+ items: ThemeType.values.map((ThemeType tt) {
+ TextStyle _style = Theme.of(context).textTheme.button;
+
+ return DropdownMenuItem(
+ value: tt,
+ child: Text(
+ getThemeName(tt),
+ style: _style,
+ ),
+ );
+ }).toList(),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ],
+ ),
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.max,
+ children: [
+ Text('Machines: ${_bloc.equipment.length}',
+ style: Theme.of(context)
+ .textTheme
+ .caption
+ .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
+ Text('Materials: ${_bloc.material.length}',
+ style: Theme.of(context)
+ .textTheme
+ .caption
+ .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
+ Text('Excess Materials: ${_bloc.getExcessMaterial.length}',
+ style: Theme.of(context)
+ .textTheme
+ .caption
+ .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
+ Text('FPT: ${_bloc.frameRate}',
+ style: Theme.of(context)
+ .textTheme
+ .caption
+ .copyWith(color: _textColor, fontSize: 18.0, fontWeight: FontWeight.w300)),
+ ],
+ ),
+ ),
+ Container(
+ width: MediaQuery.of(context).size.width,
+ height: 80.0,
+ child: FlatButton(
+ onPressed: () {
+ _bloc.equipment.forEach((FactoryEquipmentModel fem) {
+ fem.objects.clear();
+ });
+ },
+ child: Text(
+ 'Vaporize all material on this floor',
+ style: Theme.of(context).textTheme.subhead.copyWith(
+ color: DynamicTheme.of(context).data.negativeActionButtonColor, fontWeight: FontWeight.w400),
+ ),
+ ),
+ ),
+ SizedBox(height: 28.0),
+ Container(
+ width: MediaQuery.of(context).size.width,
+ height: 80.0,
+ child: RaisedButton(
+ color: DynamicTheme.of(context).data.negativeActionButtonColor,
+ onPressed: () async {
+ bool _clear = await showDialog(
+ context: context,
+ builder: (BuildContext context) {
+ return AlertDialog(
+ title: Text('Clear?'),
+ content: Text('Are you sure you want to clear this whole floor?'),
+ actions: [
+ FlatButton(
+ child: Text(
+ 'CLEAR',
+ style: Theme.of(context)
+ .textTheme
+ .button
+ .copyWith(color: DynamicTheme.of(context).data.negativeActionButtonColor),
+ ),
+ onPressed: () {
+ Navigator.pop(context, true);
+ },
+ ),
+ SizedBox(
+ width: 12.0,
+ ),
+ FlatButton(
+ child: Text('CANCEL'),
+ onPressed: () {
+ Navigator.pop(context, false);
+ },
+ ),
+ ],
+ );
+ }) ??
+ false;
+
+ if (_clear) {
+ _bloc.clearLine();
+ }
+ },
+ child: Text(
+ 'CLEAR LINE',
+ style: Theme.of(context)
+ .textTheme
+ .subhead
+ .copyWith(color: DynamicTheme.of(context).data.negativeActionIconColor),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/ui/theme/dynamic_theme.dart b/lib/ui/theme/dynamic_theme.dart
index 2ffc28a..7563bdf 100644
--- a/lib/ui/theme/dynamic_theme.dart
+++ b/lib/ui/theme/dynamic_theme.dart
@@ -16,6 +16,8 @@ String getThemeName(ThemeType type) {
case ThemeType.oledDark:
return 'OLED Dark';
}
+
+ return '';
}
typedef ThemedWidgetBuilder = Widget Function(BuildContext context, GameTheme data);
diff --git a/pubspec.lock b/pubspec.lock
index d502c95..93e1589 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,35 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.4.1"
+ version: "2.5.0-nullsafety.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0-nullsafety.1"
+ characters:
+ dependency: transitive
+ description:
+ name: characters
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.3"
+ version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.1"
+ version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.14.12"
+ version: "1.15.0-nullsafety.3"
convert:
dependency: transitive
description:
@@ -56,7 +63,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0-nullsafety.1"
flutter:
dependency: "direct main"
description: flutter
@@ -78,23 +85,21 @@ packages:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.0"
+ version: "1.1.2"
hive:
dependency: "direct main"
description:
name: hive
url: "https://pub.dartlang.org"
source: hosted
- version: "1.4.1+1"
+ version: "1.4.4+1"
hive_flutter:
dependency: "direct main"
description:
- path: hive_flutter
- ref: b6a4b830ea28aab48a7915c978e0132be2bdd3ed
- resolved-ref: b6a4b830ea28aab48a7915c978e0132be2bdd3ed
- url: "https://github.com/jibiel/hive.git"
- source: git
- version: "0.3.0+2"
+ name: hive_flutter
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.3.1"
http:
dependency: transitive
description:
@@ -109,27 +114,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
- js:
- dependency: transitive
- description:
- name: js
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.6.1+1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.6"
+ version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.8"
+ version: "1.3.0-nullsafety.3"
nested:
dependency: transitive
description:
@@ -143,7 +141,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0-nullsafety.1"
path_provider:
dependency: transitive
description:
@@ -192,7 +190,7 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
- version: "4.0.5+1"
+ version: "4.3.3"
random_color:
dependency: "direct main"
description:
@@ -206,7 +204,7 @@ packages:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
- version: "0.24.0"
+ version: "0.25.0"
sky_engine:
dependency: transitive
description: flutter
@@ -218,56 +216,63 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.7.0"
+ version: "1.8.0-nullsafety.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.9.3"
+ version: "1.10.0-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "2.1.0-nullsafety.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.5"
+ version: "1.1.0-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0-nullsafety.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.15"
+ version: "0.2.19-nullsafety.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.6"
+ version: "1.3.0-nullsafety.3"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
- version: "5.4.5"
+ version: "5.7.10"
+ url_launcher_linux:
+ dependency: transitive
+ description:
+ name: url_launcher_linux
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.0.1+4"
url_launcher_macos:
dependency: transitive
description:
@@ -281,21 +286,28 @@ packages:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.6"
+ version: "1.0.9"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.1+2"
+ version: "0.1.5+3"
+ url_launcher_windows:
+ dependency: transitive
+ description:
+ name: url_launcher_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.0.1+3"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.8"
+ version: "2.1.0-nullsafety.3"
sdks:
- dart: ">=2.6.0 <3.0.0"
- flutter: ">=1.12.13+hotfix.5 <2.0.0"
+ dart: ">=2.10.0-110 <2.11.0"
+ flutter: ">=1.22.0 <2.0.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 587b725..80e2dad 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 0.1.3+2
+version: 0.1.3+3
environment:
sdk: ">=2.1.0 <3.0.0"
@@ -20,19 +20,15 @@ dependencies:
flutter:
sdk: flutter
- rxdart: ^0.24.0
- url_launcher: ^5.4.5
- hive: ^1.4.1+1
+ rxdart: ^0.25.0
+ url_launcher: ^5.7.10
+ hive: ^1.4.4+1
- hive_flutter:
- git:
- path: hive_flutter
- url: https://github.com/jibiel/hive.git
- ref: b6a4b830ea28aab48a7915c978e0132be2bdd3ed
+ hive_flutter: ^0.3.1
random_color: ^1.0.5
- provider: ^4.0.5+1
- google_fonts: ^1.0.0
+ provider: ^4.3.3
+ google_fonts: ^1.1.2
dev_dependencies:
flutter_test: