Skip to content

Commit 9aa6442

Browse files
committed
Merge branch 'main' of https://github.com/flutter/website into samples-index
2 parents eb1d24d + e07ff33 commit 9aa6442

File tree

15 files changed

+590
-301
lines changed

15 files changed

+590
-301
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
submodules: recursive
7979
- name: Enable Corepack
8080
run: npm i -g corepack@latest && corepack enable
81-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
81+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e
8282
with:
8383
node-version: ${{ env.NODE_VERSION }}
8484
cache: 'pnpm'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:flutter/cupertino.dart';
2+
3+
void main() => runApp(const MyApp());
4+
5+
class MyApp extends StatelessWidget {
6+
const MyApp({super.key});
7+
8+
@override
9+
Widget build(BuildContext context) {
10+
const title = 'Floating Navigation Bar';
11+
12+
return CupertinoApp(
13+
title: title,
14+
home: CupertinoPageScaffold(
15+
// No navigation bar provided to CupertinoPageScaffold,
16+
// only a body with a CustomScrollView.
17+
child: CustomScrollView(
18+
slivers: [
19+
// Add the navigation bar to the CustomScrollView.
20+
const CupertinoSliverNavigationBar(
21+
// Provide a standard title.
22+
largeTitle: Text(title),
23+
),
24+
// #docregion SliverList
25+
// Next, create a SliverList
26+
SliverList.builder(
27+
// The builder function returns a CupertinoListTile with a title
28+
// that displays the index of the current item.
29+
itemBuilder:
30+
(context, index) =>
31+
CupertinoListTile(title: Text('Item #$index')),
32+
// Builds 50 CupertinoListTile
33+
itemCount: 50,
34+
),
35+
// #enddocregion SliverList
36+
],
37+
),
38+
),
39+
);
40+
}
41+
}

examples/cookbook/lists/floating_app_bar/lib/main.dart examples/cookbook/lists/floating_app_bar/lib/main_material.dart

