Skip to content

Commit 120cd3c

Browse files
committed
Update firebase-get-to-know-flutter rebuild script
1 parent 9f34730 commit 120cd3c

File tree

1 file changed

+75
-82
lines changed

1 file changed

+75
-82
lines changed

firebase-get-to-know-flutter/codelab_rebuild.yaml

Lines changed: 75 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,18 +2031,17 @@ steps:
20312031
import 'src/widgets.dart';
20322032
20332033
class HomePage extends StatelessWidget {
2034-
@@ -19,6 +24,15 @@ class HomePage extends StatelessWidget {
2034+
@@ -19,6 +24,14 @@ class HomePage extends StatelessWidget {
20352035
const SizedBox(height: 8),
20362036
const IconAndDetail(Icons.calendar_today, 'October 30'),
20372037
const IconAndDetail(Icons.location_city, 'San Francisco'),
20382038
+ Consumer<ApplicationState>(
2039-
+ builder:
2040-
+ (context, appState, _) => AuthFunc(
2041-
+ loggedIn: appState.loggedIn,
2042-
+ signOut: () {
2043-
+ FirebaseAuth.instance.signOut();
2044-
+ },
2045-
+ ),
2039+
+ builder: (context, appState, _) => AuthFunc(
2040+
+ loggedIn: appState.loggedIn,
2041+
+ signOut: () {
2042+
+ FirebaseAuth.instance.signOut();
2043+
+ },
2044+
+ ),
20462045
+ ),
20472046
const Divider(
20482047
height: 8,
@@ -2179,25 +2178,23 @@ steps:
21792178
import 'src/authentication.dart';
21802179
import 'src/widgets.dart';
21812180
2182-
@@ -44,6 +45,22 @@ class HomePage extends StatelessWidget {
2181+
@@ -43,6 +44,20 @@ class HomePage extends StatelessWidget {
21832182
const Paragraph(
21842183
'Join us for a day full of Firebase Workshops and Pizza!',
21852184
),
21862185
+ Consumer<ApplicationState>(
2187-
+ builder:
2188-
+ (context, appState, _) => Column(
2189-
+ crossAxisAlignment: CrossAxisAlignment.start,
2190-
+ children: [
2191-
+ if (appState.loggedIn) ...[
2192-
+ const Header('Discussion'),
2193-
+ GuestBook(
2194-
+ addMessage:
2195-
+ (message) =>
2196-
+ appState.addMessageToGuestBook(message),
2197-
+ ),
2198-
+ ],
2199-
+ ],
2200-
+ ),
2186+
+ builder: (context, appState, _) => Column(
2187+
+ crossAxisAlignment: CrossAxisAlignment.start,
2188+
+ children: [
2189+
+ if (appState.loggedIn) ...[
2190+
+ const Header('Discussion'),
2191+
+ GuestBook(
2192+
+ addMessage: (message) =>
2193+
+ appState.addMessageToGuestBook(message),
2194+
+ ),
2195+
+ ],
2196+
+ ],
2197+
+ ),
22012198
+ ),
22022199
],
22032200
),
@@ -2401,14 +2398,14 @@ steps:
24012398
patch-u: |
24022399
--- b/firebase-get-to-know-flutter/step_07/lib/home_page.dart
24032400
+++ a/firebase-get-to-know-flutter/step_07/lib/home_page.dart
2404-
@@ -56,6 +56,7 @@ class HomePage extends StatelessWidget {
2405-
addMessage:
2406-
(message) =>
2407-
appState.addMessageToGuestBook(message),
2408-
+ messages: appState.guestBookMessages,
2409-
),
2410-
],
2411-
],
2401+
@@ -53,6 +53,7 @@ class HomePage extends StatelessWidget {
2402+
GuestBook(
2403+
addMessage: (message) =>
2404+
appState.addMessageToGuestBook(message),
2405+
+ messages: appState.guestBookMessages,
2406+
),
2407+
],
2408+
],
24122409
- name: Copy step_07
24132410
copydir:
24142411
from: gtk_flutter
@@ -2611,28 +2608,27 @@ steps:
26112608
26122609
class HomePage extends StatelessWidget {
26132610
const HomePage({super.key});
2614-
@@ -23,7 +24,11 @@ class HomePage extends StatelessWidget {
2611+
@@ -23,7 +24,10 @@ class HomePage extends StatelessWidget {
26152612
children: <Widget>[
26162613
Image.asset('assets/codelab.png'),
26172614
const SizedBox(height: 8),
26182615
- const IconAndDetail(Icons.calendar_today, 'October 30'),
26192616
+ Consumer<ApplicationState>(
2620-
+ builder:
2621-
+ (context, appState, _) =>
2622-
+ IconAndDetail(Icons.calendar_today, appState.eventDate),
2617+
+ builder: (context, appState, _) =>
2618+
+ IconAndDetail(Icons.calendar_today, appState.eventDate),
26232619
+ ),
26242620
const IconAndDetail(Icons.location_city, 'San Francisco'),
26252621
Consumer<ApplicationState>(
2626-
builder:
2627-
@@ -32,6 +37,7 @@ class HomePage extends StatelessWidget {
2628-
signOut: () {
2629-
FirebaseAuth.instance.signOut();
2630-
},
2631-
+ enableFreeSwag: appState.enableFreeSwag,
2632-
),
2622+
builder: (context, appState, _) => AuthFunc(
2623+
@@ -31,6 +35,7 @@ class HomePage extends StatelessWidget {
2624+
signOut: () {
2625+
FirebaseAuth.instance.signOut();
2626+
},
2627+
+ enableFreeSwag: appState.enableFreeSwag,
2628+
),
26332629
),
26342630
const Divider(
2635-
@@ -42,15 +48,25 @@ class HomePage extends StatelessWidget {
2631+
@@ -41,14 +46,23 @@ class HomePage extends StatelessWidget {
26362632
color: Colors.grey,
26372633
),
26382634
const Header("What we'll be doing"),
@@ -2642,30 +2638,28 @@ steps:
26422638
+ builder: (context, appState, _) => Paragraph(appState.callToAction),
26432639
),
26442640
Consumer<ApplicationState>(
2645-
builder:
2646-
(context, appState, _) => Column(
2647-
crossAxisAlignment: CrossAxisAlignment.start,
2648-
children: [
2649-
+ switch (appState.attendees) {
2650-
+ 1 => const Paragraph('1 person going'),
2651-
+ >= 2 => Paragraph('${appState.attendees} people going'),
2652-
+ _ => const Paragraph('No one going'),
2653-
+ },
2654-
if (appState.loggedIn) ...[
2655-
+ YesNoSelection(
2656-
+ state: appState.attending,
2657-
+ onSelection:
2658-
+ (attending) => appState.attending = attending,
2659-
+ ),
2660-
const Header('Discussion'),
2661-
GuestBook(
2662-
addMessage:
2641+
builder: (context, appState, _) => Column(
2642+
crossAxisAlignment: CrossAxisAlignment.start,
2643+
children: [
2644+
+ switch (appState.attendees) {
2645+
+ 1 => const Paragraph('1 person going'),
2646+
+ >= 2 => Paragraph('${appState.attendees} people going'),
2647+
+ _ => const Paragraph('No one going'),
2648+
+ },
2649+
if (appState.loggedIn) ...[
2650+
+ YesNoSelection(
2651+
+ state: appState.attending,
2652+
+ onSelection: (attending) => appState.attending = attending,
2653+
+ ),
2654+
const Header('Discussion'),
2655+
GuestBook(
2656+
addMessage: (message) =>
26632657
- name: Patch lib/main.dart
26642658
path: gtk_flutter/lib/main.dart
26652659
patch-u: |
26662660
--- b/firebase-get-to-know-flutter/step_09/lib/main.dart
26672661
+++ a/firebase-get-to-know-flutter/step_09/lib/main.dart
2668-
@@ -82,13 +82,28 @@ final _router = GoRouter(
2662+
@@ -82,13 +82,27 @@ final _router = GoRouter(
26692663
GoRoute(
26702664
path: 'profile',
26712665
builder: (context, state) {
@@ -2677,27 +2671,26 @@ steps:
26772671
- }),
26782672
- ],
26792673
+ return Consumer<ApplicationState>(
2680-
+ builder:
2681-
+ (context, appState, _) => ProfileScreen(
2682-
+ key: ValueKey(appState.emailVerified),
2683-
+ providers: const [],
2684-
+ actions: [
2685-
+ SignedOutAction(((context) {
2686-
+ context.pushReplacement('/');
2687-
+ })),
2688-
+ ],
2689-
+ children: [
2690-
+ Visibility(
2691-
+ visible: !appState.emailVerified,
2692-
+ child: OutlinedButton(
2693-
+ child: const Text('Recheck Verification State'),
2694-
+ onPressed: () {
2695-
+ appState.refreshLoggedInUser();
2696-
+ },
2697-
+ ),
2698-
+ ),
2699-
+ ],
2674+
+ builder: (context, appState, _) => ProfileScreen(
2675+
+ key: ValueKey(appState.emailVerified),
2676+
+ providers: const [],
2677+
+ actions: [
2678+
+ SignedOutAction(((context) {
2679+
+ context.pushReplacement('/');
2680+
+ })),
2681+
+ ],
2682+
+ children: [
2683+
+ Visibility(
2684+
+ visible: !appState.emailVerified,
2685+
+ child: OutlinedButton(
2686+
+ child: const Text('Recheck Verification State'),
2687+
+ onPressed: () {
2688+
+ appState.refreshLoggedInUser();
2689+
+ },
2690+
+ ),
27002691
+ ),
2692+
+ ],
2693+
+ ),
27012694
);
27022695
},
27032696
),

0 commit comments

Comments
 (0)