Skip to content

Commit 0358505

Browse files
authored
chore: add samples for web and macos (#336)
* chore: add samples for web and macos * chore: fix analyzer warning
1 parent 8f6f687 commit 0358505

40 files changed

+1671
-67
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ ios/fastlane/report.xml
9595
!**/ios/**/default.pbxuser
9696
!**/ios/**/default.perspectivev3
9797

98+
# macOS related
99+
**/macos/**/Pods/
100+
**/macos/**/.symlinks/
101+
**/macos/build/
102+
**/macos/Flutter/ephemeral/
103+
**/macos/**/dgph
104+
**/macos/**/xcuserdata/
105+
98106
# Web related
99107
*.dart.js
100108
*.info.json # Produced by the --dump-info flag.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="?android:colorBackground" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
5+
<!-- Show a splash screen on the activity. Automatically removed when
6+
the Flutter engine draws its first frame -->
7+
<item name="android:windowBackground">@drawable/launch_background</item>
8+
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
18+
</resources>

example/lib/firebase_options.dart

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// File generated by FlutterFire CLI.
22
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
3-
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
4-
import 'package:flutter/foundation.dart'
5-
show defaultTargetPlatform, kIsWeb, TargetPlatform;
3+
// import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
4+
// import 'package:flutter/foundation.dart'
5+
// show defaultTargetPlatform, kIsWeb, TargetPlatform;
66

77
/// Default [FirebaseOptions] for use with your Firebase apps.
88
///
@@ -14,57 +14,57 @@ import 'package:flutter/foundation.dart'
1414
/// options: DefaultFirebaseOptions.currentPlatform,
1515
/// );
1616
/// ```
17-
class DefaultFirebaseOptions {
18-
static FirebaseOptions get currentPlatform {
19-
if (kIsWeb) {
20-
throw UnsupportedError(
21-
'DefaultFirebaseOptions have not been configured for web - '
22-
'you can reconfigure this by running the FlutterFire CLI again.',
23-
);
24-
}
25-
switch (defaultTargetPlatform) {
26-
case TargetPlatform.android:
27-
return android;
28-
case TargetPlatform.iOS:
29-
return ios;
30-
case TargetPlatform.macOS:
31-
throw UnsupportedError(
32-
'DefaultFirebaseOptions have not been configured for macos - '
33-
'you can reconfigure this by running the FlutterFire CLI again.',
34-
);
35-
case TargetPlatform.windows:
36-
throw UnsupportedError(
37-
'DefaultFirebaseOptions have not been configured for windows - '
38-
'you can reconfigure this by running the FlutterFire CLI again.',
39-
);
40-
case TargetPlatform.linux:
41-
throw UnsupportedError(
42-
'DefaultFirebaseOptions have not been configured for linux - '
43-
'you can reconfigure this by running the FlutterFire CLI again.',
44-
);
45-
default:
46-
throw UnsupportedError(
47-
'DefaultFirebaseOptions are not supported for this platform.',
48-
);
49-
}
50-
}
51-
52-
static const FirebaseOptions android = FirebaseOptions(
53-
apiKey: 'AIzaSyBqCLgp5h6_dHlMJzKSsCfnSFawfFjCK1c',
54-
appId: '1:223276840801:android:8c43b96e396a1781b77720',
55-
messagingSenderId: '223276840801',
56-
projectId: 'flutter-gen-5b267',
57-
storageBucket: 'flutter-gen-5b267.appspot.com',
58-
);
59-
60-
static const FirebaseOptions ios = FirebaseOptions(
61-
apiKey: 'AIzaSyChOfD8XNEdGZtB3Gdqg9J5GRLgUuH9jo8',
62-
appId: '1:223276840801:ios:b5be85aa3c64059db77720',
63-
messagingSenderId: '223276840801',
64-
projectId: 'flutter-gen-5b267',
65-
storageBucket: 'flutter-gen-5b267.appspot.com',
66-
iosClientId:
67-
'223276840801-p876k56nj46ka6r8bmhkj5s6qiopoe1l.apps.googleusercontent.com',
68-
iosBundleId: 'com.example.example',
69-
);
70-
}
17+
// class DefaultFirebaseOptions {
18+
// static FirebaseOptions get currentPlatform {
19+
// if (kIsWeb) {
20+
// throw UnsupportedError(
21+
// 'DefaultFirebaseOptions have not been configured for web - '
22+
// 'you can reconfigure this by running the FlutterFire CLI again.',
23+
// );
24+
// }
25+
// switch (defaultTargetPlatform) {
26+
// case TargetPlatform.android:
27+
// return android;
28+
// case TargetPlatform.iOS:
29+
// return ios;
30+
// case TargetPlatform.macOS:
31+
// throw UnsupportedError(
32+
// 'DefaultFirebaseOptions have not been configured for macos - '
33+
// 'you can reconfigure this by running the FlutterFire CLI again.',
34+
// );
35+
// case TargetPlatform.windows:
36+
// throw UnsupportedError(
37+
// 'DefaultFirebaseOptions have not been configured for windows - '
38+
// 'you can reconfigure this by running the FlutterFire CLI again.',
39+
// );
40+
// case TargetPlatform.linux:
41+
// throw UnsupportedError(
42+
// 'DefaultFirebaseOptions have not been configured for linux - '
43+
// 'you can reconfigure this by running the FlutterFire CLI again.',
44+
// );
45+
// default:
46+
// throw UnsupportedError(
47+
// 'DefaultFirebaseOptions are not supported for this platform.',
48+
// );
49+
// }
50+
// }
51+
//
52+
// static const FirebaseOptions android = FirebaseOptions(
53+
// apiKey: 'AIzaSyBqCLgp5h6_dHlMJzKSsCfnSFawfFjCK1c',
54+
// appId: '1:223276840801:android:8c43b96e396a1781b77720',
55+
// messagingSenderId: '223276840801',
56+
// projectId: 'flutter-gen-5b267',
57+
// storageBucket: 'flutter-gen-5b267.appspot.com',
58+
// );
59+
//
60+
// static const FirebaseOptions ios = FirebaseOptions(
61+
// apiKey: 'AIzaSyChOfD8XNEdGZtB3Gdqg9J5GRLgUuH9jo8',
62+
// appId: '1:223276840801:ios:b5be85aa3c64059db77720',
63+
// messagingSenderId: '223276840801',
64+
// projectId: 'flutter-gen-5b267',
65+
// storageBucket: 'flutter-gen-5b267.appspot.com',
66+
// iosClientId:
67+
// '223276840801-p876k56nj46ka6r8bmhkj5s6qiopoe1l.apps.googleusercontent.com',
68+
// iosBundleId: 'com.example.example',
69+
// );
70+
// }
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
import FlutterMacOS
6+
import Foundation
7+
8+
import connectivity_plus_macos
9+
import device_info_plus_macos
10+
import flutter_local_notifications
11+
import flutter_secure_storage_macos
12+
import geolocator_apple
13+
import in_app_review
14+
import package_info_plus_macos
15+
import path_provider_macos
16+
import sentry_flutter
17+
import share_plus_macos
18+
import shared_preferences_macos
19+
import sign_in_with_apple
20+
import sqflite
21+
import url_launcher_macos
22+
import wakelock_macos
23+
24+
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
25+
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
26+
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
27+
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
28+
FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin"))
29+
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
30+
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
31+
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
32+
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
33+
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
34+
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
35+
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
36+
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
37+
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
38+
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
39+
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
40+
}