+10-13
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,30 @@ class MyApp extends StatelessWidget {
1212
return MaterialApp(
1313
title: title,
1414
home: Scaffold(
15-
// No appbar provided to the Scaffold, only a body with a
15+
// No app bar provided to Scaffold, only a body with a
1616
// CustomScrollView.
1717
body: CustomScrollView(
1818
slivers: [
1919
// Add the app bar to the CustomScrollView.
2020
const SliverAppBar(
2121
// Provide a standard title.
2222
title: Text(title),
23-
// Allows the user to reveal the app bar if they begin scrolling
24-
// back up the list of items.
25-
floating: true,
23+
// Pin the app bar when scrolling
24+
pinned: true,
2625
// Display a placeholder widget to visualize the shrinking size.
2726
flexibleSpace: Placeholder(),
2827
// Make the initial height of the SliverAppBar larger than normal.
2928
expandedHeight: 200,
3029
),
3130
// #docregion SliverList
3231
// Next, create a SliverList
33-
SliverList(
34-
// Use a delegate to build items as they're scrolled on screen.
35-
delegate: SliverChildBuilderDelegate(
36-
// The builder function returns a ListTile with a title that
37-
// displays the index of the current item.
38-
(context, index) => ListTile(title: Text('Item #$index')),
39-
// Builds 1000 ListTiles
40-
childCount: 1000,
41-
),
32+
SliverList.builder(
33+
// The builder function returns a ListTile with a title that
34+
// displays the index of the current item.
35+
itemBuilder:
36+
(context, index) => ListTile(title: Text('Item #$index')),
37+
// Builds 50 ListTiles
38+
itemCount: 50,
4239
),
4340
// #enddocregion SliverList
4441
],

examples/cookbook/lists/floating_app_bar/lib/starter.dart

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import 'package:flutter/cupertino.dart';
2+
3+
class MyApp extends StatelessWidget {
4+
const MyApp({super.key});
5+
6+
@override
7+
Widget build(BuildContext context) {
8+
// #docregion CustomScrollView
9+
return const CupertinoApp(
10+
title: 'Floating Navigation Bar',
11+
home: CupertinoPageScaffold(
12+
// No navigation bar property provided yet.
13+
child: CustomScrollView(
14+
// Add the navigation bar and list of items as slivers in the next steps.
15+
slivers: <Widget>[],
16+
),
17+
),
18+
);
19+
// #enddocregion CustomScrollView
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import 'package:flutter/material.dart';
2+
3+
class MyApp extends StatelessWidget {
4+
const MyApp({super.key});
5+
6+
@override
7+
Widget build(BuildContext context) {
8+
// #docregion CustomScrollView
9+
return const MaterialApp(
10+
title: 'Floating App Bar',
11+
home: Scaffold(
12+
// No app bar property provided yet.
13+
body: CustomScrollView(
14+
// Add the app bar and list of items as slivers in the next steps.
15+
slivers: <Widget>[],
16+
),
17+
),
18+
);
19+
// #enddocregion CustomScrollView
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import 'package:flutter/cupertino.dart';
2+
3+
void main() => runApp(const MyApp());
4+
5+
class MyApp extends StatelessWidget {
6+
const MyApp({super.key});
7+
8+
@override
9+
Widget build(BuildContext context) {
10+
return const CupertinoApp(
11+
title: 'Floating App Bar',
12+
home: CupertinoPageScaffold(
13+
// No navigation bar provided to CupertinoPageScaffold,
14+
// only a body with a CustomScrollView.
15+
child: CustomScrollView(
16+
// #docregion SliverAppBar
17+
slivers: [
18+
// Add the navigation bar to the CustomScrollView.
19+
CupertinoSliverNavigationBar(
20+
// Provide a standard title.
21+
largeTitle: Text('Floating App Bar'),
22+
),
23+
],
24+
// #enddocregion SliverAppBar
25+
),
26+
),
27+
);
28+
}
29+
}

examples/cookbook/lists/floating_app_bar/lib/step2.dart examples/cookbook/lists/floating_app_bar/lib/step2_material.dart

+6-9
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,28 @@ class MyApp extends StatelessWidget {
77

88
@override
99
Widget build(BuildContext context) {
10-
const title = 'Floating App Bar';
11-
1210
return const MaterialApp(
13-
title: title,
11+
title: 'Floating App Bar',
1412
home: Scaffold(
1513
// No appbar provided to the Scaffold, only a body with a
1614
// CustomScrollView.
17-
// #docregion SliverAppBar
1815
body: CustomScrollView(
16+
// #docregion SliverAppBar
1917
slivers: [
2018
// Add the app bar to the CustomScrollView.
2119
SliverAppBar(
2220
// Provide a standard title.
23-
title: Text(title),
24-
// Allows the user to reveal the app bar if they begin scrolling
25-
// back up the list of items.
26-
floating: true,
21+
title: Text('Floating App Bar'),
22+
// Pin the app bar when scrolling.
23+
pinned: true,
2724
// Display a placeholder widget to visualize the shrinking size.
2825
flexibleSpace: Placeholder(),
2926
// Make the initial height of the SliverAppBar larger than normal.
3027
expandedHeight: 200,
3128
),
3229
],
30+
// #enddocregion SliverAppBar
3331
),
34-
// #enddocregion SliverAppBar
3532
),
3633
);
3734
}

firebase.json

+1
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@
379379
{ "source": "/go/faster-cocoon", "destination": "https://docs.google.com/document/d/1NXP0_9TJ1qz674iYyOGVLEHWVpmbXr5yjhBrdoU_x5g/edit", "type": 301 },
380380
{ "source": "/go/federated-platforms", "destination": "https://docs.google.com/document/d/1z_4Z5JMTbk5c4FpayVAb-PTz2wLP-aSCirbieavT3Ws/edit?usp=sharing", "type": 301 },
381381
{ "source": "/go/federated-plugins", "destination": "https://docs.google.com/document/d/1LD7QjmzJZLCopUrFAAE98wOUQpjmguyGTN2wd_89Srs/edit", "type": 301 },
382+
{ "source": "/go/ffi-in-embedders", "destination": "https://docs.google.com/document/d/11siUQs1Fn7G1Baue6YYrJHT0ieNiC-956yVv4gqAhr0/edit?tab=t.0", "type": 301 },
382383
{ "source": "/go/ffi-plugins", "destination": "https://docs.google.com/document/d/1vMw-W6L-r-uL1SUgzDh6J5rmtqum7SZdO9khWACrZJI/edit?resourcekey=0-vvjEK88N-pApyKTPWJ2IZQ", "type": 301 },
383384
{ "source": "/go/file-system-access-from-devtools", "destination": "https://docs.google.com/document/d/1BNgZka2N9HYL11A4IdR8FqsSW1VMr9Vo7CSrjY9rcic/edit?usp=sharing&resourcekey=0-H1f6lS5KjytrUCWc1vcS_w", "type": 301 },
384385
{ "source": "/go/flame-dartpad", "destination": "https://dartpad.dev/?id=3e52ca7b51ba15f989ad880b8b3314a2", "type": 301 },

src/_data/sidenav.yml

+2
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@
188188
permalink: https://codelabs.developers.google.com/codelabs/admob-ads-in-flutter
189189
- title: Add an AdMob banner and native inline ads
190190
permalink: https://codelabs.developers.google.com/codelabs/admob-inline-ads-in-flutter
191+
- title: Integrate multimedia ads (video)
192+
permalink: https://www.youtube.com/watch?v=U8x5n6RwZOo
191193
- title: Google AdMob mediation
192194
permalink: https://developers.google.com/admob/flutter/mediation
193195
- title: Interactive Media Ads SDK

0 commit comments

Comments
 (0)