mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +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:
@@ -23,7 +23,12 @@ class Cell extends StatefulWidget {
|
||||
|
||||
class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
static const double gravity = 9.81;
|
||||
static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0);
|
||||
static final AccelerometerEvent defaultPosition = AccelerometerEvent(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
DateTime.now(),
|
||||
);
|
||||
|
||||
int cellNumber = 0;
|
||||
Random? _random;
|
||||
@@ -82,7 +87,10 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
builder: (context) {
|
||||
return Card(
|
||||
// Mimic the platform Material look.
|
||||
margin: const EdgeInsets.symmetric(horizontal: 36, vertical: 24),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 36,
|
||||
vertical: 24,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
@@ -112,22 +120,22 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
child: StreamBuilder<AccelerometerEvent>(
|
||||
// Don't continuously rebuild for nothing when the
|
||||
// cell isn't visible.
|
||||
stream:
|
||||
appLifecycleState == AppLifecycleState.resumed
|
||||
? accelerometerEventStream()
|
||||
: Stream.value(defaultPosition),
|
||||
stream: appLifecycleState == AppLifecycleState.resumed
|
||||
? accelerometerEventStream()
|
||||
: Stream.value(defaultPosition),
|
||||
initialData: defaultPosition,
|
||||
builder: (context, snapshot) {
|
||||
return Transform(
|
||||
// Figure out the phone's orientation relative
|
||||
// to gravity's direction. Ignore the z vector.
|
||||
transform: Matrix4.rotationX(
|
||||
snapshot.data!.y / gravity * pi / 2,
|
||||
)..multiply(
|
||||
Matrix4.rotationY(
|
||||
snapshot.data!.x / gravity * pi / 2,
|
||||
),
|
||||
),
|
||||
transform:
|
||||
Matrix4.rotationX(
|
||||
snapshot.data!.y / gravity * pi / 2,
|
||||
)..multiply(
|
||||
Matrix4.rotationY(
|
||||
snapshot.data!.x / gravity * pi / 2,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const FlutterLogo(size: 72),
|
||||
);
|
||||
@@ -1,17 +1,17 @@
|
||||
name: flutter_module_using_plugin
|
||||
name: flutter_module_using_plugin_android_view
|
||||
description: An example Flutter module that uses a plugin.
|
||||
|
||||
version: 1.0.0+1
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0-0
|
||||
sdk: ^3.8.1-0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
provider: ^6.0.2
|
||||
url_launcher: ^6.0.20
|
||||
sensors_plus: ^5.0.1
|
||||
provider: ^6.1.5
|
||||
url_launcher: ^6.3.2
|
||||
sensors_plus: ^6.1.1
|
||||
|
||||
dev_dependencies:
|
||||
analysis_defaults:
|
||||
@@ -6,7 +6,7 @@
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_module_using_plugin/main.dart';
|
||||
import 'package:flutter_module_using_plugin_android_view/main.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -125,28 +125,26 @@ class _BookDetailState extends State<BookDetail> {
|
||||
IconButton(
|
||||
icon: const Icon(Icons.check),
|
||||
// Pressing save sends the updated book to the platform.
|
||||
onPressed:
|
||||
book != null
|
||||
? () {
|
||||
hostApi.finishEditingBook(book!);
|
||||
clear();
|
||||
}
|
||||
: null,
|
||||
onPressed: book != null
|
||||
? () {
|
||||
hostApi.finishEditingBook(book!);
|
||||
clear();
|
||||
}
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
body:
|
||||
book == null
|
||||
// Draw a spinner until the platform gives us the book to show details
|
||||
// for.
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: BookForm(
|
||||
book: book!,
|
||||
focusNode: textFocusNode,
|
||||
authorTextController: authorTextController,
|
||||
subtitleTextController: subtitleTextController,
|
||||
titleTextController: titleTextController,
|
||||
),
|
||||
body: book == null
|
||||
// Draw a spinner until the platform gives us the book to show details
|
||||
// for.
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: BookForm(
|
||||
book: book!,
|
||||
focusNode: textFocusNode,
|
||||
authorTextController: authorTextController,
|
||||
subtitleTextController: subtitleTextController,
|
||||
titleTextController: titleTextController,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ name: flutter_module_books
|
||||
description: A Flutter module using the Pigeon package to demonstrate
|
||||
integrating Flutter in a realistic scenario where the existing platform app
|
||||
already has business logic and middleware constraints.
|
||||
|
||||
version: 1.0.0+1
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0-0
|
||||
sdk: ^3.9.0-0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
@@ -20,11 +20,15 @@ void main() {
|
||||
expect(mockHostApi.cancelCalls, 1);
|
||||
});
|
||||
|
||||
testWidgets('Pressing done calls the finish editing API', (tester) async {
|
||||
testWidgets('Pressing done calls the finish editing API', (
|
||||
tester,
|
||||
) async {
|
||||
MockHostBookApi mockHostApi = MockHostBookApi();
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(home: BookDetail(book: Book(), hostApi: mockHostApi)),
|
||||
MaterialApp(
|
||||
home: BookDetail(book: Book(), hostApi: mockHostApi),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.byIcon(Icons.check));
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
name: flutter_module
|
||||
name: flutter_module_fullscreen
|
||||
description: An example Flutter module.
|
||||
|
||||
version: 1.0.0+1
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0-0
|
||||
sdk: ^3.9.0-0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_module/main.dart';
|
||||
import 'package:flutter_module_fullscreen/main.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_driver/driver_extension.dart';
|
||||
import 'package:flutter_module/main.dart' as app;
|
||||
import 'package:flutter_module_fullscreen/main.dart' as app;
|
||||
|
||||
// This alternate entrypoint is used for espresso testing. See
|
||||
// https://pub.dev/packages/espresso for details.
|
||||
@@ -82,7 +82,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
TextButton(onPressed: _incrementCounter, child: const Text('Add')),
|
||||
TextButton(
|
||||
onPressed: _incrementCounter,
|
||||
child: const Text('Add'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_channel.invokeMethod<void>("next", _counter);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
name: multiple_flutters_module
|
||||
description: A module that is embedded in the multiple_flutters_ios and multiple_flutters_android sample code.
|
||||
|
||||
version: 1.0.0+1
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0-0
|
||||
sdk: ^3.9.0-0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
@@ -23,7 +23,12 @@ class Cell extends StatefulWidget {
|
||||
|
||||
class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
static const double gravity = 9.81;
|
||||
static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0);
|
||||
static final AccelerometerEvent defaultPosition = AccelerometerEvent(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
DateTime.now(),
|
||||
);
|
||||
|
||||
int cellNumber = 0;
|
||||
Random? _random;
|
||||
@@ -82,7 +87,10 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
builder: (context) {
|
||||
return Card(
|
||||
// Mimic the platform Material look.
|
||||
margin: const EdgeInsets.symmetric(horizontal: 36, vertical: 24),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 36,
|
||||
vertical: 24,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
@@ -112,10 +120,9 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
child: StreamBuilder<AccelerometerEvent>(
|
||||
// Don't continuously rebuild for nothing when the
|
||||
// cell isn't visible.
|
||||
stream:
|
||||
appLifecycleState == AppLifecycleState.resumed
|
||||
? accelerometerEventStream()
|
||||
: Stream.value(defaultPosition),
|
||||
stream: appLifecycleState == AppLifecycleState.resumed
|
||||
? accelerometerEventStream()
|
||||
: Stream.value(defaultPosition),
|
||||
initialData: defaultPosition,
|
||||
builder: (context, snapshot) {
|
||||
final data = snapshot.data;
|
||||
@@ -125,11 +132,14 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
return Transform(
|
||||
// Figure out the phone's orientation relative
|
||||
// to gravity's direction. Ignore the z vector.
|
||||
transform: Matrix4.rotationX(
|
||||
data.y / gravity * pi / 2,
|
||||
)..multiply(
|
||||
Matrix4.rotationY(data.x / gravity * pi / 2),
|
||||
),
|
||||
transform:
|
||||
Matrix4.rotationX(
|
||||
data.y / gravity * pi / 2,
|
||||
)..multiply(
|
||||
Matrix4.rotationY(
|
||||
data.x / gravity * pi / 2,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const FlutterLogo(size: 72),
|
||||
);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
name: flutter_module_using_plugin
|
||||
description: An example Flutter module that uses a plugin.
|
||||
|
||||
version: 1.0.0+1
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0-0
|
||||
sdk: ^3.9.0-0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
provider: ^6.0.2
|
||||
url_launcher: ^6.0.20
|
||||
sensors_plus: ^5.0.1
|
||||
sensors_plus: ^6.1.1
|
||||
|
||||
dev_dependencies:
|
||||
analysis_defaults:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
name: flutter_module
|
||||
description: An example Flutter module.
|
||||
|
||||
version: 1.0.0+1
|
||||
resolution: workspace
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0-0
|
||||
sdk: ^3.9.0-0
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
||||
Reference in New Issue
Block a user