example/macos/Podfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
platform :osx, '10.11'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
'Profile' => :release,
9+
'Release' => :release,
10+
}
11+
12+
def flutter_root
13+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14+
unless File.exist?(generated_xcode_build_settings_path)
15+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16+
end
17+
18+
File.foreach(generated_xcode_build_settings_path) do |line|
19+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
20+
return matches[1].strip if matches
21+
end
22+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23+
end
24+
25+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26+
27+
flutter_macos_podfile_setup
28+
29+
target 'Runner' do
30+
use_frameworks!
31+
use_modular_headers!
32+
33+
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34+
end
35+
36+
post_install do |installer|
37+
installer.pods_project.targets.each do |target|
38+
flutter_additional_macos_build_settings(target)
39+
end
40+
end

example/macos/Podfile.lock

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
PODS:
2+
- connectivity_plus_macos (0.0.1):
3+
- FlutterMacOS
4+
- ReachabilitySwift
5+
- device_info_plus_macos (0.0.1):
6+
- FlutterMacOS
7+
- flutter_local_notifications (0.0.1):
8+
- FlutterMacOS
9+
- flutter_secure_storage_macos (3.3.1):
10+
- FlutterMacOS
11+
- FlutterMacOS (1.0.0)
12+
- FMDB (2.7.5):
13+
- FMDB/standard (= 2.7.5)
14+
- FMDB/standard (2.7.5)
15+
- geolocator_apple (1.2.0):
16+
- FlutterMacOS
17+
- in_app_review (0.2.0):
18+
- FlutterMacOS
19+
- package_info_plus_macos (0.0.1):
20+
- FlutterMacOS
21+
- path_provider_macos (0.0.1):
22+
- FlutterMacOS
23+
- ReachabilitySwift (5.0.0)
24+
- Sentry (7.11.0):
25+
- Sentry/Core (= 7.11.0)
26+
- Sentry/Core (7.11.0)
27+
- sentry_flutter (0.0.1):
28+
- Flutter
29+
- FlutterMacOS
30+
- Sentry (~> 7.11.0)
31+
- share_plus_macos (0.0.1):
32+
- FlutterMacOS
33+
- shared_preferences_macos (0.0.1):
34+
- FlutterMacOS
35+
- sign_in_with_apple (0.0.1):
36+
- FlutterMacOS
37+
- sqflite (0.0.2):
38+
- FlutterMacOS
39+
- FMDB (>= 2.7.5)
40+
- url_launcher_macos (0.0.1):
41+
- FlutterMacOS
42+
- wakelock_macos (0.0.1):
43+
- FlutterMacOS
44+
45+
DEPENDENCIES:
46+
- connectivity_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus_macos/macos`)
47+
- device_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos`)
48+
- flutter_local_notifications (from `Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos`)
49+
- flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`)
50+
- FlutterMacOS (from `Flutter/ephemeral`)
51+
- geolocator_apple (from `Flutter/ephemeral/.symlinks/plugins/geolocator_apple/macos`)
52+
- in_app_review (from `Flutter/ephemeral/.symlinks/plugins/in_app_review/macos`)
53+
- package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`)
54+
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
55+
- sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`)
56+
- share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`)
57+
- shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`)
58+
- sign_in_with_apple (from `Flutter/ephemeral/.symlinks/plugins/sign_in_with_apple/macos`)
59+
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
60+
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
61+
- wakelock_macos (from `Flutter/ephemeral/.symlinks/plugins/wakelock_macos/macos`)
62+
63+
SPEC REPOS:
64+
trunk:
65+
- FMDB
66+
- ReachabilitySwift
67+
- Sentry
68+
69+
EXTERNAL SOURCES:
70+
connectivity_plus_macos:
71+
:path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus_macos/macos
72+
device_info_plus_macos:
73+
:path: Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos
74+
flutter_local_notifications:
75+
:path: Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos
76+
flutter_secure_storage_macos:
77+
:path: Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos
78+
FlutterMacOS:
79+
:path: Flutter/ephemeral
80+
geolocator_apple:
81+
:path: Flutter/ephemeral/.symlinks/plugins/geolocator_apple/macos
82+
in_app_review:
83+
:path: Flutter/ephemeral/.symlinks/plugins/in_app_review/macos
84+
package_info_plus_macos:
85+
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos
86+
path_provider_macos:
87+
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
88+
sentry_flutter:
89+
:path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos
90+
share_plus_macos:
91+
:path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos
92+
shared_preferences_macos:
93+
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
94+
sign_in_with_apple:
95+
:path: Flutter/ephemeral/.symlinks/plugins/sign_in_with_apple/macos
96+
sqflite:
97+
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
98+
url_launcher_macos:
99+
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
100+
wakelock_macos:
101+
:path: Flutter/ephemeral/.symlinks/plugins/wakelock_macos/macos
102+
103+
SPEC CHECKSUMS:
104+
connectivity_plus_macos: f6e86fd000e971d361e54b5afcadc8c8fa773308
105+
device_info_plus_macos: 1ad388a1ef433505c4038e7dd9605aadd1e2e9c7
106+
flutter_local_notifications: 3805ca215b2fb7f397d78b66db91f6a747af52e4
107+
flutter_secure_storage_macos: 6ceee8fbc7f484553ad17f79361b556259df89aa
108+
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
109+
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
110+
geolocator_apple: 72a78ae3f3e4ec0db62117bd93e34523f5011d58
111+
in_app_review: a850789fad746e89bce03d4aeee8078b45a53fd0
112+
package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c
113+
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
114+
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
115+
Sentry: 0c5cd63d714187b4a39c331c1f0eb04ba7868341
116+
sentry_flutter: efb3df2c203cd03aad255892a8d628a458656d14
117+
share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4
118+
shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727
119+
sign_in_with_apple: a9e97e744e8edc36aefc2723111f652102a7a727
120+
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
121+
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3
122+
wakelock_macos: bc3f2a9bd8d2e6c89fee1e1822e7ddac3bd004a9
123+
124+
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
125+
126+
COCOAPODS: 1.11.3

0 commit comments

Comments
 (0)