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
8eeef821
Unverified
Commit
8eeef821
authored
Dec 23, 2020
by
Sameer Kashyap
Committed by
GitHub
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Tabar Code samples (#70379)
parent
cc457596
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
1 deletion
+98
-1
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+98
-1
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
8eeef821
...
@@ -568,11 +568,108 @@ class _TabBarScrollController extends ScrollController {
...
@@ -568,11 +568,108 @@ class _TabBarScrollController extends ScrollController {
///
///
/// Uses values from [TabBarTheme] if it is set in the current context.
/// Uses values from [TabBarTheme] if it is set in the current context.
///
///
/// To see a sample implementation, visit the [TabController] documentation.
/// {@tool dartpad --template=stateless_widget_material}
/// This sample shows the implementation of [TabBar] and [TabBarView] using a [DefaultTabController].
/// Each [Tab] corresponds to a child of the [TabBarView] in the order they are written.
///
/// ```dart
/// Widget build(BuildContext context) {
/// return DefaultTabController(
/// initialIndex: 1,
/// length: 3,
/// child: Scaffold(
/// appBar: AppBar(
/// title: Text('TabBar Widget'),
/// bottom: TabBar(
/// tabs: <Widget>[
/// Tab(
/// icon: Icon(Icons.cloud_outlined),
/// ),
/// Tab(
/// icon: Icon(Icons.beach_access_sharp),
/// ),
/// Tab(
/// icon: Icon(Icons.brightness_5_sharp),
/// ),
/// ],
/// ),
/// ),
/// body: TabBarView(
/// children: <Widget>[
/// Center(
/// child: Text('It\'s cloudy here'),
/// ),
/// Center(
/// child: Text('It\'s rainy here'),
/// ),
/// Center(
/// child: Text('It\'s sunny here'),
/// ),
/// ],
/// ),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// {@tool dartpad --template=stateful_widget_material_ticker}
/// [TabBar] can also be implmented by using a [TabController] which provides more options
/// to control the behavior of the [TabBar] and [TabBarView]. This can be used instead of
/// a [DefaultTabController], demonstrated below.
///
/// ```dart
///
/// late TabController _tabController;
///
/// @override
/// void initState() {
/// super.initState();
/// _tabController = TabController(length: 3, vsync: this);
/// }
///
/// Widget build(BuildContext context) {
/// return Scaffold(
/// appBar: AppBar(
/// title: Text('TabBar Widget'),
/// bottom: TabBar(
/// controller: _tabController,
/// tabs: <Widget>[
/// Tab(
/// icon: Icon(Icons.cloud_outlined),
/// ),
/// Tab(
/// icon: Icon(Icons.beach_access_sharp),
/// ),
/// Tab(
/// icon: Icon(Icons.brightness_5_sharp),
/// ),
/// ],
/// ),
/// ),
/// body: TabBarView(
/// controller: _tabController,
/// children: <Widget>[
/// Center(
/// child: Text('It\'s cloudy here'),
/// ),
/// Center(
/// child: Text('It\'s rainy here'),
/// ),
/// Center(
/// child: Text('It\'s sunny here'),
/// ),
/// ],
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
///
/// See also:
/// See also:
///
///
/// * [TabBarView], which displays page views that correspond to each tab.
/// * [TabBarView], which displays page views that correspond to each tab.
/// * [TabBar], which is used to display the [Tab] that corresponds to each page of the [TabBarView].
class
TabBar
extends
StatefulWidget
implements
PreferredSizeWidget
{
class
TabBar
extends
StatefulWidget
implements
PreferredSizeWidget
{
/// Creates a material design tab bar.
/// Creates a material design tab bar.
///
///
...
...
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