diff --git a/firebase-auth-flutterfire-ui/codelab_rebuild.yaml b/firebase-auth-flutterfire-ui/codelab_rebuild.yaml index 8e72142536..ffeb70803f 100644 --- a/firebase-auth-flutterfire-ui/codelab_rebuild.yaml +++ b/firebase-auth-flutterfire-ui/codelab_rebuild.yaml @@ -5,12 +5,12 @@ steps: - name: Remove start rmdir: start - name: Create project - flutter: create start --empty --platforms=android,ios,macos,web + flutter: create firebase_auth_flutterfire_ui --empty --platforms=android,ios,macos,web - name: Strip DEVELOPMENT_TEAM strip-lines-containing: DEVELOPMENT_TEAM = - path: start/ios/Runner.xcodeproj/project.pbxproj + path: firebase_auth_flutterfire_ui/ios/Runner.xcodeproj/project.pbxproj - name: Configure analysis_options.yaml - path: start/analysis_options.yaml + path: firebase_auth_flutterfire_ui/analysis_options.yaml replace-contents: | include: ../../analysis_options.yaml @@ -18,154 +18,77 @@ steps: rules: avoid_print: false constant_identifier_names: false - - name: Add dependencies - path: start - flutter: pub add firebase_auth firebase_core firebase_ui_auth firebase_ui_oauth_google google_sign_in - name: Update dependencies - path: start + path: firebase_auth_flutterfire_ui flutter: pub upgrade --major-versions - name: Remove README.md - path: start + path: firebase_auth_flutterfire_ui rm: README.md - name: Patch pubspec.yaml - path: start/pubspec.yaml + path: firebase_auth_flutterfire_ui/pubspec.yaml patch-u: | --- b/firebase-auth-flutterfire-ui/start/pubspec.yaml +++ a/firebase-auth-flutterfire-ui/start/pubspec.yaml - @@ -22,3 +22,5 @@ dev_dependencies: + @@ -17,3 +17,5 @@ dev_dependencies: flutter: uses-material-design: true + assets: + - assets/ - - name: lib/main.dart - path: start/lib/main.dart + - name: Replace lib/main.dart + path: firebase_auth_flutterfire_ui/lib/main.dart replace-contents: | import 'package:flutter/material.dart'; - + import 'app.dart'; - + // TODO(codelab user): Get API key const clientId = 'YOUR_CLIENT_ID'; - + void main() async { - runApp(const MyApp()); + runApp(const MyApp(clientId: clientId)); } - - name: lib/app.dart - path: start/lib/app.dart + - name: Add lib/app.dart + path: firebase_auth_flutterfire_ui/lib/app.dart replace-contents: | import 'package:flutter/material.dart'; - + import 'auth_gate.dart'; - + class MyApp extends StatelessWidget { - const MyApp({super.key}); + const MyApp({super.key, required this.clientId}); + + final String clientId; + @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), ), - home: const AuthGate(), + home: AuthGate(clientId: clientId), ); } } - - name: lib/auth_gate.dart - path: start/lib/auth_gate.dart + - name: Add lib/auth_gate.dart + path: firebase_auth_flutterfire_ui/lib/auth_gate.dart replace-contents: | import 'package:flutter/material.dart'; - + import 'home.dart'; - + class AuthGate extends StatelessWidget { - const AuthGate({super.key}); - + const AuthGate({super.key, required this.clientId}); + + final String clientId; + @override Widget build(BuildContext context) { return const HomeScreen(); } } - - name: lib/firebase_options.dart - path: start/lib/firebase_options.dart - replace-contents: | - // File generated by FlutterFire CLI. - // ignore_for_file: lines_longer_than_80_chars - import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; - import 'package:flutter/foundation.dart' - show defaultTargetPlatform, kIsWeb, TargetPlatform; - - /// Default [FirebaseOptions] for use with your Firebase apps. - /// - /// Example: - /// ```dart - /// import 'firebase_options.dart'; - /// // ... - /// await Firebase.initializeApp( - /// options: DefaultFirebaseOptions.currentPlatform, - /// ); - /// ``` - class DefaultFirebaseOptions { - static FirebaseOptions get currentPlatform { - if (kIsWeb) { - return web; - } - - switch (defaultTargetPlatform) { - case TargetPlatform.android: - return android; - case TargetPlatform.iOS: - return ios; - case TargetPlatform.macOS: - return macos; - default: - throw UnsupportedError( - 'DefaultFirebaseOptions are not supported for this platform.', - ); - } - } - - // TODO (codelab user): Replace with your Firebase credentials - // Generate this file with credentials with the FlutterFire CLI - static const FirebaseOptions web = FirebaseOptions( - apiKey: 'YOUR API KEY', - appId: 'YOUR APP ID', - messagingSenderId: '', - projectId: 'flutterfire-ui-codelab', - authDomain: 'flutterfire-ui-codelab.firebaseapp.com', - storageBucket: 'flutterfire-ui-codelab.appspot.com', - measurementId: 'MEASUREMENT ID', - ); - - static const FirebaseOptions android = FirebaseOptions( - apiKey: 'YOUR API KEY', - appId: 'YOUR APP ID', - messagingSenderId: '', - projectId: 'flutterfire-ui-codelab', - storageBucket: 'flutterfire-ui-codelab.appspot.com', - ); - - static const FirebaseOptions ios = FirebaseOptions( - apiKey: 'YOUR API KEY', - appId: 'YOUR APP ID', - messagingSenderId: '', - projectId: 'flutterfire-ui-codelab', - storageBucket: 'flutterfire-ui-codelab.appspot.com', - iosClientId: 'IOS CLIENT ID', - iosBundleId: 'com.example.BUNDLE', - ); - - static const FirebaseOptions macos = FirebaseOptions( - apiKey: 'YOUR API KEY', - appId: 'YOUR APP ID', - messagingSenderId: '', - projectId: 'flutterfire-ui-codelab', - storageBucket: 'flutterfire-ui-codelab.appspot.com', - iosClientId: 'IOS CLIENT ID', - iosBundleId: 'com.example.BUNDLE', - ); - } - - name: lib/home.dart - path: start/lib/home.dart + - name: Add lib/home.dart + path: firebase_auth_flutterfire_ui/lib/home.dart replace-contents: | import 'package:flutter/material.dart'; @@ -179,7 +102,7 @@ steps: body: Center( child: Column( children: [ - Image.asset('dash.png'), + SizedBox(width: 250, child: Image.asset('assets/dash.png')), Text('Welcome!', style: Theme.of(context).textTheme.displaySmall), ], ), @@ -188,7 +111,7 @@ steps: } } - name: Patch web/index.html - path: start/web/index.html + path: firebase_auth_flutterfire_ui/web/index.html patch-u: | --- b/firebase-auth-flutterfire-ui/start/web/index.html +++ a/firebase-auth-flutterfire-ui/start/web/index.html @@ -203,7 +126,7 @@ steps: @@ -31,8 +33,33 @@ -