-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Reported in #120603 (comment)
code sample
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(useMaterial3: true),
home: const SliverAppBarExample(),
);
}
}
class SliverAppBarExample extends StatelessWidget {
const SliverAppBarExample({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('SliverAppBar Sample'),
),
body: Center(
child: FilledButton(
child: const Text('Go to SecondPage page'),
onPressed: () {
Navigator.of(context).push<void>(
MaterialPageRoute<void>(
builder: (BuildContext context) => const SecondPage(),
),
);
},
),
),
);
}
}
class SecondPage extends StatelessWidget {
const SecondPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
// SliverAppBar(
// title: const Text('Sliver App Bar'),
// centerTitle: false,
// actions: <Widget>[
// IconButton(icon: const Icon(Icons.favorite), onPressed: () {}),
// IconButton(icon: const Icon(Icons.favorite), onPressed: () {}),
// ],
// ),
SliverAppBar.medium(
title: const Text('Medium App Bar'),
centerTitle: false,
actions: <Widget>[
IconButton(icon: const Icon(Icons.favorite), onPressed: () {}),
IconButton(icon: const Icon(Icons.favorite), onPressed: () {}),
],
),
const SliverFillRemaining(
child: Center(
child: Text(
'Scroll down to collapse the app bar',
),
),
),
],
),
);
}
}
Preview
leighajarettMominRaza
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Type
Projects
Status
Done (PR merged)
