Skip to content

Commit d6b0954

Browse files
committed
[feat] update null safety
1 parent dfbbfe7 commit d6b0954

38 files changed

+458
-187
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.dangngocduc.instagram
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity() {
6+
}
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+
Flutter 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>
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +0,0 @@
1-
import 'package:flutter_test/flutter_test.dart';
2-
3-
import 'package:instagramdatasource/instagramdatasource.dart';
4-
5-
void main() {
6-
test('adds one to input values', () {
7-
final calculator = Calculator();
8-
expect(calculator.addOne(2), 3);
9-
expect(calculator.addOne(-7), -6);
10-
expect(calculator.addOne(0), 1);
11-
expect(() => calculator.addOne(null), throwsNoSuchMethodError);
12-
});
13-
}

ios/Podfile

Lines changed: 15 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,78 +10,32 @@ project 'Runner', {
1010
'Release' => :release,
1111
}
1212

13-
def parse_KV_file(file, separator='=')
14-
file_abs_path = File.expand_path(file)
15-
if !File.exists? file_abs_path
16-
return [];
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
1717
end
18-
generated_key_values = {}
19-
skip_line_start_symbols = ["#", "/"]
20-
File.foreach(file_abs_path) do |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-
generated_key_values[podname] = podpath
28-
else
29-
puts "Invalid plugin specification: #{line}"
30-
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
3122
end
32-
generated_key_values
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
3324
end
3425

26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
3530
target 'Runner' do
3631
use_frameworks!
3732
use_modular_headers!
3833

39-
# Flutter Pod
40-
41-
copied_flutter_dir = File.join(__dir__, 'Flutter')
42-
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
43-
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
44-
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
45-
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
46-
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
47-
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
48-
49-
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
50-
unless File.exist?(generated_xcode_build_settings_path)
51-
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
52-
end
53-
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
54-
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
55-
56-
unless File.exist?(copied_framework_path)
57-
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
58-
end
59-
unless File.exist?(copied_podspec_path)
60-
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
61-
end
62-
end
63-
64-
# Keep pod path relative so it can be checked into Podfile.lock.
65-
pod 'Flutter', :path => 'Flutter'
66-
67-
# Plugin Pods
68-
69-
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
70-
# referring to absolute paths on developers' machines.
71-
system('rm -rf .symlinks')
72-
system('mkdir -p .symlinks/plugins')
73-
plugin_pods = parse_KV_file('../.flutter-plugins')
74-
plugin_pods.each do |name, path|
75-
symlink = File.join('.symlinks', 'plugins', name)
76-
File.symlink(path, symlink)
77-
pod name, :path => File.join(symlink, 'ios')
78-
end
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
7935
end
8036

8137
post_install do |installer|
8238
installer.pods_project.targets.each do |target|
83-
target.build_configurations.each do |config|
84-
config.build_settings['ENABLE_BITCODE'] = 'NO'
85-
end
39+
flutter_additional_ios_build_settings(target)
8640
end
8741
end

ios/Podfile.lock

Lines changed: 0 additions & 34 deletions
This file was deleted.

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,12 @@
261261
buildActionMask = 2147483647;
262262
files = (
263263
);
264-
inputPaths = (
265-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
266-
"${PODS_ROOT}/../Flutter/Flutter.framework",
267-
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
264+
inputFileListPaths = (
265+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
268266
);
269267
name = "[CP] Embed Pods Frameworks";
270-
outputPaths = (
271-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
272-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
268+
outputFileListPaths = (
269+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
273270
);
274271
runOnlyForDeploymentPostprocessing = 0;
275272
shellPath = /bin/sh;

ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/app_context.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extension AppContext on BuildContext {
1414
TextTheme get textTheme => Theme.of(this).textTheme;
1515

1616

17-
Future<BottomSheetAction> showBottomSheet(List<BottomSheetAction> actions) {
17+
Future<BottomSheetAction?> showBottomSheet(List<BottomSheetAction> actions) {
1818
return showModalBottomSheet(
1919
context: this,
2020
backgroundColor: Colors.transparent,

lib/application.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ class _ApplicationState extends State<Application> {
7878
primaryTextTheme: GoogleFonts.latoTextTheme(ThemeData.light().textTheme),
7979
accentTextTheme: GoogleFonts.latoTextTheme(ThemeData.light().accentTextTheme),
8080
textTheme: GoogleFonts.latoTextTheme(ThemeData.light().textTheme.copyWith(
81-
caption: ThemeData.light().textTheme.caption.copyWith(
81+
caption: ThemeData.light().textTheme.caption!.copyWith(
8282
color: Colors.black54,
8383
fontSize: 10,
8484
fontWeight: FontWeight.w500
8585
),
86-
bodyText2: ThemeData.light().textTheme.bodyText2.copyWith(
86+
bodyText2: ThemeData.light().textTheme.bodyText2!.copyWith(
8787
color: Colors.black,
8888
fontSize: 13,
8989
fontWeight: FontWeight.bold
9090
),
91-
bodyText1: ThemeData.light().textTheme.bodyText1.copyWith(
91+
bodyText1: ThemeData.light().textTheme.bodyText1!.copyWith(
9292
color: Colors.black,
9393
fontSize: 13,
9494
fontWeight: FontWeight.w400
@@ -116,17 +116,17 @@ class _ApplicationState extends State<Application> {
116116
primaryTextTheme: GoogleFonts.latoTextTheme(ThemeData.dark().textTheme),
117117
accentTextTheme: GoogleFonts.latoTextTheme(ThemeData.dark().accentTextTheme),
118118
textTheme: GoogleFonts.latoTextTheme(ThemeData.dark().textTheme.copyWith(
119-
caption: ThemeData.dark().textTheme.caption.copyWith(
119+
caption: ThemeData.dark().textTheme.caption!.copyWith(
120120
color: Colors.white54,
121121
fontSize: 10,
122122
fontWeight: FontWeight.w500
123123
),
124-
bodyText2: ThemeData.dark().textTheme.bodyText2.copyWith(
124+
bodyText2: ThemeData.dark().textTheme.bodyText2!.copyWith(
125125
color: Colors.white,
126126
fontSize: 13,
127127
fontWeight: FontWeight.bold
128128
),
129-
bodyText1: ThemeData.dark().textTheme.bodyText1.copyWith(
129+
bodyText1: ThemeData.dark().textTheme.bodyText1!.copyWith(
130130
color: Colors.white,
131131
fontSize: 13,
132132
fontWeight: FontWeight.w400

0 commit comments

Comments
 (0)