Skip to content

Commit 44ace48

Browse files
committed
-
1 parent cb50726 commit 44ace48

File tree

4 files changed

+43
-88
lines changed

4 files changed

+43
-88
lines changed

pkgs/example/lib/sdk/agent/fake_output.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ final fakeInvitationData = InvitationData(
1515
exploreItems: [
1616
CarouselItemData(
1717
title: 'Beach Bliss',
18-
imageUrl: 'assets/explore/beach_bliss.png',
18+
assetUrl: 'assets/explore/beach_bliss.png',
1919
),
2020
CarouselItemData(
2121
title: 'Urban Escapes',
22-
imageUrl: 'assets/explore/urban_escapes.png',
22+
assetUrl: 'assets/explore/urban_escapes.png',
2323
),
2424
CarouselItemData(
2525
title: "Nature's Wonders",
26-
imageUrl: 'assets/explore/natures_wonder.png',
26+
assetUrl: 'assets/explore/natures_wonders.png',
2727
),
2828
],
2929
chatHintText: 'Ask me anything',

pkgs/example/lib/sdk/catalog/carousel.dart

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1+
import 'package:example/sdk/catalog/shared/text_styles.dart';
12
import 'package:example/sdk/model/simple_items.dart';
23
import 'package:flutter/material.dart';
34

5+
const double _imageSize = 190;
6+
47
class Carousel extends StatelessWidget {
58
const Carousel({super.key, required this.data});
69

710
final CarouselData data;
811

912
@override
1013
Widget build(BuildContext context) {
11-
return Expanded(
12-
child: ListView.builder(
13-
scrollDirection: Axis.horizontal,
14-
itemCount: data.items.length,
15-
itemBuilder: (context, index) => CarouselItem(data: data.items[index]),
14+
return ConstrainedBox(
15+
constraints: const BoxConstraints(maxHeight: 220),
16+
child: CarouselView(
17+
itemExtent: _imageSize,
18+
// Set no border.
19+
shape: RoundedRectangleBorder(borderRadius: BorderRadius.zero),
20+
children: data.items.map((item) => CarouselItem(data: item)).toList(),
1621
),
1722
);
1823
}
@@ -25,15 +30,33 @@ class CarouselItem extends StatelessWidget {
2530

2631
@override
2732
Widget build(BuildContext context) {
28-
return const Placeholder();
33+
return Column(
34+
children: [
35+
Container(
36+
width: _imageSize,
37+
height: _imageSize,
38+
child: ClipRRect(
39+
borderRadius: BorderRadius.circular(
40+
10.0,
41+
), // Adjust the radius as needed
42+
child: Image.asset(data.assetUrl, fit: BoxFit.cover),
43+
),
44+
),
45+
Text(
46+
data.title,
47+
style: GenUiTextStyles.normal(context),
48+
overflow: TextOverflow.ellipsis,
49+
),
50+
],
51+
);
2952
}
3053
}
3154

3255
class CarouselItemData extends WidgetData {
3356
final String title;
34-
final String imageUrl;
57+
final String assetUrl;
3558

36-
CarouselItemData({required this.title, required this.imageUrl});
59+
CarouselItemData({required this.title, required this.assetUrl});
3760
}
3861

3962
class CarouselData extends WidgetData {

pkgs/example/lib/sdk/catalog/shared/text_styles.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ import 'package:flutter/material.dart';
22

33
abstract class GenUiTextStyles {
44
static TextStyle normal(BuildContext context) {
5-
return Theme.of(context).textTheme.labelLarge!;
5+
return Theme.of(
6+
context,
7+
).textTheme.labelLarge!.copyWith(fontSize: 14.0, inherit: true);
68
}
79

810
static TextStyle h1(BuildContext context) => normal(
911
context,
10-
).copyWith(fontSize: 36.0, fontWeight: FontWeight.w900, inherit: true);
12+
).copyWith(fontSize: 36.0, fontWeight: FontWeight.w700, inherit: true);
1113

1214
static TextStyle h2(BuildContext context) => normal(
1315
context,
14-
).copyWith(fontSize: 22.0, fontWeight: FontWeight.w200, inherit: true);
16+
).copyWith(fontSize: 22.0, fontWeight: FontWeight.w500, inherit: true);
1517
}

pkgs/example/pubspec.yaml

Lines changed: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,19 @@
11
name: example
2-
description: "A new Flutter project."
3-
# The following line prevents the package from being accidentally published to
4-
# pub.dev using `flutter pub publish`. This is preferred for private packages.
5-
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
6-
7-
# The following defines the version and build number for your application.
8-
# A version number is three numbers separated by dots, like 1.2.43
9-
# followed by an optional build number separated by a +.
10-
# Both the version and the builder number may be overridden in flutter
11-
# build by specifying --build-name and --build-number, respectively.
12-
# In Android, build-name is used as versionName while build-number used as versionCode.
13-
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
14-
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
15-
# Read more about iOS versioning at
16-
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
17-
# In Windows, build-name is used as the major, minor, and patch parts
18-
# of the product and file versions while build-number is used as the build suffix.
19-
version: 1.0.0+1
2+
publish_to: 'none'
203

214
environment:
225
sdk: ^3.9.0-196.0.dev
236

24-
# Dependencies specify other packages that your package needs in order to work.
25-
# To automatically upgrade your package dependencies to the latest versions
26-
# consider running `flutter pub upgrade --major-versions`. Alternatively,
27-
# dependencies can be manually updated by changing the version numbers below to
28-
# the latest version available on pub.dev. To see which dependencies have newer
29-
# versions available, run `flutter pub outdated`.
307
dependencies:
318
flutter:
329
sdk: flutter
3310

34-
# The following adds the Cupertino Icons font to your application.
35-
# Use with the CupertinoIcons class for iOS style icons.
36-
cupertino_icons: ^1.0.8
37-
3811
dev_dependencies:
3912
flutter_test:
4013
sdk: flutter
14+
dart_flutter_team_lints: ^3.5.2
4115

42-
# The "flutter_lints" package below contains a set of recommended lints to
43-
# encourage good coding practices. The lint set provided by the package is
44-
# activated in the `analysis_options.yaml` file located at the root of your
45-
# package. See that file for information about deactivating specific lint
46-
# rules and activating additional ones.
47-
flutter_lints: ^5.0.0
48-
49-
# For information on the generic Dart part of this file, see the
50-
# following page: https://dart.dev/tools/pub/pubspec
51-
52-
# The following section is specific to Flutter packages.
5316
flutter:
54-
55-
# The following line ensures that the Material Icons font is
56-
# included with your application, so that you can use the icons in
57-
# the material Icons class.
5817
uses-material-design: true
59-
60-
# To add assets to your application, add an assets section, like this:
61-
# assets:
62-
# - images/a_dot_burr.jpeg
63-
# - images/a_dot_ham.jpeg
64-
65-
# An image asset can refer to one or more resolution-specific "variants", see
66-
# https://flutter.dev/to/resolution-aware-images
67-
68-
# For details regarding adding assets from package dependencies, see
69-
# https://flutter.dev/to/asset-from-package
70-
71-
# To add custom fonts to your application, add a fonts section here,
72-
# in this "flutter" section. Each entry in this list should have a
73-
# "family" key with the font family name, and a "fonts" key with a
74-
# list giving the asset and other descriptors for the font. For
75-
# example:
76-
# fonts:
77-
# - family: Schyler
78-
# fonts:
79-
# - asset: fonts/Schyler-Regular.ttf
80-
# - asset: fonts/Schyler-Italic.ttf
81-
# style: italic
82-
# - family: Trajan Pro
83-
# fonts:
84-
# - asset: fonts/TrajanPro.ttf
85-
# - asset: fonts/TrajanPro_Bold.ttf
86-
# weight: 700
87-
#
88-
# For details regarding fonts from package dependencies,
89-
# see https://flutter.dev/to/font-from-package
18+
assets:
19+
- assets/explore/

0 commit comments

Comments
 (0)