forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Material 3 medium and large top app bars. (#103962)
* Add support for M3 AppBar 'Medium' and 'Large' types. * Updates from review feedback. * Updated from review feedback.
- Loading branch information
1 parent
7eed120
commit b08b88c
Showing
5 changed files
with
708 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Flutter code sample for SliverAppBar.medium | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
void main() { | ||
runApp(const AppBarMediumApp()); | ||
} | ||
|
||
class AppBarMediumApp extends StatelessWidget { | ||
const AppBarMediumApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
theme: ThemeData( | ||
useMaterial3: true, | ||
colorSchemeSeed: const Color(0xff6750A4) | ||
), | ||
home: Material( | ||
child: CustomScrollView( | ||
slivers: <Widget>[ | ||
SliverAppBar.medium( | ||
leading: IconButton(icon: const Icon(Icons.menu), onPressed: () {}), | ||
title: const Text('Medium App Bar'), | ||
actions: <Widget>[ | ||
IconButton(icon: const Icon(Icons.more_vert), onPressed: () {}), | ||
], | ||
), | ||
// Just some content big enough to have something to scroll. | ||
SliverToBoxAdapter( | ||
child: Card( | ||
child: SizedBox( | ||
height: 1200, | ||
child: Padding( | ||
padding: const EdgeInsets.fromLTRB(8, 100, 8, 100), | ||
child: Text( | ||
'Here be scrolling content...', | ||
style: Theme.of(context).textTheme.headlineSmall, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Flutter code sample for SliverAppBar.large | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
void main() { | ||
runApp(const AppBarLargeApp()); | ||
} | ||
|
||
class AppBarLargeApp extends StatelessWidget { | ||
const AppBarLargeApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
theme: ThemeData( | ||
useMaterial3: true, | ||
colorSchemeSeed: const Color(0xff6750A4) | ||
), | ||
home: Material( | ||
child: CustomScrollView( | ||
slivers: <Widget>[ | ||
SliverAppBar.large( | ||
leading: IconButton(icon: const Icon(Icons.menu), onPressed: () {}), | ||
title: const Text('Large App Bar'), | ||
actions: <Widget>[ | ||
IconButton(icon: const Icon(Icons.more_vert), onPressed: () {}), | ||
], | ||
), | ||
// Just some content big enough to have something to scroll. | ||
SliverToBoxAdapter( | ||
child: Card( | ||
child: SizedBox( | ||
height: 1200, | ||
child: Padding( | ||
padding: const EdgeInsets.fromLTRB(8, 100, 8, 100), | ||
child: Text( | ||
'Here be scrolling content...', | ||
style: Theme.of(context).textTheme.headlineSmall, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.