8000 Tambahkan fitur putar video di UI Detail Meal · CoderJava/Food-Recipe@f030323 · GitHub
[go: up one dir, main page]

Skip to content

Commit f030323

Browse files
committed
Tambahkan fitur putar video di UI Detail Meal
1 parent 7ee128d commit f030323

File tree

Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def parse_KV_file(file, separator='=')
14+
file_abs_path = File.expand_path(file)
15+
if !File.exists? file_abs_path
16+
return [];
17+
end
18+
pods_ary = []
19+
skip_line_start_symbols = ["#", "/"]
20+
File.foreach(file_abs_path) { |line|
21+
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22+
plugin = line.split(pattern=separator)
23+
if plugin.length == 2
24+
podname = plugin[0].strip()
25+
path = plugin[1].strip()
26+
podpath = File.expand_path("#{path}", file_abs_path)
27+
pods_ary.push({:name => podname, :path => podpath});
28+
else
29+
puts "Invalid plugin specification: #{line}"
30+
end
31+
}
32+
return pods_ary
33+
end
34+
35+
target 'Runner' do
36+
use_frameworks!
37+
38+
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
39+
# referring to absolute paths on developers' machines.
40+
system('rm -rf .symlinks')
41+
system('mkdir -p .symlinks/plugins')
42+
43+
# Flutter Pods
44+
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
45+
if generated_xcode_build_settings.empty?
46+
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
47+
end
48+
generated_xcode_build_settings.map { |p|
49+
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
50+
symlink = File.join('.symlinks', 'flutter')
51+
File.symlink(File.dirname(p[:path]), symlink)
52+
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
53+
end
54+
}
55+
56+
# Plugin Pods
57+
plugin_pods = parse_KV_file('../.flutter-plugins')
58+
plugin_pods.map { |p|
59+
symlink = File.join('.symlinks', 'plugins', p[:name])
60+
File.symlink(p[:path], symlink)
61+
pod p[:name], :path => File.join(symlink, 'ios')
62+
}
63+
end
64+
65+
post_install do |installer|
66+
installer.pods_project.targets.each do |target|
67+
target.build_configurations.each do |config|
68+
config.build_settings['ENABLE_BITCODE'] = 'NO'
69+
end
70+
end
71+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
PODS:
2+
- Flutter (1.0.0)
3+
- url_launcher (0.0.1):
4+
- Flutter
5+
6+
DEPENDENCIES:
7+
- Flutter (from `.symlinks/flutter/ios`)
8+
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
9+
10+
EXTERNAL SOURCES:
11+
Flutter:
12+
:path: ".symlinks/flutter/ios"
13+
url_launcher:
14+
:path: ".symlinks/plugins/url_launcher/ios"
15+
16+
SPEC CHECKSUMS:
17+
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
18+
url_launcher: 92b89c1029a0373879933c21642958c874539095
19+
20+
PODFILE CHECKSUM: b7d0755641915265774624f3b3be49c5c073d379
21+
22+
COCOAPODS: 1.5.3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1212
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
1313
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14+
5D99EAF924A099AE7EB3F1F7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46D279177883FB918750F2AC /* Pods_Runner.framework */; };
1415
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
1516
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
1617
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -40,6 +41,7 @@
4041
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4142
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4243
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
44+
46D279177883FB918750F2AC /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4345
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
4446
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
4547
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@@ -60,12 +62,28 @@
6062
files = (
6163
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
6264
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
65+
5D99EAF924A099AE7EB3F1F7 /* Pods_Runner.framework in Frameworks */,
6366
);
6467
runOnlyForDeploymentPostprocessing = 0;
6568
};
6669
/* End PBXFrameworksBuildPhase section */
6770

6871
/* Begin PBXGroup section */
72+
33731406BF60D39AEA12E08D /* Pods */ = {
73+
isa = PBXGroup;
74+
children = (
75+
);
76+
name = Pods;
77+
sourceTree = "<group>";
78+
};
79+
59B90CDCA917A7ED60BAC3FF /* Frameworks */ = {
80+
isa = PBXGroup;
81+
children = (
82+
46D279177883FB918750F2AC /* Pods_Runner.framework */,
83+
);
84+
name = Frameworks;
85+
sourceTree = "<group>";
86+
};
6987
9740EEB11CF90186004384FC /* Flutter */ = {
7088
isa = PBXGroup;
7189
children = (
@@ -85,6 +103,8 @@
85103
9740EEB11CF90186004384FC /* Flutter */,
86104
97C146F01CF9000F007C117D /* Runner */,
87105
97C146EF1CF9000F007C117D /* Products */,
106+
33731406BF60D39AEA12E08D /* Pods */,
107+
59B90CDCA917A7ED60BAC3FF /* Frameworks */,
88108
);
89109
sourceTree = "<group>";
90110
};
@@ -126,12 +146,14 @@
126146
isa = PBXNativeTarget;
127147
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
128148
buildPhases = (
149+
BB325DC7CFE43DB87E09A6F2 /* [CP] Check Pods Manifest.lock */,
129150
9740EEB61CF901F6004384FC /* Run Script */,
130151
97C146EA1CF9000F007C117D /* Sources */,
131152
97C146EB1CF9000F007C117D /* Frameworks */,
132153
97C146EC1CF9000F007C117D /* Resources */,
133154
9705A1C41CF9048500538489 /* Embed Frameworks */,
134155
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
156+
084F5E2E510A18846283457A /* [CP] Embed Pods Frameworks */,
135157
);
136158
buildRules = (
137159
);
@@ -191,6 +213,30 @@
191213
/* End PBXResourcesBuildPhase section */
192214

