-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitCaptureFlutterSample.sh
executable file
·48 lines (36 loc) · 1.41 KB
/
initCaptureFlutterSample.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
appName=sample
# remove any existing code
rm -rf $appName
# create a Flutter sample application to test out the Capture SDK
flutter create -a kotlin -i swift --org com.microblink $appName
# enter into demo project folder
pushd $appName
IS_LOCAL_BUILD=false || exit 1
if [ "$IS_LOCAL_BUILD" = true ]; then
# add capture_flutter dependency with local path to pubspec.yaml
perl -i~ -pe "BEGIN{$/ = undef;} s/dependencies:\n flutter:\n sdk: flutter/dependencies:\n flutter:\n sdk: flutter\n capture_flutter:\n path: ..\/Capture/" pubspec.yaml
echo "Using capture_flutter from this repo instead from flutter pub"
else
# add capture_flutter dependency to pubspec.yaml
perl -i~ -pe "BEGIN{$/ = undef;} s/dependencies:\n flutter:\n sdk: flutter/dependencies:\n flutter:\n sdk: flutter\n capture_flutter:/" pubspec.yaml
echo "Using capture_flutter from flutter pub"
fi
flutter pub get
# enter into ios project folder
pushd ios
#Force minimal iOS version
sed -i '' "s/# platform :ios, '12.0'/platform :ios, '13.0'/" Podfile
# install pod
pod install
# go to flutter root project
popd
cp ../sample_files/main.dart lib/
echo ""
echo "Go to Flutter project folder: cd $appName"
echo "To run on Android type: flutter run"
echo "To run on iOS:
1. Open $appName/ios/Runner.xcworkspace
2. Set the Add the NSCameraUsageDescription key to the Runner/Info.plist file
3. Set your development team
4. Press run"