Skip to content

Conversation

@apeynado
Copy link
Contributor

@apeynado apeynado commented Oct 24, 2025

Pre-launch Checklist

  • I signed the CLA.

Tested downloading the sample app from git and connecting it to firebase using flutterfire

@ericwindmill
Copy link
Collaborator

Hey @apeynado, I'm not sure if you've contributed to this repository before, so just-in-case: this repository is lawless.

If you feel good about the PR, feel free to merge it. Or if you want someone to review it, request it explicitly.

@apeynado
Copy link
Contributor Author

Ah thanks! I'll have Khanh scan it to keep me honest!

@apeynado apeynado closed this Oct 27, 2025
@apeynado apeynado reopened this Oct 27, 2025
@apeynado apeynado marked this pull request as draft October 27, 2025 17:15
@apeynado apeynado marked this pull request as ready for review October 27, 2025 17:16
@apeynado apeynado marked this pull request as draft October 27, 2025 17:16
@apeynado apeynado marked this pull request as ready for review October 27, 2025 17:16
Future<void> startCall() async {
// Initialize audio and video streams if they haven't been already.
if (!_audioIsInitialized) {
await _initializeAudio();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm why'd you move these out of of init state?

class _DemoHomeScreenState extends State<DemoHomeScreen> {
int _selectedIndex = 0;
final GlobalKey<ChatDemoNanoState> _chatNanoKey = GlobalKey();
bool _nanoPickerHasBeenShown = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These bits that are only relevant to specific demos (ex: Nano Banana chat) should probably be moved out into the Nano Banana demo

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

const ChatDemo(),
const LiveAPIDemo(),
const MultimodalDemo(),
ChatDemoNano(key: _chatNanoKey),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this have a key?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}

void _onItemTapped(int index) {
if (index == 3 && !_nanoPickerHasBeenShown) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index == 3 is a magic number here, we'll want to refactor to reference a specific demo. We should also move the nanoPicker to the Nano Banana demo, that is probably not need in the main demo scaffolding!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, but the magic number still needs to be in the selector index...

context,
).colorScheme.primary,
),
'github.com/flutter/demos/issues',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this screen, where do we point users to a place to get help/file issues?

demo.name,
style: TextStyle(fontWeight: FontWeight.bold),
bottomNavigationBar: BottomNavigationBar(
items: <BottomNavigationBarItem>[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be refactored to be a little more module (have the BottomNavigationBar destinations be separate and iterate over it to create the list of BottomNavigationBarItem(s). It'll make it easier to add more demos in the future too.

onDestinationSelected: _onItemTapped,
labelType: NavigationRailLabelType.all,
destinations: <NavigationRailDestination>[
const NavigationRailDestination(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same this could probably reuse the same list of destinations for the mobile layout, but just loop over it and return NavigationRailDestinations instead

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

),
),
TextSpan(text: '.'),
TextSpan(text: '\n\n'),
Copy link
Contributor

@khanhnwin khanhnwin Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this addition makes the alert UI a little too cluttered & two CTAs distract from each other.

@@ -0,0 +1,56 @@
import 'package:firebase_ai/firebase_ai.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use this component anymore since we broke out the Nano Banana and Chat demos?

@@ -0,0 +1,122 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to duplicate this service from the original chat demo, it is identically the same business logic. We shouldn't have to duplicate code.

@@ -0,0 +1,219 @@
// Copyright 2025 Google LLC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also duplicated code that doesn't need to be duplicated! We should eb able to use the original chat demo, just swap out the model in that is being used!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cleaned up the chat demo so it will focus on the function calling part and always select the gemini 2.5 flash. The majority of the UI component is moved to shared folder and reuse between two demos. I think it's ok to have independent demo page for different purposes.

),
Demo(
name: 'Multimodal Prompt',
description:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the index screen now means that the user has 0 context to what each demo is meant to showcase/feature. That'll be hard for them to then back-track and understand what APIs they should use in Firebase AI Logic.

return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600) {
// Use BottomNavigationBar for smaller screens
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the app gets scaled down, it regenerates the demo and re-executes the function call to change the app color. I don't think that's an intended effect?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with scaling up!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

'Hey Gemini! Can you set the app color to purple?';
WidgetsBinding.instance.addPostFrameCallback((_) {
opController.show();
sendMessage(_userTextInputController.text);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to hijack the UI and automatically send the first message. As someone launching the demo for the first time, sending the message automatically kind of takes away the user's agency? Generally a bad UX pattern to execute an action without user consent. Maybe an alternative is to add a pop up or something that says "click send message" to see a tool call! or something that encourages the user to send the initial message, but still lets them decide.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a dialog to ask the user to make the decision

}
}

Future<ChatResponse> _handleFunctionCall(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think function calls are even supported in the nano banana models?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants