Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
12 changes: 7 additions & 5 deletions examples/travel_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_genui/flutter_genui.dart';

import 'firebase_options.dart';
import 'src/asset_images.dart';
import 'src/catalog.dart';
import 'src/images.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -19,6 +19,7 @@ void main() async {
androidProvider: AndroidProvider.debug,
webProvider: ReCaptchaV3Provider('debug'),
);
_imagesJson = await assetImageCatalogJson();
runApp(const MyApp());
}

Expand Down Expand Up @@ -177,6 +178,8 @@ class _MyHomePageState extends State<MyHomePage> {
}
}

late final String _imagesJson;

final systemPrompt =
'''You are a helpful travel agent assistant who figures out what kind of trip the user wants,
and then guides them to book it.
Expand Down Expand Up @@ -222,8 +225,7 @@ That way the user can refine their search and retry.
When generating content to go inside itinerary_with_details, use itinerary_item, but try to occasionally break it up with other widgets e.g. section_header items to break up the section, or travel_carousel with related content.
E.g. after an itinerary item like a beach visit, you could include a carousel of local fish, or alternative beaches to visit.

# Images to use

If you need to use any image URLs, try to find the most relevant ones from the following data:
$imagesJson
If you need to use any images, try to find the most relevant ones from the following
asset images:
$_imagesJson
''';
16 changes: 16 additions & 0 deletions examples/travel_app/lib/src/asset_images.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

@visibleForTesting
const assetImageCatalogPath = 'assets/travel_images';
@visibleForTesting
const assetImageCatalogJsonFile = '$assetImageCatalogPath/.images.json';

Future<String> assetImageCatalogJson() async {
var result = await rootBundle.loadString(assetImageCatalogJsonFile);
result = result.replaceAll(
'"image_file_name": "',
'"image_file_name": "$assetImageCatalogPath/',
);
return result;
}
215 changes: 0 additions & 215 deletions examples/travel_app/lib/src/images.dart

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
4 changes: 3 additions & 1 deletion examples/travel_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

name: genui_client
name: travel_app
description: "An app that generates user interfaces on the fly using AI."
publish_to: "none"
version: 0.1.0
Expand Down Expand Up @@ -35,3 +35,5 @@ dev_dependencies:

flutter:
uses-material-design: true
assets:
- assets/travel_images/
2 changes: 1 addition & 1 deletion examples/travel_app/test/filter_chip_group_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_genui/flutter_genui.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:genui_client/src/catalog/filter_chip_group.dart';
import 'package:travel_app/src/catalog/filter_chip_group.dart';

void main() {
group('filterChipGroup', () {
Expand Down
30 changes: 30 additions & 0 deletions examples/travel_app/test/image_catalog_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ignore_for_file: avoid_dynamic_calls

import 'dart:convert';
import 'dart:io';

import 'package:flutter_test/flutter_test.dart';
import 'package:travel_app/src/asset_images.dart';

void main() {
test(
'images.json should contain all images from assets/travel_images',
() async {
TestWidgetsFlutterBinding.ensureInitialized();

final imageAssets = await assetImageCatalogJson();
final imageList = (jsonDecode(imageAssets) as List)
.map((e) => e['image_file_name'] as String)
.toList();

final imageDir = Directory(assetImageCatalogPath);
final imageFiles = imageDir
.listSync()
.where((file) => file.path != assetImageCatalogJsonFile)
.map((file) => file.path)
.toList();

expect(imageList, unorderedEquals(imageFiles));
},
);
}
Loading