193215
/* Begin PBXShellScriptBuildPhase section */
216+
084F5E2E510A18846283457A /* [CP] Embed Pods Frameworks */ = {
217+
isa = PBXShellScriptBuildPhase;
218+
buildActionMask = 2147483647;
219+
files = (
220+
);
221+
inputFileListPaths = (
222+
);
223+
inputPaths = (
224+
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
225+
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
226+
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
227+
);
228+
name = "[CP] Embed Pods Frameworks";
229+
outputFileListPaths = (
230+
);
231+
outputPaths = (
232+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
233+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
234+
);
235+
runOnlyForDeploymentPostprocessing = 0;
236+
shellPath = /bin/sh;
237+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
238+
showEnvVarsInLog = 0;
239+
};
194240
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
195241
isa = PBXShellScriptBuildPhase;
196242
buildActionMask = 2147483647;
@@ -219,6 +265,28 @@
219265
shellPath = /bin/sh;
220266
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
221267
};
268+
BB325DC7CFE43DB87E09A6F2 /* [CP] Check Pods Manifest.lock */ = {
269+
isa = PBXShellScriptBuildPhase;
270+
buildActionMask = 2147483647;
271+
files = (
272+
);
273+
inputFileListPaths = (
274+
);
275+
inputPaths = (
276+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
277+
"${PODS_ROOT}/Manifest.lock",
278+
);
279+
name = "[CP] Check Pods Manifest.lock";
280+
outputFileListPaths = (
281+
);
282+
outputPaths = (
283+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
284+
);
285+
runOnlyForDeploymentPostprocessing = 0;
286+
shellPath = /bin/sh;
287+
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";
288+
showEnvVarsInLog = 0;
289+
};
222290
/* End PBXShellScriptBuildPhase section */
223291

224292
/* Begin PBXSourcesBuildPhase section */
@@ -509,7 +577,6 @@
509577
defaultConfigurationName = Release;
510578
};
511579
/* End XCConfigurationList section */
512-
513580
};
514581
rootObject = 97C146E61CF9000F007C117D /* Project object */;
515582
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import 'dart:io';
2+
13
import 'package:flutter/cupertino.dart';
24
import 'package:flutter/material.dart';
35
import 'package:food_recipe/src/blocs/detailmeals/detail_meals_bloc.dart';
46
import 'package:food_recipe/src/models/lookupmealsbyid/lookup_meals_by_id.dart';
57
import 'package:food_recipe/src/utils/utils.dart';
8+
import 'package:url_launcher/url_launcher.dart';
69

710
class DetailMealsScreen extends StatefulWidget {
811
final String idMeal;
@@ -229,8 +232,30 @@ class _DetailMealsScreenState extends State<DetailMealsScreen> {
229232

230233
Widget _buildWidgetInfoPlayVideo(String strYoutube) {
231234
return GestureDetector(
232-
onTap: () {
233-
// TODO: do something in here
235+
onTap: () async {
236+
if (strYoutube.isNotEmpty) {
237+
if (Platform.isIOS) {
238+
if (await canLaunch(strYoutube)) {
239+
await launch(strYoutube, forceSafariVC: false);
240+
} else {
241+
if (await canLaunch(strYoutube)) {
242+
await launch(strYoutube);
243+
} else {
244+
Scaffold.of(context).showSnackBar(
245+
SnackBar(content: Text("Could not play video")));
246+
throw "Could not play video";
247+
}
248+
}
249+
} else {
250+
if (await canLaunch(strYoutube)) {
251+
await launch(strYoutube);
252+
} else {
253+
Scaffold.of(context).showSnackBar(
254+
SnackBar(content: Text("Could not play video")));
255+
throw "Could not play video";
256+
}
257+
}
258+
}
234259
},
235260
child: Row(
236261
children: <Widget>[
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,13 @@ packages:
436436
url: "https://pub.dartlang.org"
437437
source: hosted
438438
version: "1.1.6"
439+
url_launcher:
440+
dependency: "direct main"
441+
description:
442+
name: url_launcher
443+
url: "https://pub.dartlang.org"
444+
source: hosted
445+
version: "5.0.3"
439446
vector_math:
440447
dependency: transitive
441448
description:
@@ -466,3 +473,4 @@ packages:
466473
version: "2.1.15"
467474
sdks:
468475
dart: ">=2.3.0 <3.0.0"
476+
flutter: ">=1.5.0 <2.0.0"
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ dependencies:
2626
# Tools to write binaries that run builders.
2727
build_runner: ^1.5.1
2828

29+
# Flutter plugin for launching a URL on Android and iOS.
30+
url_launcher: ^5.0.3
31+
2932
dev_dependencies:
3033
flutter_test:
3134
sdk: flutter