Merge branch 'sliver_switch'
This commit is contained in:
commit
26f3809116
30 changed files with 4566 additions and 328 deletions
12
CHANGELOG.TXT
Normal file
12
CHANGELOG.TXT
Normal file
|
@ -0,0 +1,12 @@
|
|||
v2.0.2
|
||||
- added translucency to the navigation bar on iOS
|
||||
|
||||
v2.0.1
|
||||
- added a little separation between the arrows and the text in the stations list
|
||||
- fine tuned the positioning, centering items when they are supposed to be centered
|
||||
- changed text from "sosește" to "sosire", in order to match "plecare"
|
||||
|
||||
v2.0.0
|
||||
Rewritten!
|
||||
- separate UI for Android and iOS
|
||||
- uses WebView to get data on device instead of relying on server
|
1
assets/lines/atc.json
Normal file
1
assets/lines/atc.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"short_name":"ATC","operator":"Astra Trans Carpatic","data_export":"20171212","valabil":{"de_la":"20171210","pana_la":"20181208"},"versiune":"1","trenuri":[{"rang":"IR","numar":"15510","numar_intern":15510},{"rang":"IR","numar":"15511","numar_intern":15511},{"rang":"IR","numar":"15512","numar_intern":15512},{"rang":"IR","numar":"15513*","numar_intern":15513},{"rang":"IR","numar":"15513","numar_intern":15513},{"rang":"IR","numar":"15514","numar_intern":15514},{"rang":"IR","numar":"15514","numar_intern":15514},{"rang":"IR","numar":"15516","numar_intern":15516},{"rang":"IR","numar":"15520","numar_intern":15520},{"rang":"IR","numar":"15521*","numar_intern":15521},{"rang":"IR","numar":"15521","numar_intern":15521},{"rang":"IR","numar":"15522","numar_intern":15522},{"rang":"IR","numar":"15522","numar_intern":15522},{"rang":"IR","numar":"15523","numar_intern":15523},{"rang":"IR","numar":"15523","numar_intern":15523},{"rang":"IR","numar":"15527","numar_intern":15527},{"rang":"IR","numar":"15528","numar_intern":15528},{"rang":"IR","numar":"15529","numar_intern":15529},{"rang":"IR","numar":"15531","numar_intern":15531},{"rang":"IR","numar":"15532","numar_intern":15532},{"rang":"IR","numar":"15533","numar_intern":15533},{"rang":"IR","numar":"15533e","numar_intern":15533},{"rang":"IR","numar":"15534","numar_intern":15534},{"rang":"IR","numar":"15535","numar_intern":15535},{"rang":"IR","numar":"15536","numar_intern":15536},{"rang":"IR","numar":"15537-2","numar_intern":15537},{"rang":"IR","numar":"15538","numar_intern":15538},{"rang":"IR","numar":"15540","numar_intern":15540},{"rang":"IR","numar":"15541","numar_intern":15541},{"rang":"IR","numar":"15541","numar_intern":15541},{"rang":"IR","numar":"15542","numar_intern":15542},{"rang":"IR","numar":"15542","numar_intern":15542},{"rang":"IR","numar":"15543","numar_intern":15543},{"rang":"IR","numar":"15544","numar_intern":15544},{"rang":"IR","numar":"15545","numar_intern":15545},{"rang":"IR","numar":"15546*","numar_intern":15546},{"rang":"IR","numar":"15546","numar_intern":15546},{"rang":"IR","numar":"15547","numar_intern":15547},{"rang":"IR","numar":"15548","numar_intern":15548},{"rang":"IR","numar":"15549*","numar_intern":15549},{"rang":"IR","numar":"15549b","numar_intern":15549},{"rang":"IR","numar":"15551","numar_intern":15551},{"rang":"IR","numar":"15552","numar_intern":15552},{"rang":"IR","numar":"15553","numar_intern":15553},{"rang":"IR","numar":"15581","numar_intern":15581},{"rang":"IR","numar":"15582","numar_intern":15582},{"rang":"IR","numar":"15582***","numar_intern":15582},{"rang":"IR","numar":"15583","numar_intern":15583},{"rang":"IR","numar":"15590","numar_intern":15590},{"rang":"IR","numar":"15591","numar_intern":15591},{"rang":"IR","numar":"15592","numar_intern":15592},{"rang":"IR","numar":"15593","numar_intern":15593},{"rang":"R","numar":"*P18801","numar_intern":null},{"rang":"IR","numar":"*15546","numar_intern":null},{"rang":"R","numar":"**P18801","numar_intern":null},{"rang":"IR","numar":"*15591","numar_intern":null},{"rang":"R","numar":"**P18800","numar_intern":null},{"rang":"IR","numar":"15593","numar_intern":15593},{"rang":"IR","numar":"15594","numar_intern":15594},{"rang":"IR","numar":"15595-2","numar_intern":15595},{"rang":"R","numar":"18800","numar_intern":18800},{"rang":"R","numar":"18801","numar_intern":18801},{"rang":"IR","numar":"18826","numar_intern":18826},{"rang":"IR","numar":"18851","numar_intern":18851},{"rang":"IR","numar":"18852","numar_intern":18852}]}
|
1
assets/lines/cfr.json
Normal file
1
assets/lines/cfr.json
Normal file
File diff suppressed because one or more lines are too long
6
assets/lines/files.txt
Normal file
6
assets/lines/files.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
atc.json
|
||||
cfr.json
|
||||
interregional.json
|
||||
rc.json
|
||||
st.json
|
||||
tfc.json
|
1
assets/lines/interregional.json
Normal file
1
assets/lines/interregional.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/lines/rc.json
Normal file
1
assets/lines/rc.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/lines/st.json
Normal file
1
assets/lines/st.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"short_name":"Softrans","operator":"Softrans S.R.L.","data_export":"20181212","valabil":{"de_la":"20181209","pana_la":"20191214"},"versiune":"1","trenuri":[{"rang":"IR","numar":"15931-2","numar_intern":15931},{"rang":"IR","numar":"15932","numar_intern":15932},{"rang":"IR","numar":"15933-2","numar_intern":15933},{"rang":"IR","numar":"15934","numar_intern":15934},{"rang":"IR","numar":"15935-2","numar_intern":15935},{"rang":"IR","numar":"15936","numar_intern":15936},{"rang":"IR","numar":"15982","numar_intern":15982},{"rang":"IR","numar":"15984","numar_intern":15984}]}
|
1
assets/lines/tfc.json
Normal file
1
assets/lines/tfc.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -1 +1,2 @@
|
|||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
|
74
ios/Podfile
Normal file
74
ios/Podfile
Normal file
|
@ -0,0 +1,74 @@
|
|||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def parse_KV_file(file, separator='=')
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return [];
|
||||
end
|
||||
pods_ary = []
|
||||
skip_line_start_symbols = ["#", "/"]
|
||||
File.foreach(file_abs_path) { |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)
|
||||
pods_ary.push({:name => podname, :path => podpath});
|
||||
else
|
||||
puts "Invalid plugin specification: #{line}"
|
||||
end
|
||||
}
|
||||
return pods_ary
|
||||
end
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
|
||||
# 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')
|
||||
|
||||
# Flutter Pods
|
||||
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
|
||||
if generated_xcode_build_settings.empty?
|
||||
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
|
||||
end
|
||||
generated_xcode_build_settings.map { |p|
|
||||
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
||||
symlink = File.join('.symlinks', 'flutter')
|
||||
File.symlink(File.dirname(p[:path]), symlink)
|
||||
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
|
||||
end
|
||||
}
|
||||
|
||||
# Plugin Pods
|
||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||
plugin_pods.map { |p|
|
||||
symlink = File.join('.symlinks', 'plugins', p[:name])
|
||||
File.symlink(p[:path], symlink)
|
||||
pod p[:name], :path => File.join(symlink, 'ios')
|
||||
}
|
||||
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
|
||||
end
|
||||
end
|
22
ios/Podfile.lock
Normal file
22
ios/Podfile.lock
Normal file
|
@ -0,0 +1,22 @@
|
|||
PODS:
|
||||
- Flutter (1.0.0)
|
||||
- webview_flutter (0.0.1):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `.symlinks/flutter/ios`)
|
||||
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: ".symlinks/flutter/ios"
|
||||
webview_flutter:
|
||||
:path: ".symlinks/plugins/webview_flutter/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
|
||||
webview_flutter: 1aa7604e6cdb451a9b7ed2c37d5454c0b440246b
|
||||
|
||||
PODFILE CHECKSUM: b6a0a141693093b304368d08511b46cf3d1d0ac5
|
||||
|
||||
COCOAPODS: 1.6.1
|
|
@ -11,6 +11,7 @@
|
|||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
|
||||
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
722F441253D3B79676E4DE80 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F72320B12B1F4015789BBC8E /* Pods_Runner.framework */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
|
||||
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
|
@ -38,10 +39,13 @@
|
|||
/* Begin PBXFileReference section */
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
313F1E773DA06364A0C4F20A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
|
||||
636963D381657D3BAEDC0A47 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
74CD890ACD2E394E606FCBEB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
|
@ -51,6 +55,7 @@
|
|||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F72320B12B1F4015789BBC8E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -60,12 +65,21 @@
|
|||
files = (
|
||||
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
|
||||
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
|
||||
722F441253D3B79676E4DE80 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
0B24EBF53F1DCC708FA961FD /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F72320B12B1F4015789BBC8E /* Pods_Runner.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -85,6 +99,8 @@
|
|||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
A2E7A2EB20EFBBAC4AB0299B /* Pods */,
|
||||
0B24EBF53F1DCC708FA961FD /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
@ -119,6 +135,16 @@
|
|||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A2E7A2EB20EFBBAC4AB0299B /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
313F1E773DA06364A0C4F20A /* Pods-Runner.debug.xcconfig */,
|
||||
74CD890ACD2E394E606FCBEB /* Pods-Runner.release.xcconfig */,
|
||||
636963D381657D3BAEDC0A47 /* Pods-Runner.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
@ -126,12 +152,14 @@
|
|||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
0D525F98970BF5A8EFFD825C /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
1B7EDCF8AB293318D8391906 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -155,6 +183,7 @@
|
|||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = NF9A3KMT8Q;
|
||||
LastSwiftMigration = 0910;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -192,6 +221,47 @@
|
|||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
0D525F98970BF5A8EFFD825C /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
1B7EDCF8AB293318D8391906 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -309,6 +379,8 @@
|
|||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = NF9A3KMT8Q;
|
||||
ENABLE_BITCODE = NO;
|
||||
|
@ -317,6 +389,7 @@
|
|||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -324,6 +397,7 @@
|
|||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ml.dandevelop.infoTren;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 4.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
|
@ -443,6 +517,8 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = NF9A3KMT8Q;
|
||||
ENABLE_BITCODE = NO;
|
||||
|
@ -451,6 +527,7 @@
|
|||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -458,6 +535,7 @@
|
|||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ml.dandevelop.infoTren;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = On;
|
||||
|
@ -472,6 +550,8 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = NF9A3KMT8Q;
|
||||
ENABLE_BITCODE = NO;
|
||||
|
@ -480,6 +560,7 @@
|
|||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -487,6 +568,7 @@
|
|||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ml.dandevelop.infoTren;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = On;
|
||||
SWIFT_VERSION = 4.0;
|
||||
|
|
3
ios/Runner.xcworkspace/contents.xcworkspacedata
generated
3
ios/Runner.xcworkspace/contents.xcworkspacedata
generated
|
@ -4,4 +4,7 @@
|
|||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
|
@ -52,5 +52,7 @@
|
|||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>io.flutter.embedded_views_preview</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
23
lib/hidden_webview.dart
Normal file
23
lib/hidden_webview.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class HiddenWebView extends StatelessWidget {
|
||||
final WebView webView;
|
||||
final Widget child;
|
||||
|
||||
HiddenWebView({@required this.child, this.webView});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
Offstage(
|
||||
offstage: true,
|
||||
child: webView,
|
||||
),
|
||||
Positioned.fill(child: child)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
345
lib/main.dart
345
lib/main.dart
|
@ -1,247 +1,168 @@
|
|||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:info_tren/train_info_page/train_info_prompt.dart';
|
||||
|
||||
import 'models/train_data.dart';
|
||||
import 'train_info_display.dart';
|
||||
|
||||
void main() => runApp(MyApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
void main() => runApp(StartPoint());
|
||||
|
||||
class StartPoint extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Info Tren',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
brightness: Brightness.dark,
|
||||
primaryColor: Colors.blue.shade600,
|
||||
accentColor: Colors.blue.shade700,
|
||||
),
|
||||
home: MainPageWrapper(),
|
||||
);
|
||||
if (Platform.isAndroid) {
|
||||
return MaterialApp(
|
||||
title: 'Info Tren',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
brightness: Brightness.dark,
|
||||
primaryColor: Colors.blue.shade600,
|
||||
accentColor: Colors.blue.shade700,
|
||||
),
|
||||
home: MainPageMaterial(),
|
||||
);
|
||||
}
|
||||
else if (Platform.isIOS) {
|
||||
return CupertinoApp(
|
||||
title: "Info Tren",
|
||||
theme: CupertinoThemeData(
|
||||
primaryColor: Colors.blue.shade600,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
home: MainPageCupertino(),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class MainPageWrapper extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TrainDataSourceWidget(
|
||||
child: MainPage()
|
||||
);
|
||||
mixin MainPageAction {
|
||||
onTrainInfoPageInvoke(BuildContext context) {
|
||||
if (Platform.isAndroid) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return TrainInfoPromptMaterial();
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (Platform.isIOS) {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) {
|
||||
return TrainInfoPromptCupertino();
|
||||
},
|
||||
title: "Informații despre tren"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
onStationBoardPageInvoke(BuildContext context) {
|
||||
|
||||
}
|
||||
|
||||
onRoutePlanPageInvoke(BuildContext context) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class MainPage extends StatefulWidget {
|
||||
@override
|
||||
_MainPageState createState() => _MainPageState();
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
final trainNumberController = TextEditingController();
|
||||
bool showAlternate = false;
|
||||
|
||||
bool get shouldTap {
|
||||
return trainNumberController.text.isNotEmpty;
|
||||
}
|
||||
|
||||
onTap(BuildContext context) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
TrainDataSourceWidget.of(context).lookup(trainNumberController.text, showAlternate);
|
||||
}
|
||||
|
||||
class MainPageMaterial extends StatelessWidget with MainPageAction {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Info Tren"),
|
||||
centerTitle: true,
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.settings),
|
||||
onPressed: () {
|
||||
showModalBottomSheet(context: context, builder: (context) {
|
||||
return StatefulBuilder(
|
||||
builder: (context, ssSheet) =>
|
||||
SafeArea(
|
||||
bottom: true,
|
||||
top: false,
|
||||
left: true,
|
||||
right: true,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
title: Text(
|
||||
showAlternate
|
||||
? "Afișează rezultatul principal"
|
||||
: "Afișează rezultatul alternativ"
|
||||
),
|
||||
onTap: () {
|
||||
showAlternate = !showAlternate;
|
||||
setState(() {});
|
||||
ssSheet(() {});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
body: SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: trainNumberController,
|
||||
onChanged: (_) => setState(() => {}),
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Numărul trenului",
|
||||
border: OutlineInputBorder(),
|
||||
hintText: "Scrieți doar numărul"
|
||||
),
|
||||
onSubmitted: (_) {
|
||||
if (shouldTap) {
|
||||
onTap(context);
|
||||
}
|
||||
},
|
||||
keyboardType: TextInputType.numberWithOptions(),
|
||||
textInputAction: TextInputAction.search,
|
||||
),
|
||||
RaisedButton(
|
||||
child: Text(
|
||||
"Informații despre tren",
|
||||
style: Theme.of(context).textTheme.button.copyWith(fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
onTrainInfoPageInvoke(context);
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RaisedButton(
|
||||
child: Text("Caută"),
|
||||
onPressed: (() {
|
||||
if (!shouldTap) return null;
|
||||
return () {
|
||||
onTap(context);
|
||||
};
|
||||
})(),
|
||||
RaisedButton(
|
||||
child: Text(
|
||||
"Tabelă plecari/sosiri",
|
||||
style: Theme.of(context).textTheme.button.copyWith(fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
onStationBoardPageInvoke(context);
|
||||
},
|
||||
),
|
||||
RaisedButton(
|
||||
child: Text(
|
||||
"Planificare rută",
|
||||
style: Theme.of(context).textTheme.button.copyWith(fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
onRoutePlanPageInvoke(context);
|
||||
},
|
||||
)
|
||||
],
|
||||
].map((w) => Padding(
|
||||
padding: const EdgeInsets.fromLTRB(4, 2, 4, 2),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: w,
|
||||
),
|
||||
)).toList(),
|
||||
),
|
||||
Text(
|
||||
showAlternate
|
||||
? "Se va afișa rezultatul alternativ\nla următoarea căutare"
|
||||
: "Se va afișa rezultatul principal\nla următoarea căutare",
|
||||
style: Theme.of(context).textTheme.caption.copyWith(fontStyle: FontStyle.italic),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).accentColor,
|
||||
height: 4,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TrainInfoDisplay(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TrainInfoDisplay extends StatelessWidget {
|
||||
class MainPageCupertino extends StatelessWidget with MainPageAction {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StreamBuilder<TrainDataEvent>(
|
||||
stream: TrainDataSourceWidget.of(context).dataStream,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState != ConnectionState.active) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
if (snapshot.hasError) {
|
||||
final error = snapshot.error as TrainDataEvent;
|
||||
|
||||
if (error.kind == TrainDataEventKind.NOT_FOUND) {
|
||||
return Center(
|
||||
child: Text(
|
||||
"Train number ${error.trainNumber}\nwas not found!",
|
||||
style: Theme.of(context).textTheme.headline,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (error.kind == TrainDataEventKind.TIMEOUT) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"The request has timed out!",
|
||||
style: Theme.of(context).textTheme.headline,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RaisedButton(
|
||||
child: Text("Retry"),
|
||||
onPressed: () {
|
||||
TrainDataSourceWidget.of(context).lookup(error.trainNumber);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (error.kind == TrainDataEventKind.UNKNOWN_ERROR) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text("An unknown error with the status code ${error.errorStatusCode} has occured."),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RaisedButton(
|
||||
child: Text("Retry"),
|
||||
onPressed: () {
|
||||
TrainDataSourceWidget.of(context).lookup(error.trainNumber);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text("Info Tren"),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
CupertinoButton.filled(
|
||||
child: Text("Informații despre tren"),
|
||||
onPressed: () {
|
||||
onTrainInfoPageInvoke(context);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (snapshot.hasData) {
|
||||
if (snapshot.data.kind == TrainDataEventKind.LOADING) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (snapshot.data.kind == TrainDataEventKind.GOT_DATA) {
|
||||
return TrainInfoDisplayData(snapshot.data.trainData);
|
||||
}
|
||||
}
|
||||
|
||||
return Placeholder();
|
||||
},
|
||||
CupertinoButton.filled(
|
||||
child: Text("Tabelă plecari/sosiri"),
|
||||
onPressed: () {
|
||||
onStationBoardPageInvoke(context);
|
||||
},
|
||||
),
|
||||
CupertinoButton.filled(
|
||||
child: Text("Planificare rută"),
|
||||
onPressed: () {
|
||||
onRoutePlanPageInvoke(context);
|
||||
},
|
||||
),
|
||||
].map((w) => Padding(
|
||||
padding: const EdgeInsets.fromLTRB(4, 2, 4, 2),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: w,
|
||||
),
|
||||
)).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -172,8 +172,13 @@ class StopOnLineDetails extends StatelessWidget {
|
|||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
if (station.observations == "ONI")
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8.0, 1.0, 8.0, 8.0),
|
||||
padding: const EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.5),
|
||||
child: Text("oprire ne-itinerarică", style: Theme.of(context).textTheme.body1.copyWith(color: Colors.red.shade700),),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8.0, 0.5, 8.0, 8.0),
|
||||
child: Text(
|
||||
"km ${station.km}",
|
||||
style: Theme.of(context).textTheme.caption,
|
||||
|
|
70
lib/train_info_page/train_info.dart
Normal file
70
lib/train_info_page/train_info.dart
Normal file
|
@ -0,0 +1,70 @@
|
|||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import 'package:info_tren/models/train_data.dart';
|
||||
import 'package:info_tren/train_info_page/train_info_cupertino.dart';
|
||||
import 'package:info_tren/train_info_page/train_info_material.dart';
|
||||
|
||||
mixin TrainInfoMixin {
|
||||
String title;
|
||||
bool showTrainData;
|
||||
TrainLookupResult lookupResult;
|
||||
bool requestedData;
|
||||
}
|
||||
|
||||
class TrainInfo extends StatelessWidget {
|
||||
final int trainNumber;
|
||||
|
||||
TrainInfo({@required this.trainNumber});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TrainDataWebViewAdapter(
|
||||
builder: (context) {
|
||||
if (Platform.isAndroid) {
|
||||
return TrainInfoMaterial(trainNumber: trainNumber,);
|
||||
}
|
||||
else if (Platform.isIOS) {
|
||||
return TrainInfoCupertino(trainNumber: trainNumber,);
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
typedef FutureDisplayCallback<T>(BuildContext context, T data);
|
||||
|
||||
class FutureDisplay<T> extends StatelessWidget {
|
||||
final Future<T> future;
|
||||
final FutureDisplayCallback<T> builder;
|
||||
|
||||
FutureDisplay({Key key, @required this.future, @required this.builder}): super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder(
|
||||
future: future,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) return builder(context, snapshot.data);
|
||||
if (snapshot.hasError) throw snapshot.error;
|
||||
if (snapshot.connectionState == ConnectionState.done) return Container();
|
||||
|
||||
Widget loadingWidget;
|
||||
if (Platform.isAndroid) {
|
||||
loadingWidget = CircularProgressIndicator();
|
||||
}
|
||||
else if (Platform.isIOS) {
|
||||
loadingWidget = CupertinoActivityIndicator();
|
||||
}
|
||||
|
||||
return Center(
|
||||
child: loadingWidget,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
254
lib/train_info_page/train_info_animation_helpers.dart
Normal file
254
lib/train_info_page/train_info_animation_helpers.dart
Normal file
|
@ -0,0 +1,254 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:info_tren/train_info_page/train_info_constants.dart';
|
||||
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
class AnimatedBackground extends StatefulWidget {
|
||||
final Color initialColor;
|
||||
final Color backgroundColor;
|
||||
final Widget child;
|
||||
final Duration animationDuration;
|
||||
|
||||
AnimatedBackground({Key key, @required this.initialColor, @required this.backgroundColor, Duration animationDuration, @required this.child})
|
||||
: this.animationDuration = animationDuration ?? Duration(milliseconds: 250)
|
||||
, super(key: key);
|
||||
|
||||
@override
|
||||
State<AnimatedBackground> createState() => _AnimatedBackgroundState();
|
||||
}
|
||||
|
||||
class _AnimatedBackgroundState extends State<AnimatedBackground> with SingleTickerProviderStateMixin {
|
||||
AnimationController controller;
|
||||
Animatable<Color> animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
controller = AnimationController(vsync: this, duration: widget.animationDuration);
|
||||
controller.forward();
|
||||
animation = ColorTween(begin: widget.initialColor, end: widget.backgroundColor);
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(AnimatedBackground oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
if (oldWidget.backgroundColor != widget.backgroundColor) {
|
||||
controller = AnimationController(
|
||||
duration: widget.animationDuration,
|
||||
vsync: this
|
||||
);
|
||||
controller.forward();
|
||||
|
||||
animation = ColorTween(
|
||||
begin: oldWidget.backgroundColor,
|
||||
end: widget.backgroundColor
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedBuilder(
|
||||
animation: controller,
|
||||
child: widget.child,
|
||||
builder: (context, child) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: animation.evaluate(controller),
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ProgressReportDisplayEntry extends StatefulWidget {
|
||||
final bool completed;
|
||||
final String waitingText;
|
||||
final String completedText;
|
||||
String get text => completed ? completedText : waitingText;
|
||||
|
||||
ProgressReportDisplayEntry({Key key, @required this.completed, @required this.waitingText, @required this.completedText}): super(key: key);
|
||||
|
||||
@override
|
||||
State<ProgressReportDisplayEntry> createState() {
|
||||
if (Platform.isIOS) {
|
||||
return _ProgressReportDisplayEntryCupertinoState();
|
||||
}
|
||||
else if (Platform.isAndroid) {
|
||||
return _ProgressReportDisplayEntryMaterialState();
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
|
||||
class _ProgressReportDisplayEntryCupertinoState extends State<ProgressReportDisplayEntry> with SingleTickerProviderStateMixin {
|
||||
Animatable<Color> background;
|
||||
Animatable<Color> checkMark;
|
||||
AnimationController _controller;
|
||||
|
||||
initAnimation() {
|
||||
background = ColorTween(
|
||||
begin: CupertinoTheme.of(context).scaffoldBackgroundColor,
|
||||
end: BACKGROUND_GREEN,
|
||||
);
|
||||
checkMark = ColorTween(
|
||||
begin: FOREGROUND_WHITE,
|
||||
end: FOREGROUND_GREEN,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_controller = AnimationController(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
vsync: this,
|
||||
);
|
||||
_controller.value = widget.completed ? 1 : 0;
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
initAnimation();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(ProgressReportDisplayEntry oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.completed != widget.completed) {
|
||||
if (widget.completed) {
|
||||
_controller.forward();
|
||||
}
|
||||
else {
|
||||
_controller.reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, _) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: background.evaluate(_controller)
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child:
|
||||
!widget.completed
|
||||
? CupertinoActivityIndicator()
|
||||
: Icon(CupertinoIcons.check_mark_circled, color: checkMark.evaluate(_controller)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(widget.text),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ProgressReportDisplayEntryMaterialState extends State<ProgressReportDisplayEntry> with SingleTickerProviderStateMixin {
|
||||
Animatable<Color> background;
|
||||
Animatable<Color> checkMark;
|
||||
AnimationController _controller;
|
||||
|
||||
initAnimation() {
|
||||
background = ColorTween(
|
||||
begin: Theme.of(context).scaffoldBackgroundColor,
|
||||
end: Colors.green,
|
||||
);
|
||||
checkMark = ColorTween(
|
||||
begin: Colors.white,
|
||||
end: Colors.greenAccent,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_controller = AnimationController(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
vsync: this,
|
||||
);
|
||||
_controller.value = widget.completed ? 1 : 0;
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
initAnimation();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(ProgressReportDisplayEntry oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.completed != widget.completed) {
|
||||
if (widget.completed) {
|
||||
_controller.forward();
|
||||
}
|
||||
else {
|
||||
_controller.reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedBuilder(
|
||||
animation: _controller,
|
||||
builder: (context, _) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: background.evaluate(_controller)
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child:
|
||||
!widget.completed
|
||||
? CircularProgressIndicator(strokeWidth: 2, valueColor: AlwaysStoppedAnimation(Colors.orangeAccent),)
|
||||
: Icon(Icons.check_circle, color: checkMark.evaluate(_controller), size: 32,),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(widget.text),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
10
lib/train_info_page/train_info_constants.dart
Normal file
10
lib/train_info_page/train_info_constants.dart
Normal file
|
@ -0,0 +1,10 @@
|
|||
import 'dart:ui';
|
||||
|
||||
const BACKGROUND_GREEN = Color.fromRGBO(5, 66, 10, 1);
|
||||
const FOREGROUND_GREEN = Color.fromRGBO(20, 180, 50, 1);
|
||||
|
||||
const BACKGROUND_RED = Color.fromRGBO(66, 10, 5, 1);
|
||||
|
||||
const FOREGROUND_WHITE = Color.fromRGBO(240, 250, 240, 1);
|
||||
|
||||
const FOREGROUND_DARK_GREY = Color.fromRGBO(55, 55, 55, 1);
|
1238
lib/train_info_page/train_info_cupertino.dart
Normal file
1238
lib/train_info_page/train_info_cupertino.dart
Normal file
File diff suppressed because it is too large
Load diff
1165
lib/train_info_page/train_info_material.dart
Normal file
1165
lib/train_info_page/train_info_material.dart
Normal file
File diff suppressed because it is too large
Load diff
402
lib/train_info_page/train_info_prompt.dart
Normal file
402
lib/train_info_page/train_info_prompt.dart
Normal file
|
@ -0,0 +1,402 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:info_tren/train_info_page/train_info.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
part 'train_info_prompt.g.dart';
|
||||
|
||||
typedef TrainSelectedCallback(int trainNumber);
|
||||
|
||||
mixin TrainInfoPromptAction {
|
||||
onTrainSelected(BuildContext context, int selection) {
|
||||
if (Platform.isAndroid) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return TrainInfo(
|
||||
trainNumber: selection,
|
||||
);
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (Platform.isIOS) {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
title: "Informații despre trenul $selection",
|
||||
builder: (context) {
|
||||
return TrainInfo(
|
||||
trainNumber: selection,
|
||||
);
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mixin TrainInfoPromptListHandling {
|
||||
List<TrainOperatorLines> operators = List();
|
||||
|
||||
Future loadOperators(BuildContext context) async {
|
||||
operators = List();
|
||||
|
||||
final operatorsString = await DefaultAssetBundle.of(context).loadString("assets/lines/files.txt");
|
||||
final operatorsFilesList = operatorsString.split("\n");
|
||||
|
||||
final decoder = JsonDecoder();
|
||||
|
||||
for (final operatorFile in operatorsFilesList) {
|
||||
final operatorString = await DefaultAssetBundle.of(context).loadString("assets/lines/$operatorFile");
|
||||
final operatorData = decoder.convert(operatorString);
|
||||
final _operator = TrainOperatorLines.fromJson(operatorData);
|
||||
operators.add(_operator);
|
||||
}
|
||||
}
|
||||
|
||||
Widget getOperatorsListView(BuildContext context, {String currentInput = "", @required TrainSelectedCallback onTrainSelected}) {
|
||||
var sliversTuple = operators.map(
|
||||
(op) => Tuple2(
|
||||
getFilteredLines(op, currentInput),
|
||||
getOperatorSliver(context, op, currentInput, onTrainSelected)
|
||||
)
|
||||
)
|
||||
.where((tuple) => tuple.item1.isNotEmpty).toList();
|
||||
if (currentInput.isNotEmpty) sliversTuple.sort((a, b) {
|
||||
final aTrain = a.item1.first;
|
||||
final bTrain = b.item1.first;
|
||||
|
||||
final inputAsRegExp = RegExp(currentInput);
|
||||
|
||||
final matchOnA = inputAsRegExp.firstMatch(aTrain.number);
|
||||
final matchOnB = inputAsRegExp.firstMatch(bTrain.number);
|
||||
|
||||
if (matchOnA.start != matchOnB.start) return matchOnA.start - matchOnB.start;
|
||||
|
||||
if (aTrain.number.length != bTrain.number.length) return aTrain.number.length - bTrain.number.length;
|
||||
|
||||
return aTrain.number.compareTo(bTrain.number);
|
||||
});
|
||||
var slivers = sliversTuple.map((tuple) => tuple.item2).toList();
|
||||
|
||||
return CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
...slivers,
|
||||
SliverToBoxAdapter(
|
||||
child: getUseCurrentInputWidget(currentInput, onTrainSelected),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).viewPadding.bottom,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget getUseCurrentInputWidget(String currentInput, TrainSelectedCallback onTrainSelected) {
|
||||
if (currentInput.isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
if (int.tryParse(currentInput) == null) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
if (Platform.isAndroid)
|
||||
ListTile(
|
||||
title: Text("Caută trenul cu numărul $currentInput"),
|
||||
onTap: () {
|
||||
onTrainSelected(int.parse(currentInput));
|
||||
},
|
||||
)
|
||||
else if (Platform.isIOS)
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
onTrainSelected(int.parse(currentInput));
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text("Caută trenul cu numărul $currentInput")
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<_TrainOperatorTrainDescription> getFilteredLines(TrainOperatorLines _operator, String currentInput) {
|
||||
if (currentInput.isNotEmpty) {
|
||||
final filteredLines = _operator.trains
|
||||
.where((elem) => elem.number.contains(currentInput))
|
||||
.toList();
|
||||
|
||||
filteredLines.sort((a, b) {
|
||||
final inputAsRegExp = RegExp(currentInput);
|
||||
|
||||
final matchOnA = inputAsRegExp.firstMatch(a.number);
|
||||
final matchOnB = inputAsRegExp.firstMatch(b.number);
|
||||
|
||||
if (matchOnA.start != matchOnB.start) return matchOnA.start - matchOnB.start;
|
||||
|
||||
if (a.number.length != b.number.length) return a.number.length - b.number.length;
|
||||
|
||||
return a.number.compareTo(b.number);
|
||||
});
|
||||
|
||||
return filteredLines;
|
||||
}
|
||||
else {
|
||||
return _operator.trains;
|
||||
}
|
||||
}
|
||||
|
||||
Widget getOperatorSliver(BuildContext context, TrainOperatorLines _operator, String currentInput, TrainSelectedCallback onTrainSelected) {
|
||||
final filteredLines = getFilteredLines(_operator, currentInput);
|
||||
|
||||
if (filteredLines.isEmpty) {
|
||||
return SliverToBoxAdapter(child: Container(),);
|
||||
}
|
||||
|
||||
return SliverPrototypeExtentList(
|
||||
prototypeItem: Column(
|
||||
children: <Widget>[
|
||||
getLineListItem(
|
||||
context,
|
||||
op: TrainOperatorLines(),
|
||||
line: _TrainOperatorTrainDescription()
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
getLineListItem(
|
||||
context,
|
||||
op: _operator,
|
||||
line: filteredLines[index],
|
||||
onTrainSelected: onTrainSelected
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
);
|
||||
},
|
||||
childCount: filteredLines.length,
|
||||
addSemanticIndexes: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getLineListItem(BuildContext context, {TrainOperatorLines op, _TrainOperatorTrainDescription line, TrainSelectedCallback onTrainSelected}) {
|
||||
if (Platform.isAndroid) {
|
||||
return ListTile(
|
||||
dense: true,
|
||||
title: Text("${line.rang ?? ""} ${line.number ?? ""}"),
|
||||
subtitle: Text(op.operator ?? ""),
|
||||
onTap: () {
|
||||
onTrainSelected(line.internalNumber);
|
||||
},
|
||||
);
|
||||
}
|
||||
else if (Platform.isIOS) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
onTrainSelected(line.internalNumber);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
op.operator ?? "",
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(fontSize: 10, fontWeight: FontWeight.w200),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
"${line.rang ?? ""} ${line.number ?? ""}",
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class TrainInfoPromptMaterial extends StatefulWidget {
|
||||
@override
|
||||
_TrainInfoPromptMaterialState createState() => _TrainInfoPromptMaterialState();
|
||||
}
|
||||
|
||||
class _TrainInfoPromptMaterialState extends State<TrainInfoPromptMaterial> with TrainInfoPromptAction, TrainInfoPromptListHandling {
|
||||
TextEditingController trainNoController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
loadOperators(context).then((_) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Informații despre tren"),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SafeArea(
|
||||
bottom: false,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: TextField(
|
||||
controller: trainNoController,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: "Numărul trenului",
|
||||
),
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter.digitsOnly,
|
||||
],
|
||||
textInputAction: TextInputAction.search,
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: getOperatorsListView(context, currentInput: trainNoController.text, onTrainSelected: (number) {
|
||||
onTrainSelected(context, number);
|
||||
})
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TrainInfoPromptCupertino extends StatefulWidget {
|
||||
@override
|
||||
_TrainInfoPromptCupertinoState createState() => _TrainInfoPromptCupertinoState();
|
||||
}
|
||||
|
||||
class _TrainInfoPromptCupertinoState extends State<TrainInfoPromptCupertino> with TrainInfoPromptAction, TrainInfoPromptListHandling {
|
||||
TextEditingController trainNoController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
loadOperators(context).then((_) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text("Informații despre tren"),
|
||||
),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: CupertinoTextField(
|
||||
controller: trainNoController,
|
||||
autofocus: true,
|
||||
placeholder: "Numărul trenului",
|
||||
textInputAction: TextInputAction.search,
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter.digitsOnly,
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: getOperatorsListView(context, currentInput: trainNoController.text, onTrainSelected: (number) {
|
||||
onTrainSelected(context, number);
|
||||
})
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class TrainOperatorLines {
|
||||
@JsonKey(name: "short_name")
|
||||
final String shortName;
|
||||
final String operator;
|
||||
@JsonKey(name: "versiune")
|
||||
final String version;
|
||||
@JsonKey(name: "trenuri")
|
||||
final List<_TrainOperatorTrainDescription> trains;
|
||||
|
||||
TrainOperatorLines({
|
||||
this.operator,
|
||||
this.shortName = "",
|
||||
this.version,
|
||||
this.trains,
|
||||
});
|
||||
|
||||
factory TrainOperatorLines.fromJson(Map<String, dynamic> json) => _$TrainOperatorLinesFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$TrainOperatorLinesToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class _TrainOperatorTrainDescription {
|
||||
final String rang;
|
||||
@JsonKey(name: "numar")
|
||||
final String number;
|
||||
@JsonKey(name: "numar_intern")
|
||||
final int internalNumber;
|
||||
|
||||
_TrainOperatorTrainDescription({
|
||||
this.number,
|
||||
this.rang,
|
||||
this.internalNumber
|
||||
});
|
||||
|
||||
factory _TrainOperatorTrainDescription.fromJson(Map<String, dynamic> json) => _$_TrainOperatorTrainDescriptionFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$_TrainOperatorTrainDescriptionToJson(this);
|
||||
}
|
44
lib/train_info_page/train_info_prompt.g.dart
Normal file
44
lib/train_info_page/train_info_prompt.g.dart
Normal file
|
@ -0,0 +1,44 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'train_info_prompt.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
TrainOperatorLines _$TrainOperatorLinesFromJson(Map<String, dynamic> json) {
|
||||
return TrainOperatorLines(
|
||||
operator: json['operator'] as String,
|
||||
shortName: json['short_name'] as String,
|
||||
version: json['versiune'] as String,
|
||||
trains: (json['trenuri'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: _TrainOperatorTrainDescription.fromJson(
|
||||
e as Map<String, dynamic>))
|
||||
?.toList());
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$TrainOperatorLinesToJson(TrainOperatorLines instance) =>
|
||||
<String, dynamic>{
|
||||
'short_name': instance.shortName,
|
||||
'operator': instance.operator,
|
||||
'versiune': instance.version,
|
||||
'trenuri': instance.trains
|
||||
};
|
||||
|
||||
_TrainOperatorTrainDescription _$_TrainOperatorTrainDescriptionFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return _TrainOperatorTrainDescription(
|
||||
number: json['numar'] as String,
|
||||
rang: json['rang'] as String,
|
||||
internalNumber: json['numar_intern'] as int);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$_TrainOperatorTrainDescriptionToJson(
|
||||
_TrainOperatorTrainDescription instance) =>
|
||||
<String, dynamic>{
|
||||
'rang': instance.rang,
|
||||
'numar': instance.number,
|
||||
'numar_intern': instance.internalNumber
|
||||
};
|
10
lib/utils/stream_list.dart
Normal file
10
lib/utils/stream_list.dart
Normal file
|
@ -0,0 +1,10 @@
|
|||
import 'dart:async';
|
||||
|
||||
Stream<List<T>> listifyStream<T>(Stream<T> stream) async* {
|
||||
List<T> list = List();
|
||||
|
||||
await for (T item in stream) {
|
||||
list.add(item);
|
||||
yield list;
|
||||
}
|
||||
}
|
34
lib/utils/webview_invoke.dart
Normal file
34
lib/utils/webview_invoke.dart
Normal file
|
@ -0,0 +1,34 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
/// Evaluates a JavaScript function on the given WebView.
|
||||
///
|
||||
/// The JavaScript function must return a String.
|
||||
///
|
||||
/// On Android, the `String` resulted from the evaluation
|
||||
/// is JSON parsed. On iOS, the `String` is returned as is.
|
||||
///
|
||||
/// Other platforms are not supported. The returned value
|
||||
/// in this case will be `null`.
|
||||
Future<String> wInvoke({
|
||||
@required WebViewController webViewController,
|
||||
@required String jsFunctionContent,
|
||||
bool isFunctionAlready = false
|
||||
}) async {
|
||||
final actualJS = isFunctionAlready ?
|
||||
jsFunctionContent :
|
||||
"""
|
||||
(() => {
|
||||
$jsFunctionContent
|
||||
})()
|
||||
""";
|
||||
|
||||
final res = await webViewController.evaluateJavascript(actualJS);
|
||||
|
||||
if (Platform.isAndroid) return JsonDecoder().convert(res) as String;
|
||||
else if (Platform.isIOS) return res;
|
||||
else return null;
|
||||
}
|
22
pubspec.lock
22
pubspec.lock
|
@ -127,6 +127,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -408,6 +415,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1+1"
|
||||
tuple:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: tuple
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -436,6 +450,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.14"
|
||||
webview_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: webview_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.11+2"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -445,3 +466,4 @@ packages:
|
|||
version: "2.1.16"
|
||||
sdks:
|
||||
dart: ">=2.3.0 <3.0.0"
|
||||
flutter: ">=1.5.0 <2.0.0"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: info_tren
|
||||
description: A new Flutter project.
|
||||
description: O aplicație de vizualizare a datelor puse la dispoziție de Informatica Feroviară.xe
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
|
@ -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: 1.0.0+1
|
||||
version: 2.0.2
|
||||
|
||||
environment:
|
||||
sdk: ">=2.3.0 <3.0.0"
|
||||
|
@ -26,6 +26,9 @@ dependencies:
|
|||
json_annotation: ^2.0.0
|
||||
rxdart: ^0.22.0
|
||||
http: ^0.12.0
|
||||
webview_flutter: ^0.3.0
|
||||
cupertino_icons: ^0.1.2
|
||||
tuple: ^1.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -75,3 +78,5 @@ flutter:
|
|||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
assets:
|
||||
- assets/lines/
|
Loading…
Add table
Reference in a new issue