Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
8182c1a5
Unverified
Commit
8182c1a5
authored
Dec 11, 2020
by
Alabhya
Committed by
GitHub
Dec 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dartpad examples for SliverAppBar (#69781)
parent
ff05ca25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+112
-0
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
8182c1a5
...
...
@@ -1262,6 +1262,118 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
/// ```
/// {@end-tool}
///
/// {@tool dartpad --template=freeform}
///
/// This sample shows a [SliverAppBar] and it's behaviors when using the [pinned], [snap] and [floating] parameters.
///
/// ```dart imports
/// import 'package:flutter/material.dart';
/// ```
///
/// ```dart
/// void main() => runApp(MyApp());
///
/// class MyApp extends StatefulWidget {
/// const MyApp({Key key}) : super(key: key);
///
/// @override
/// State<StatefulWidget> createState() => _MyAppState();
/// }
///
/// class _MyAppState extends State<MyApp> {
/// bool _pinned = true;
/// bool _snap = false;
/// bool _floating = false;
///
/// // SliverAppBar is declared in Scaffold.body, in slivers of a
/// // CustomScrollView.
/// @override
/// Widget build(BuildContext context) {
/// return MaterialApp(
/// home: Scaffold(
/// body: CustomScrollView(
/// slivers: <Widget>[
/// SliverAppBar(
/// pinned: this._pinned,
/// snap: this._snap,
/// floating: this._floating,
/// expandedHeight: 160.0,
/// flexibleSpace: FlexibleSpaceBar(
/// title: const Text("SliverAppBar"),
/// background: FlutterLogo(),
/// ),
/// ),
/// SliverToBoxAdapter(
/// child: Center(
/// child: Container(
/// height: 2000,
/// child: const Text("Scroll to see SliverAppBar in effect ."),
/// ),
/// ),
/// ),
/// ],
/// ),
/// bottomNavigationBar: BottomAppBar(
/// child: ButtonBar(
/// alignment: MainAxisAlignment.spaceEvenly,
/// children: <Widget>[
/// Row(
/// children: <Widget>[
/// const Text('pinned'),
/// Switch(
/// onChanged: (bool val) {
/// setState(() {
/// this._pinned = val;
/// });
/// },
/// value: this._pinned,
/// ),
/// ],
/// ),
/// Row(
/// children: <Widget>[
/// const Text('snap'),
/// Switch(
/// onChanged: (bool val) {
/// setState(() {
/// this._snap = val;
/// //Snapping only applies when the app bar is floating.
/// this._floating = this._floating || val;
/// });
/// },
/// value: this._snap,
/// ),
/// ],
/// ),
/// Row(
/// children: <Widget>[
/// const Text('floating'),
/// Switch(
/// onChanged: (bool val) {
/// setState(() {
/// this._floating = val;
/// if (this._snap == true) {
/// if (this._floating != true) {
/// this._snap = false;
/// }
/// }
/// });
/// },
/// value: this._floating,
/// ),
/// ],
/// ),
/// ],
/// ),
/// ),
/// ),
/// );
/// }
/// }
///
/// ```
/// {@end-tool}
///
/// ## Animated Examples
///
/// The following animations show how app bars with different configurations
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment