Monthly Calendar - All Sports work & Changed layout to look better

This commit is contained in:
kconnel7
2020-04-25 16:10:26 -04:00
parent 7ba8fcb09c
commit c6d811331d
4 changed files with 144 additions and 38 deletions

90
ios/Podfile Normal file
View File

@@ -0,0 +1,90 @@
# 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
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
end
generated_key_values
end
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
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

34
ios/Podfile.lock Normal file
View File

@@ -0,0 +1,34 @@
PODS:
- Flutter (1.0.0)
- shared_preferences (0.0.1):
- Flutter
- shared_preferences_macos (0.0.1):
- Flutter
- shared_preferences_web (0.0.1):
- Flutter
DEPENDENCIES:
- Flutter (from `Flutter`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
EXTERNAL SOURCES:
Flutter:
:path: Flutter
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
shared_preferences_macos:
:path: ".symlinks/plugins/shared_preferences_macos/ios"
shared_preferences_web:
:path: ".symlinks/plugins/shared_preferences_web/ios"
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
PODFILE CHECKSUM: 083258d7f5e80b42ea9bfee905fe93049bc04c64
COCOAPODS: 1.7.5

View File

@@ -213,14 +213,9 @@
files = ( files = (
); );
inputPaths = ( inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputPaths = ( outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;

View File

@@ -27,7 +27,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
static final sportUrl = 'https://charlotte49ers.com/services/adaptive_components.ashx?type=scoreboard&start=0&count=80'; static final sportUrl = 'https://charlotte49ers.com/services/adaptive_components.ashx?type=scoreboard&start=0&count=80';
Future<List<sport_schedule>> getEvents() async { Future<List<sport_schedule>> getEvents() async {
var url = '$sportUrl&sport_id=$sportID&name=&extra=%7B%7D'; var url = '$sportUrl&sport_id=$sportID&name=&extra=%7B%7D';
@@ -54,10 +53,8 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
var original = mapGrab[sportEvent]; var original = mapGrab[sportEvent];
if (original == null) { if (original == null) {
//print("null");
mapGrab[sportEvent] = [eventInfo[i]]; mapGrab[sportEvent] = [eventInfo[i]];
} else { } else {
//print(eventInfo[i].date);
mapGrab[sportEvent] = List.from(original)..addAll([eventInfo[i]]); mapGrab[sportEvent] = List.from(original)..addAll([eventInfo[i]]);
} }
} }
@@ -240,30 +237,26 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
} }
//----- Creates event box display (mini box) ----- //----- Creates event box display (mini box) -----
Widget _buildEventsMarker(DateTime date, String location, bool main, events) { Widget _buildEventsMarker(DateTime date, String gameType, bool main, events) {
String s; String eventNum;
if (main) {s = "${date.day}";} else {s = "${events.length}";} if (main) {eventNum = "${date.day}";} else {eventNum = "${events.length}";}
//return Container(
return AnimatedContainer( return AnimatedContainer(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
margin: const EdgeInsets.all(4.0),
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, /*border: Border.all(
color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
/*border: _calController.isSelected(date) //if selected date //color: Colors.black,
? Border.all(color: Colors.black, width: 1.5,) ),*/
: _calController.isToday(date) //if today's date color: _calController.isSelected(date)
? Border.all(color: Colors.black, width: 1.5,) ? Color.fromRGBO(179, 163, 105, 1) //UNCC Gold
: Border.all(color: Colors.black, width: 0,),*/ : _gameTypeColor(gameType, main), //UNCC Green
borderRadius: BorderRadius.circular(10.0)
//color: Color.fromRGBO(0, 112, 60, 1), //UNCC Green
//color: Colors.grey,
//if selected date && home game / else away game
color: _calController.isSelected(date)
? Color.fromRGBO(179, 163, 105, 1)
: _homeAwayColor(location, main), //UNCC Green
//: Colors.grey,
), ),
width: 16.0, width: 16.0,
@@ -271,7 +264,7 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
child: Center( child: Center(
child: Text( child: Text(
s, eventNum,
style: TextStyle().copyWith( style: TextStyle().copyWith(
color: Colors.white, color: Colors.white,
fontSize: 12.0, fontSize: 12.0,
@@ -281,16 +274,11 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
); );
} }
Color _homeAwayColor(String location, bool main){ //Logic on if Home or Away return the colors
//TODO: Here should be the logic on if Home or Away return the colors Color _gameTypeColor(String gameType, bool main){
// Do whatever you need to do to check home/away
// my guess is if the game says vs its home
// if game says at its away
//print(i.location_indicator);
Color c; Color c;
if (location == "H"){ // could also be if(game == "H") or something if (gameType == "H"){
c = Color.fromRGBO(0, 112, 60, 1); c = Color.fromRGBO(0, 112, 60, 1); //UNCC Green
} else { } else {
c = Colors.grey; c = Colors.grey;
} }
@@ -300,7 +288,6 @@ class _Calendar extends State<Calendar> with TickerProviderStateMixin {
return c; return c;
} }
//----- Creates event display ----- //----- Creates event display -----
Widget _eventLister() { Widget _eventLister() {
return ListView( return ListView(