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
12f426f3
Unverified
Commit
12f426f3
authored
Jan 08, 2021
by
Alabhya
Committed by
GitHub
Jan 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Api docs]Added dartpad demo for Bottom App Bar (#73044)
parent
f364bcb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
170 additions
and
0 deletions
+170
-0
bottom_app_bar.dart
packages/flutter/lib/src/material/bottom_app_bar.dart
+170
-0
No files found.
packages/flutter/lib/src/material/bottom_app_bar.dart
View file @
12f426f3
...
...
@@ -33,6 +33,176 @@ import 'theme.dart';
/// ```
/// {@end-tool}
///
/// {@tool dartpad --template=freeform}
/// This example shows the [BottomAppBar], which can be configured to have a notch using the
/// [BottomAppBar.shape] property. This also includes an optional [FloatingActionButton], which illustrates
/// the [FloatingActionButtonLocation]s in relation to the [BottomAppBar].
/// ```dart imports
/// import 'package:flutter/material.dart';
/// ```
///
/// ```dart
/// void main() {
/// runApp(BottomAppBarDemo());
/// }
///
/// class BottomAppBarDemo extends StatefulWidget {
/// const BottomAppBarDemo();
///
/// @override
/// State createState() => _BottomAppBarDemoState();
/// }
///
/// class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
/// var _showFab = true;
/// var _showNotch = true;
/// var _fabLocation = FloatingActionButtonLocation.endDocked;
///
/// void _onShowNotchChanged(bool value) {
/// setState(() {
/// _showNotch = value;
/// });
/// }
///
/// void _onShowFabChanged(bool value) {
/// setState(() {
/// _showFab = value;
/// });
/// }
///
/// void _onFabLocationChanged(dynamic value) {
/// setState(() {
/// _fabLocation = value;
/// });
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return MaterialApp(
/// home: Scaffold(
/// appBar: AppBar(
/// automaticallyImplyLeading: false,
/// title: Text("Bottom App Bar Demo"),
/// ),
/// body: ListView(
/// padding: const EdgeInsets.only(bottom: 88),
/// children: [
/// SwitchListTile(
/// title: Text(
/// "Floating Action Button",
/// ),
/// value: _showFab,
/// onChanged: _onShowFabChanged,
/// ),
/// SwitchListTile(
/// title: Text("Notch"),
/// value: _showNotch,
/// onChanged: _onShowNotchChanged,
/// ),
/// Padding(
/// padding: const EdgeInsets.all(16),
/// child: Text("Floating action button position"),
/// ),
/// RadioListTile<FloatingActionButtonLocation>(
/// title: Text(
/// "Docked - End",
/// ),
/// value: FloatingActionButtonLocation.endDocked,
/// groupValue: _fabLocation,
/// onChanged: _onFabLocationChanged,
/// ),
/// RadioListTile<FloatingActionButtonLocation>(
/// title: Text(
/// "Docked - Center",
/// ),
/// value: FloatingActionButtonLocation.centerDocked,
/// groupValue: _fabLocation,
/// onChanged: _onFabLocationChanged,
/// ),
/// RadioListTile<FloatingActionButtonLocation>(
/// title: Text(
/// "Floating - End",
/// ),
/// value: FloatingActionButtonLocation.endFloat,
/// groupValue: _fabLocation,
/// onChanged: _onFabLocationChanged,
/// ),
/// RadioListTile<FloatingActionButtonLocation>(
/// title: Text(
/// "Floating - Center",
/// ),
/// value: FloatingActionButtonLocation.centerFloat,
/// groupValue: _fabLocation,
/// onChanged: _onFabLocationChanged,
/// ),
/// ],
/// ),
/// floatingActionButton: _showFab
/// ? FloatingActionButton(
/// onPressed: () {},
/// child: const Icon(Icons.add),
/// tooltip: "Create",
/// )
/// : null,
/// floatingActionButtonLocation: _fabLocation,
/// bottomNavigationBar: _DemoBottomAppBar(
/// fabLocation: _fabLocation,
/// shape: _showNotch ? const CircularNotchedRectangle() : null,
/// ),
/// ),
/// );
/// }
/// }
///
/// class _DemoBottomAppBar extends StatelessWidget {
/// const _DemoBottomAppBar({
/// this.fabLocation = FloatingActionButtonLocation.endDocked,
/// this.shape = const CircularNotchedRectangle(),
/// });
///
/// final FloatingActionButtonLocation fabLocation;
/// final dynamic shape;
///
/// static final centerLocations = <FloatingActionButtonLocation>[
/// FloatingActionButtonLocation.centerDocked,
/// FloatingActionButtonLocation.centerFloat,
/// ];
///
/// @override
/// Widget build(BuildContext context) {
/// return BottomAppBar(
/// shape: shape,
/// color: Colors.blue,
/// child: IconTheme(
/// data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
/// child: Row(
/// children: [
/// IconButton(
/// tooltip: 'Open navigation menu',
/// icon: const Icon(Icons.menu),
/// onPressed: () {},
/// ),
/// if (centerLocations.contains(fabLocation)) const Spacer(),
/// IconButton(
/// tooltip: "Search",
/// icon: const Icon(Icons.search),
/// onPressed: () {},
/// ),
/// IconButton(
/// tooltip: "Favorite",
/// icon: const Icon(Icons.favorite),
/// onPressed: () {},
/// ),
/// ],
/// ),
/// ),
/// );
/// }
/// }
///
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [NotchedShape] which calculates the notch for a notched [BottomAppBar].
...
...
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