1
0
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:
Eric Windmill
2025-08-14 12:26:24 -07:00
committed by GitHub
parent 0aa5415d5e
commit 2999d738b8
410 changed files with 28166 additions and 27661 deletions

View File

@@ -56,7 +56,8 @@ class PlatformAdaptingHomePage extends StatefulWidget {
_PlatformAdaptingHomePageState();
}
class _PlatformAdaptingHomePageState extends State<PlatformAdaptingHomePage> {
class _PlatformAdaptingHomePageState
extends State<PlatformAdaptingHomePage> {
// This app keeps a global key for the songs tab because it owns a bunch of
// data. Since changing platform re-parents those tabs into different
// scaffolds, keeping a global key to it lets this app keep that tab's data as
@@ -88,7 +89,10 @@ class _PlatformAdaptingHomePageState extends State<PlatformAdaptingHomePage> {
label: SongsTab.title,
icon: SongsTab.iosIcon,
),
BottomNavigationBarItem(label: NewsTab.title, icon: NewsTab.iosIcon),
BottomNavigationBarItem(
label: NewsTab.title,
icon: NewsTab.iosIcon,
),
BottomNavigationBarItem(
label: ProfileTab.title,
icon: ProfileTab.iosIcon,
@@ -168,7 +172,9 @@ class _AndroidDrawer extends StatelessWidget {
Navigator.pop(context);
Navigator.push<void>(
context,
MaterialPageRoute(builder: (context) => const ProfileTab()),
MaterialPageRoute(
builder: (context) => const ProfileTab(),
),
);
},
),
@@ -184,7 +190,9 @@ class _AndroidDrawer extends StatelessWidget {
Navigator.pop(context);
Navigator.push<void>(
context,
MaterialPageRoute(builder: (context) => const SettingsTab()),
MaterialPageRoute(
builder: (context) => const SettingsTab(),
),
);
},
),

View File

@@ -31,7 +31,10 @@ class _NewsTabState extends State<NewsTab> {
@override
void initState() {
colors = getRandomColors(_itemsLength);
titles = List.generate(_itemsLength, (index) => generateRandomHeadline());
titles = List.generate(
_itemsLength,
(index) => generateRandomHeadline(),
);
contents = List.generate(
_itemsLength,
(index) => lorem(paragraphs: 1, words: 24),
@@ -46,11 +49,15 @@ class _NewsTabState extends State<NewsTab> {
child: Card(
elevation: 1.5,
margin: const EdgeInsets.fromLTRB(6, 12, 6, 0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
child: InkWell(
// Make it splash on Android. It would happen automatically if this
// was a real card but this is just a demo. Skip the splash on iOS.
onTap: defaultTargetPlatform == TargetPlatform.iOS ? null : () {},
onTap: defaultTargetPlatform == TargetPlatform.iOS
? null
: () {},
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
@@ -114,6 +121,9 @@ class _NewsTabState extends State<NewsTab> {
@override
Widget build(context) {
return PlatformWidget(androidBuilder: _buildAndroid, iosBuilder: _buildIos);
return PlatformWidget(
androidBuilder: _buildAndroid,
iosBuilder: _buildIos,
);
}
}

View File

@@ -99,7 +99,10 @@ class ProfileTab extends StatelessWidget {
@override
Widget build(context) {
return PlatformWidget(androidBuilder: _buildAndroid, iosBuilder: _buildIos);
return PlatformWidget(
androidBuilder: _buildAndroid,
iosBuilder: _buildIos,
);
}
}
@@ -243,6 +246,9 @@ class LogOutButton extends StatelessWidget {
@override
Widget build(context) {
return PlatformWidget(androidBuilder: _buildAndroid, iosBuilder: _buildIos);
return PlatformWidget(
androidBuilder: _buildAndroid,
iosBuilder: _buildIos,
);
}
}

View File

@@ -105,6 +105,9 @@ class _SettingsTabState extends State<SettingsTab> {
@override
Widget build(context) {
return PlatformWidget(androidBuilder: _buildAndroid, iosBuilder: _buildIos);
return PlatformWidget(
androidBuilder: _buildAndroid,
iosBuilder: _buildIos,
);
}
}

View File

@@ -42,38 +42,38 @@ class SongDetailTab extends StatelessWidget {
// to build while the hero transition is mid-flight.
//
// It could either be specified here or in SongsTab.
flightShuttleBuilder: (
context,
animation,
flightDirection,
fromHeroContext,
toHeroContext,
) {
return HeroAnimatingSongCard(
song: song,
color: color,
heroAnimation: animation,
);
},
flightShuttleBuilder:
(
context,
animation,
flightDirection,
fromHeroContext,
toHeroContext,
) {
return HeroAnimatingSongCard(
song: song,
color: color,
heroAnimation: animation,
);
},
),
const Divider(height: 0, color: Colors.grey),
Expanded(
child: ListView.builder(
itemCount: 10,
itemBuilder:
(context, index) => switch (index) {
0 => const Padding(
padding: EdgeInsets.only(left: 15, top: 16, bottom: 8),
child: Text(
'You might also like:',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
itemBuilder: (context, index) => switch (index) {
0 => const Padding(
padding: EdgeInsets.only(left: 15, top: 16, bottom: 8),
child: Text(
'You might also like:',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
_ => const SongPlaceholderTile(),
},
),
),
_ => const SongPlaceholderTile(),
},
),
),
],
@@ -86,7 +86,10 @@ class SongDetailTab extends StatelessWidget {
// ===========================================================================
Widget _buildAndroid(BuildContext context) {
return Scaffold(appBar: AppBar(title: Text(song)), body: _buildBody());
return Scaffold(
appBar: AppBar(title: Text(song)),
body: _buildBody(),
);
}
Widget _buildIos(BuildContext context) {
@@ -101,6 +104,9 @@ class SongDetailTab extends StatelessWidget {
@override
Widget build(context) {
return PlatformWidget(androidBuilder: _buildAndroid, iosBuilder: _buildIos);
return PlatformWidget(
androidBuilder: _buildAndroid,
iosBuilder: _buildIos,
);
}
}

View File

@@ -55,10 +55,9 @@ class _SongsTabState extends State<SongsTab> {
// Show a slightly different color palette. Show poppy-ier colors on iOS
// due to lighter contrasting bars and tone it down on Android.
final color =
defaultTargetPlatform == TargetPlatform.iOS
? colors[index]
: colors[index].shade400;
final color = defaultTargetPlatform == TargetPlatform.iOS
? colors[index]
: colors[index].shade400;
return SafeArea(
top: false,
@@ -69,17 +68,15 @@ class _SongsTabState extends State<SongsTab> {
song: songNames[index],
color: color,
heroAnimation: const AlwaysStoppedAnimation(0),
onPressed:
() => Navigator.of(context).push<void>(
MaterialPageRoute(
builder:
(context) => SongDetailTab(
id: index,
song: songNames[index],
color: color,
),
),
onPressed: () => Navigator.of(context).push<void>(
MaterialPageRoute(
builder: (context) => SongDetailTab(
id: index,
song: songNames[index],
color: color,
),
),
),
),
),
);
@@ -117,8 +114,8 @@ class _SongsTabState extends State<SongsTab> {
actions: [
IconButton(
icon: const Icon(Icons.refresh),
onPressed:
() async => await _androidRefreshKey.currentState!.show(),
onPressed: () async =>
await _androidRefreshKey.currentState!.show(),
),
IconButton(
icon: const Icon(Icons.shuffle),
@@ -168,6 +165,9 @@ class _SongsTabState extends State<SongsTab> {
@override
Widget build(context) {
return PlatformWidget(androidBuilder: _buildAndroid, iosBuilder: _buildIos);
return PlatformWidget(
androidBuilder: _buildAndroid,
iosBuilder: _buildIos,
);
}
}

View File

@@ -39,7 +39,8 @@ String generateRandomHeadline() {
2 => '$artist releases ${capitalizePair(wordPairIterator.first)}',
3 => '$artist talks about his ${nouns[_random.nextInt(nouns.length)]}',
4 => '$artist talks about her ${nouns[_random.nextInt(nouns.length)]}',
5 => '$artist talks about their ${nouns[_random.nextInt(nouns.length)]}',
5 =>
'$artist talks about their ${nouns[_random.nextInt(nouns.length)]}',
6 =>
'$artist says their music is inspired by ${wordPairIterator.first.join(' ')}',
7 =>
@@ -54,7 +55,9 @@ String generateRandomHeadline() {
List<MaterialColor> getRandomColors(int amount) {
return List<MaterialColor>.generate(amount, (index) {
return _myListOfRandomColors[_random.nextInt(_myListOfRandomColors.length)];
return _myListOfRandomColors[_random.nextInt(
_myListOfRandomColors.length,
)];
});
}

View File

@@ -113,7 +113,10 @@ class _PressableCardState extends State<PressableCard>
scale: 1 - elevationAnimation.value * 0.03,
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 16, horizontal: 16) *
const EdgeInsets.symmetric(
vertical: 16,
horizontal: 16,
) *
flatten,
child: PhysicalModel(
elevation:
@@ -310,7 +313,9 @@ void showChoices(BuildContext context, List<String> choices) {
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: List<Widget>.generate(choices.length, (index) {
children: List<Widget>.generate(choices.length, (
index,
) {
return RadioListTile<int?>(
title: Text(choices[index]),
value: index,
@@ -345,7 +350,9 @@ void showChoices(BuildContext context, List<String> choices) {
useMagnifier: true,
magnification: 1.1,
itemExtent: 40,
scrollController: FixedExtentScrollController(initialItem: 1),
scrollController: FixedExtentScrollController(
initialItem: 1,
),
children: List<Widget>.generate(choices.length, (index) {
return Center(
child: Text(

View File

@@ -1,16 +1,16 @@
name: platform_design
description: A project showcasing a Flutter app following different platform IA conventions.
version: 1.0.0+1
resolution: workspace
environment:
sdk: ^3.7.0-0
sdk: ^3.9.0-0
dependencies:
english_words: ^4.0.0
flutter_lorem: ^2.0.0
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dev_dependencies:
@@ -18,6 +18,5 @@ dev_dependencies:
path: ../analysis_defaults
flutter_test:
sdk: flutter
flutter:
uses-material-design: true