Skip to content

Commit abaab58

Browse files
committed
chore: update bloc firebase integration source code
1 parent baca744 commit abaab58

File tree

13 files changed

+226
-135
lines changed

13 files changed

+226
-135
lines changed

firebase_bloc_tutorial/android/app/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ if (flutterVersionName == null) {
2121
flutterVersionName = '1.0'
2222
}
2323

24-
apply plugin: 'com.google.gms.google-services' //this line
2524
apply plugin: 'com.android.application'
2625
apply plugin: 'kotlin-android'
2726
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

firebase_bloc_tutorial/android/build.gradle

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.6.10'
2+
ext.kotlin_version = '1.7.10'
33
repositories {
44
google()
55
mavenCentral()
66
}
77

88
dependencies {
9-
// Add this line
10-
classpath 'com.google.gms:google-services:4.3.3'
11-
classpath 'com.android.tools.build:gradle:4.1.0'
9+
classpath 'com.android.tools.build:gradle:7.0.1'
1210
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1311
}
1412
}
@@ -28,6 +26,6 @@ subprojects {
2826
project.evaluationDependsOn(':app')
2927
}
3028

31-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3230
delete rootProject.buildDir
3331
}

firebase_bloc_tutorial/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip

firebase_bloc_tutorial/ios/Runner.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1212
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
13+
955C86A8BCD27C1A4E065643 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = D1704F19D3F96EDA2688D4F2 /* GoogleService-Info.plist */; };
1314
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1415
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1516
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@@ -42,6 +43,7 @@
4243
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4344
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
4445
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
46+
D1704F19D3F96EDA2688D4F2 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
4547
/* End PBXFileReference section */
4648

4749
/* Begin PBXFrameworksBuildPhase section */
@@ -72,6 +74,7 @@
7274
9740EEB11CF90186004384FC /* Flutter */,
7375
97C146F01CF9000F007C117D /* Runner */,
7476
97C146EF1CF9000F007C117D /* Products */,
77+
D1704F19D3F96EDA2688D4F2 /* GoogleService-Info.plist */,
7578
);
7679
sourceTree = "<group>";
7780
};
@@ -163,6 +166,7 @@
163166
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
164167
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
165168
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
169+
955C86A8BCD27C1A4E065643 /* GoogleService-Info.plist in Resources */,
166170
);
167171
runOnlyForDeploymentPostprocessing = 0;
168172
};

firebase_bloc_tutorial/lib/features/authentication/sign_in_view.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ class _SubmitButton extends StatelessWidget {
174174
: null,
175175
child: const Text(Constants.textSignIn),
176176
style: ButtonStyle(
177-
foregroundColor: MaterialStateProperty.all<Color>(
177+
foregroundColor: WidgetStateProperty.all<Color>(
178178
Constants.kPrimaryColor),
179-
backgroundColor: MaterialStateProperty.all<Color>(
180-
Constants.kBlackColor),
181-
side: MaterialStateProperty.all<BorderSide>(
182-
BorderSide.none)),
179+
backgroundColor:
180+
WidgetStateProperty.all<Color>(Constants.kBlackColor),
181+
side:
182+
WidgetStateProperty.all<BorderSide>(BorderSide.none)),
183183
),
184184
);
185185
},

firebase_bloc_tutorial/lib/features/form-validation/sign_up_view.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ class _SubmitButton extends StatelessWidget {
228228
: null,
229229
child: const Text(Constants.textSignUpBtn),
230230
style: ButtonStyle(
231-
foregroundColor: MaterialStateProperty.all<Color>(
231+
foregroundColor: WidgetStateProperty.all<Color>(
232232
Constants.kPrimaryColor),
233-
backgroundColor: MaterialStateProperty.all<Color>(
234-
Constants.kBlackColor),
235-
side: MaterialStateProperty.all<BorderSide>(
236-
BorderSide.none)),
233+
backgroundColor:
234+
WidgetStateProperty.all<Color>(Constants.kBlackColor),
235+
side:
236+
WidgetStateProperty.all<BorderSide>(BorderSide.none)),
237237
),
238238
);
239239
},

firebase_bloc_tutorial/lib/main.dart

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:firebase_bloc_tutorial/features/authentication/authentication_repository_impl.dart';
2+
import 'package:firebase_bloc_tutorial/firebase_options.dart';
23
import 'package:firebase_core/firebase_core.dart';
34
import 'package:flutter/material.dart';
45
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -11,25 +12,22 @@ import 'features/form-validation/bloc/form_bloc.dart';
1112

1213
void main() async {
1314
WidgetsFlutterBinding.ensureInitialized();
14-
await Firebase.initializeApp();
15-
BlocOverrides.runZoned(
16-
() => runApp(MultiBlocProvider(
17-
providers: [
18-
BlocProvider(
19-
create: (context) =>
20-
AuthenticationBloc(AuthenticationRepositoryImpl())
21-
..add(AuthenticationStarted()),
22-
),
23-
BlocProvider(
24-
create: (context) => FormBloc(
25-
AuthenticationRepositoryImpl(), DatabaseRepositoryImpl()),
26-
),
27-
BlocProvider(
28-
create: (context) => DatabaseBloc(DatabaseRepositoryImpl()),
29-
)
30-
],
31-
child: const App(),
32-
)),
33-
blocObserver: AppBlocObserver(),
34-
);
15+
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
16+
Bloc.observer = AppBlocObserver();
17+
runApp(MultiBlocProvider(
18+
providers: [
19+
BlocProvider(
20+
create: (context) => AuthenticationBloc(AuthenticationRepositoryImpl())
21+
..add(AuthenticationStarted()),
22+
),
23+
BlocProvider(
24+
create: (context) =>
25+
FormBloc(AuthenticationRepositoryImpl(), DatabaseRepositoryImpl()),
26+
),
27+
BlocProvider(
28+
create: (context) => DatabaseBloc(DatabaseRepositoryImpl()),
29+
)
30+
],
31+
child: const App(),
32+
));
3533
}

firebase_bloc_tutorial/lib/utils/constants.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:flutter/material.dart';
21
import 'package:flutter/services.dart';
32

43
class Constants {

0 commit comments

Comments
 (0)