Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
14ebdce
init setup
cynthiajoan Aug 29, 2025
b05f947
add the api
cynthiajoan Sep 2, 2025
46762ab
Add chat page test case
cynthiajoan Sep 3, 2025
e632bb8
add template imagen generate
cynthiajoan Sep 5, 2025
691f272
Merge branch 'main' into firebaseai/server_template
cynthiajoan Sep 18, 2025
242c4ff
add history placeholder
cynthiajoan Sep 18, 2025
b663a16
more examples for server template
cynthiajoan Sep 29, 2025
9d4a70f
create new models for template request
cynthiajoan Oct 3, 2025
c5f6171
working example with new architecture
cynthiajoan Oct 3, 2025
ba45ecc
some tweak to clean up the PR
cynthiajoan Oct 3, 2025
93d8045
Update server prompt api name and generateContentStream
cynthiajoan Oct 7, 2025
6f0dfbd
name updates and stream for chat history
cynthiajoan Oct 8, 2025
9a27919
tweak UI a bit
cynthiajoan Oct 9, 2025
b44470c
add media sample
cynthiajoan Oct 15, 2025
0a05de8
add function calling test
cynthiajoan Oct 16, 2025
50f227f
Merge branch 'main' into firebaseai/server_template
cynthiajoan Oct 16, 2025
7032216
testing imagen
cynthiajoan Oct 18, 2025
776747b
make inputs optional
cynthiajoan Oct 22, 2025
3e6963d
Add documentations
cynthiajoan Oct 24, 2025
1793936
add test and function calling
cynthiajoan Oct 28, 2025
0e57413
make inputs required
cynthiajoan Oct 28, 2025
a52801c
remove chat feature
cynthiajoan Oct 29, 2025
c08d565
Merge branch 'main' into firebaseai/server_template
cynthiajoan Nov 10, 2025
5f01bbc
some gemini comments
cynthiajoan Nov 10, 2025
7e24d4e
add documentations
cynthiajoan Nov 10, 2025
ef4e5c4
fix the template test
cynthiajoan Nov 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions packages/firebase_ai/firebase_ai/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import 'pages/json_schema_page.dart';
import 'pages/schema_page.dart';
import 'pages/token_count_page.dart';
import 'pages/video_page.dart';
import 'pages/server_template_page.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -199,6 +200,11 @@ class _HomeScreenState extends State<HomeScreen> {
model: currentModel,
useVertexBackend: useVertexBackend,
);
case 11:
return ServerTemplatePage(
title: 'Server Template',
useVertexBackend: useVertexBackend,
);

default:
// Fallback to the first page in case of an unexpected index
Expand Down Expand Up @@ -227,18 +233,15 @@ class _HomeScreenState extends State<HomeScreen> {
style: TextStyle(
fontSize: 12,
color: widget.useVertexBackend
? Theme.of(context)
.colorScheme
.onSurface
.withValues(alpha: 0.7)
? Theme.of(context).colorScheme.onSurface.withAlpha(180)
: Theme.of(context).colorScheme.primary,
),
),
Switch(
value: widget.useVertexBackend,
onChanged: widget.onBackendChanged,
activeTrackColor: Colors.green.withValues(alpha: 0.5),
inactiveTrackColor: Colors.blueGrey.withValues(alpha: 0.5),
activeTrackColor: Colors.green.withAlpha(128),
inactiveTrackColor: Colors.blueGrey.withAlpha(128),
activeThumbColor: Colors.green,
inactiveThumbColor: Colors.blueGrey,
),
Expand All @@ -251,7 +254,7 @@ class _HomeScreenState extends State<HomeScreen> {
: Theme.of(context)
.colorScheme
.onSurface
.withValues(alpha: 0.7),
.withAlpha(180),
),
),
],
Expand All @@ -273,7 +276,7 @@ class _HomeScreenState extends State<HomeScreen> {
unselectedFontSize: 9,
selectedItemColor: Theme.of(context).colorScheme.primary,
unselectedItemColor: widget.useVertexBackend
? Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7)
? Theme.of(context).colorScheme.onSurface.withAlpha(180)
: Colors.grey,
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
Expand Down Expand Up @@ -333,6 +336,13 @@ class _HomeScreenState extends State<HomeScreen> {
label: 'Live',
tooltip: 'Live Stream',
),
BottomNavigationBarItem(
icon: Icon(
Icons.storage,
),
label: 'Server',
tooltip: 'Server Template',
),
],
currentIndex: widget.selectedIndex,
onTap: _onItemTapped,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:flutter/material.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -65,11 +64,13 @@ class _ImagePromptPageState extends State<ImagePromptPage> {
var content = _generatedContent[idx];
return MessageWidget(
text: content.text,
image: Image.memory(
content.imageBytes!,
cacheWidth: 400,
cacheHeight: 400,
),
image: content.imageBytes == null
? null
: Image.memory(
content.imageBytes!,
cacheWidth: 400,
cacheHeight: 400,
),
isFromUser: content.fromUser ?? false,
);
},
Expand Down
Loading
Loading