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
802ba9ac
Unverified
Commit
802ba9ac
authored
Jun 11, 2020
by
Ayush Bherwani
Committed by
GitHub
Jun 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds interactive example (#59251)
parent
222c2cb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
tab_controller.dart
packages/flutter/lib/src/material/tab_controller.dart
+53
-0
No files found.
packages/flutter/lib/src/material/tab_controller.dart
View file @
802ba9ac
...
...
@@ -85,6 +85,59 @@ import 'constants.dart';
/// }
/// ```
/// {@end-tool}
///
/// {@tool dartpad --template=stateless_widget_material}
///
/// This example shows how to listen to page updates in [TabBar] and [TabBarView]
/// when using [DefaultTabController].
///
/// ```dart preamble
/// final List<Tab> tabs = <Tab>[
/// Tab(text: 'Zeroth'),
/// Tab(text: 'First'),
/// Tab(text: 'Second'),
/// ];
/// ```
///
/// ```dart
/// Widget build(BuildContext context) {
/// return DefaultTabController(
/// length: tabs.length,
/// // The Builder widget is used to have a different BuildContext to access
/// // closest DefaultTabController.
/// child: Builder(
/// builder: (BuildContext context) {
/// final TabController tabController = DefaultTabController.of(context);
/// tabController.addListener(() {
/// if (!tabController.indexIsChanging) {
/// // Your code goes here.
/// // To get index of current tab use tabController.index
/// }
/// });
/// return Scaffold(
/// appBar: AppBar(
/// bottom: TabBar(
/// tabs: tabs,
/// ),
/// ),
/// body: TabBarView(
/// children: tabs.map((Tab tab){
/// return Center(
/// child: Text(
/// tab.text + ' Tab',
/// style: Theme.of(context).textTheme.headline5,
/// ),
/// );
/// }).toList(),
/// ),
/// );
/// }
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
class
TabController
extends
ChangeNotifier
{
/// Creates an object that manages the state required by [TabBar] and a
/// [TabBarView].
...
...
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