mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Dart 3.9 / Flutter 3.35 [first LLM release] (#2714)
I got carried away with Gemini and basically rewrote CI and the release process for the new LLM reality. This work was largely completed by Gemini. - Bump all SDK versions to the current beta (3.9.0-0) - Run `flutter channel beta` - Wrote `ci_script.dart` to replace the bash scripts - Converted repository to pub workspace #2499 - Added llm.md and release.md - Added redirect for deprecated Samples Index ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I have added sample code updates to the [changelog]. - [x] I updated/added relevant documentation (doc comments with `///`).
This commit is contained in:
@@ -22,7 +22,8 @@ const double windowWidth = 480;
|
||||
const double windowHeight = 854;
|
||||
|
||||
void setupWindow() {
|
||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
|
||||
if (!kIsWeb &&
|
||||
(Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
setWindowTitle('Infinite List');
|
||||
setWindowMinSize(const Size(windowWidth, windowHeight));
|
||||
@@ -68,26 +69,25 @@ class MyHomePage extends StatelessWidget {
|
||||
// listening to the catalog's `itemCount`, because that's all we need
|
||||
// at this level.
|
||||
selector: (context, catalog) => catalog.itemCount,
|
||||
builder:
|
||||
(context, itemCount, child) => ListView.builder(
|
||||
// When `itemCount` is null, `ListView` assumes an infinite list.
|
||||
// Once we provide a value, it will stop the scrolling beyond
|
||||
// the last element.
|
||||
itemCount: itemCount,
|
||||
padding: const EdgeInsets.symmetric(vertical: 18),
|
||||
itemBuilder: (context, index) {
|
||||
// Every item of the `ListView` is individually listening
|
||||
// to the catalog.
|
||||
var catalog = Provider.of<Catalog>(context);
|
||||
builder: (context, itemCount, child) => ListView.builder(
|
||||
// When `itemCount` is null, `ListView` assumes an infinite list.
|
||||
// Once we provide a value, it will stop the scrolling beyond
|
||||
// the last element.
|
||||
itemCount: itemCount,
|
||||
padding: const EdgeInsets.symmetric(vertical: 18),
|
||||
itemBuilder: (context, index) {
|
||||
// Every item of the `ListView` is individually listening
|
||||
// to the catalog.
|
||||
var catalog = Provider.of<Catalog>(context);
|
||||
|
||||
// Catalog provides a single synchronous method for getting the
|
||||
// current data.
|
||||
return switch (catalog.getByIndex(index)) {
|
||||
Item(isLoading: true) => const LoadingItemTile(),
|
||||
var item => ItemTile(item: item),
|
||||
};
|
||||
},
|
||||
),
|
||||
// Catalog provides a single synchronous method for getting the
|
||||
// current data.
|
||||
return switch (catalog.getByIndex(index)) {
|
||||
Item(isLoading: true) => const LoadingItemTile(),
|
||||
var item => ItemTile(item: item),
|
||||
};
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,11 @@ Future<ItemPage> fetchPage(int startingIndex) async {
|
||||
// If the [startingIndex] is beyond the bounds of the catalog, an
|
||||
// empty page will be returned.
|
||||
if (startingIndex > catalogLength) {
|
||||
return ItemPage(items: [], startingIndex: startingIndex, hasNext: false);
|
||||
return ItemPage(
|
||||
items: [],
|
||||
startingIndex: startingIndex,
|
||||
hasNext: false,
|
||||
);
|
||||
}
|
||||
|
||||
// The page of items is generated here.
|
||||
|
||||
@@ -22,7 +22,10 @@ class ItemTile extends StatelessWidget {
|
||||
aspectRatio: 1,
|
||||
child: Container(color: item.color),
|
||||
),
|
||||
title: Text(item.name, style: Theme.of(context).textTheme.titleLarge),
|
||||
title: Text(
|
||||
item.name,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
trailing: Text('\$ ${(item.price / 100).toStringAsFixed(2)}'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -2,17 +2,17 @@ name: infinitelist
|
||||
description: >
|
||||
A sample implementation of an infinite list.
|
||||
publish_to: none
|
||||
resolution: workspace
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0-0
|
||||
sdk: ^3.9.0-0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
cupertino_icons: ^1.0.2
|
||||
meta: ^1.3.0
|
||||
meta: 1.16.0
|
||||
provider: ^6.0.2
|
||||
window_size:
|
||||
git:
|
||||
@@ -24,6 +24,5 @@ dev_dependencies:
|
||||
path: ../analysis_defaults
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -25,7 +25,11 @@ void main() {
|
||||
expect(find.text('Color #1'), findsOneWidget);
|
||||
|
||||
// Flinging up quickly (i.e. scrolling down).
|
||||
await tester.fling(find.byType(ListView), const Offset(0, -2000), 5000);
|
||||
await tester.fling(
|
||||
find.byType(ListView),
|
||||
const Offset(0, -2000),
|
||||
5000,
|
||||
);
|
||||
|
||||
// As we scroll down, we should see more items loading.
|
||||
expect(find.text('...'), findsWidgets);
|
||||
|
||||
Reference in New Issue
Block a user