mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 06:18:49 +00:00
Add options to tabs demo (#290)
This commit is contained in:
@@ -26159,7 +26159,7 @@ class CodeSegments {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TextSpan tabsDemo(BuildContext context) {
|
static TextSpan tabsNonScrollableDemo(BuildContext context) {
|
||||||
final CodeStyle codeStyle = CodeStyle.of(context);
|
final CodeStyle codeStyle = CodeStyle.of(context);
|
||||||
return TextSpan(children: [
|
return TextSpan(children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
@@ -26190,7 +26190,7 @@ class CodeSegments {
|
|||||||
TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'),
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'),
|
||||||
TextSpan(style: codeStyle.keywordStyle, text: 'class'),
|
TextSpan(style: codeStyle.keywordStyle, text: 'class'),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
TextSpan(style: codeStyle.classStyle, text: 'TabsDemo'),
|
TextSpan(style: codeStyle.classStyle, text: '_TabsNonScrollableDemo'),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
TextSpan(style: codeStyle.keywordStyle, text: 'extends'),
|
TextSpan(style: codeStyle.keywordStyle, text: 'extends'),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
@@ -26245,6 +26245,271 @@ class CodeSegments {
|
|||||||
TextSpan(style: codeStyle.baseStyle, text: 'colorsGreen'),
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsGreen'),
|
||||||
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '];'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'return'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'DefaultTabController'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a length'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' tabs'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'length'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'Scaffold'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'AppBar'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(
|
||||||
|
style: codeStyle.baseStyle,
|
||||||
|
text: '\u000a automaticallyImplyLeading'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'false'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a title'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'Text'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'demoTabsNonScrollingTitle'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a bottom'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'TabBar'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(
|
||||||
|
style: codeStyle.baseStyle, text: '\u000a isScrollable'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'false'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a tabs'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '['),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'for'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'final'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' tab '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'in'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' tabs'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ')'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'Tab'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'text'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' tab'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '],'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a body'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'TabBarView'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a children'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '['),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'for'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'final'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' tab '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'in'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' tabs'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ')'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'Center'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'Text'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'tab'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '],'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ');'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '}'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '}'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static TextSpan tabsScrollableDemo(BuildContext context) {
|
||||||
|
final CodeStyle codeStyle = CodeStyle.of(context);
|
||||||
|
return TextSpan(children: [
|
||||||
|
TextSpan(
|
||||||
|
style: codeStyle.commentStyle,
|
||||||
|
text: '// Copyright 2019 The Flutter team. All rights reserved.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a'),
|
||||||
|
TextSpan(
|
||||||
|
style: codeStyle.commentStyle,
|
||||||
|
text:
|
||||||
|
'// Use of this source code is governed by a BSD-style license that can be'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a'),
|
||||||
|
TextSpan(
|
||||||
|
style: codeStyle.commentStyle, text: '// found in the LICENSE file.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'import'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(
|
||||||
|
style: codeStyle.stringStyle,
|
||||||
|
text: '\u0027package:flutter/material.dart\u0027'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ';'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a'),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'import'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(
|
||||||
|
style: codeStyle.stringStyle,
|
||||||
|
text: '\u0027package:gallery/l10n/gallery_localizations.dart\u0027'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ';'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'class'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: '_TabsScrollableDemo'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: 'extends'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'StatelessWidget'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '{'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.keywordStyle, text: '@override'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'Widget'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' build'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'BuildContext'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ')'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '{'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'List'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '<'),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'String'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '>'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' tabs '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '='),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: ' '),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '['),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsRed'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsOrange'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsGreen'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsBlue'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsIndigo'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsPurple'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsRed'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsOrange'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: 'colorsGreen'),
|
||||||
|
TextSpan(style: codeStyle.punctuationStyle, text: ','),
|
||||||
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
|
||||||
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'),
|
||||||
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
TextSpan(style: codeStyle.baseStyle, text: 'of'),
|
||||||
@@ -26312,7 +26577,7 @@ class CodeSegments {
|
|||||||
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
TextSpan(style: codeStyle.punctuationStyle, text: '('),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
TextSpan(style: codeStyle.baseStyle, text: 'context'),
|
||||||
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: 'demoTabsTitle'),
|
TextSpan(style: codeStyle.baseStyle, text: 'demoTabsScrollingTitle'),
|
||||||
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
|
||||||
TextSpan(style: codeStyle.baseStyle, text: '\u000a bottom'),
|
TextSpan(style: codeStyle.baseStyle, text: '\u000a bottom'),
|
||||||
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
|
||||||
|
|||||||
@@ -524,11 +524,18 @@ List<GalleryDemo> materialDemos(BuildContext context) {
|
|||||||
subtitle: localizations.demoTabsSubtitle,
|
subtitle: localizations.demoTabsSubtitle,
|
||||||
configurations: [
|
configurations: [
|
||||||
GalleryDemoConfiguration(
|
GalleryDemoConfiguration(
|
||||||
title: localizations.demoTabsTitle,
|
title: localizations.demoTabsScrollingTitle,
|
||||||
description: localizations.demoTabsDescription,
|
description: localizations.demoTabsDescription,
|
||||||
documentationUrl: '$_docsBaseUrl/material/TabBarView-class.html',
|
documentationUrl: '$_docsBaseUrl/material/TabBar-class.html',
|
||||||
buildRoute: (context) => TabsDemo(),
|
buildRoute: (context) => TabsDemo(type: TabsDemoType.scrollable),
|
||||||
code: CodeSegments.tabsDemo,
|
code: CodeSegments.tabsScrollableDemo,
|
||||||
|
),
|
||||||
|
GalleryDemoConfiguration(
|
||||||
|
title: localizations.demoTabsNonScrollingTitle,
|
||||||
|
description: localizations.demoTabsDescription,
|
||||||
|
documentationUrl: '$_docsBaseUrl/material/TabBar-class.html',
|
||||||
|
buildRoute: (context) => TabsDemo(type: TabsDemoType.nonScrollable),
|
||||||
|
code: CodeSegments.tabsNonScrollableDemo,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,9 +5,33 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gallery/l10n/gallery_localizations.dart';
|
import 'package:gallery/l10n/gallery_localizations.dart';
|
||||||
|
|
||||||
// BEGIN tabsDemo
|
enum TabsDemoType {
|
||||||
|
scrollable,
|
||||||
|
nonScrollable,
|
||||||
|
}
|
||||||
|
|
||||||
class TabsDemo extends StatelessWidget {
|
class TabsDemo extends StatelessWidget {
|
||||||
|
const TabsDemo({Key key, this.type}) : super(key: key);
|
||||||
|
|
||||||
|
final TabsDemoType type;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Widget tabs;
|
||||||
|
switch (type) {
|
||||||
|
case TabsDemoType.scrollable:
|
||||||
|
tabs = _TabsScrollableDemo();
|
||||||
|
break;
|
||||||
|
case TabsDemoType.nonScrollable:
|
||||||
|
tabs = _TabsNonScrollableDemo();
|
||||||
|
}
|
||||||
|
return tabs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// BEGIN tabsScrollableDemo
|
||||||
|
|
||||||
|
class _TabsScrollableDemo extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List<String> tabs = [
|
List<String> tabs = [
|
||||||
@@ -17,6 +41,12 @@ class TabsDemo extends StatelessWidget {
|
|||||||
GalleryLocalizations.of(context).colorsBlue,
|
GalleryLocalizations.of(context).colorsBlue,
|
||||||
GalleryLocalizations.of(context).colorsIndigo,
|
GalleryLocalizations.of(context).colorsIndigo,
|
||||||
GalleryLocalizations.of(context).colorsPurple,
|
GalleryLocalizations.of(context).colorsPurple,
|
||||||
|
GalleryLocalizations.of(context).colorsRed,
|
||||||
|
GalleryLocalizations.of(context).colorsOrange,
|
||||||
|
GalleryLocalizations.of(context).colorsGreen,
|
||||||
|
GalleryLocalizations.of(context).colorsBlue,
|
||||||
|
GalleryLocalizations.of(context).colorsIndigo,
|
||||||
|
GalleryLocalizations.of(context).colorsPurple,
|
||||||
];
|
];
|
||||||
|
|
||||||
return DefaultTabController(
|
return DefaultTabController(
|
||||||
@@ -24,7 +54,7 @@ class TabsDemo extends StatelessWidget {
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: Text(GalleryLocalizations.of(context).demoTabsTitle),
|
title: Text(GalleryLocalizations.of(context).demoTabsScrollingTitle),
|
||||||
bottom: TabBar(
|
bottom: TabBar(
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
tabs: [
|
tabs: [
|
||||||
@@ -46,3 +76,43 @@ class TabsDemo extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// END
|
// END
|
||||||
|
|
||||||
|
// BEGIN tabsNonScrollableDemo
|
||||||
|
|
||||||
|
class _TabsNonScrollableDemo extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
List<String> tabs = [
|
||||||
|
GalleryLocalizations.of(context).colorsRed,
|
||||||
|
GalleryLocalizations.of(context).colorsOrange,
|
||||||
|
GalleryLocalizations.of(context).colorsGreen,
|
||||||
|
];
|
||||||
|
|
||||||
|
return DefaultTabController(
|
||||||
|
length: tabs.length,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
title:
|
||||||
|
Text(GalleryLocalizations.of(context).demoTabsNonScrollingTitle),
|
||||||
|
bottom: TabBar(
|
||||||
|
isScrollable: false,
|
||||||
|
tabs: [
|
||||||
|
for (final tab in tabs) Tab(text: tab),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: TabBarView(
|
||||||
|
children: [
|
||||||
|
for (final tab in tabs)
|
||||||
|
Center(
|
||||||
|
child: Text(tab),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// END
|
||||||
|
|||||||
@@ -2969,6 +2969,21 @@ class GalleryLocalizations {
|
|||||||
desc: r'Description for tabs demo.');
|
desc: r'Description for tabs demo.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get demoTabsNonScrollingTitle {
|
||||||
|
return Intl.message('Non-scrolling',
|
||||||
|
locale: _localeName,
|
||||||
|
name: 'demoTabsNonScrollingTitle',
|
||||||
|
desc:
|
||||||
|
r'Title for tabs demo with a tab bar that doesn' "'" r't scroll.');
|
||||||
|
}
|
||||||
|
|
||||||
|
String get demoTabsScrollingTitle {
|
||||||
|
return Intl.message('Scrolling',
|
||||||
|
locale: _localeName,
|
||||||
|
name: 'demoTabsScrollingTitle',
|
||||||
|
desc: r'Title for tabs demo with a tab bar that scrolls.');
|
||||||
|
}
|
||||||
|
|
||||||
String get demoTabsSubtitle {
|
String get demoTabsSubtitle {
|
||||||
return Intl.message('Tabs with independently scrollable views',
|
return Intl.message('Tabs with independently scrollable views',
|
||||||
locale: _localeName,
|
locale: _localeName,
|
||||||
|
|||||||
@@ -1390,6 +1390,14 @@
|
|||||||
"@demoTabsTitle": {
|
"@demoTabsTitle": {
|
||||||
"description": "Title for tabs demo."
|
"description": "Title for tabs demo."
|
||||||
},
|
},
|
||||||
|
"demoTabsScrollingTitle": "Scrolling",
|
||||||
|
"@demoTabsScrollingTitle": {
|
||||||
|
"description": "Title for tabs demo with a tab bar that scrolls."
|
||||||
|
},
|
||||||
|
"demoTabsNonScrollingTitle": "Non-scrolling",
|
||||||
|
"@demoTabsNonScrollingTitle": {
|
||||||
|
"description": "Title for tabs demo with a tab bar that doesn't scroll."
|
||||||
|
},
|
||||||
"demoTabsSubtitle": "Tabs with independently scrollable views",
|
"demoTabsSubtitle": "Tabs with independently scrollable views",
|
||||||
"@demoTabsSubtitle": {
|
"@demoTabsSubtitle": {
|
||||||
"description": "Subtitle for tabs demo."
|
"description": "Subtitle for tabs demo."
|
||||||
|
|||||||
@@ -1313,6 +1313,14 @@
|
|||||||
name="demoTabsTitle"
|
name="demoTabsTitle"
|
||||||
description="Title for tabs demo."
|
description="Title for tabs demo."
|
||||||
>Tabs</string>
|
>Tabs</string>
|
||||||
|
<string
|
||||||
|
name="demoTabsScrollingTitle"
|
||||||
|
description="Title for tabs demo with a tab bar that scrolls."
|
||||||
|
>Scrolling</string>
|
||||||
|
<string
|
||||||
|
name="demoTabsNonScrollingTitle"
|
||||||
|
description="Title for tabs demo with a tab bar that doesn't scroll."
|
||||||
|
>Non-scrolling</string>
|
||||||
<string
|
<string
|
||||||
name="demoTabsSubtitle"
|
name="demoTabsSubtitle"
|
||||||
description="Subtitle for tabs demo."
|
description="Subtitle for tabs demo."
|
||||||
|
|||||||
@@ -775,6 +775,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"demoSnackbarsTitle": MessageLookupByLibrary.simpleMessage("Snackbars"),
|
"demoSnackbarsTitle": MessageLookupByLibrary.simpleMessage("Snackbars"),
|
||||||
"demoTabsDescription": MessageLookupByLibrary.simpleMessage(
|
"demoTabsDescription": MessageLookupByLibrary.simpleMessage(
|
||||||
"Tabs organize content across different screens, data sets, and other interactions."),
|
"Tabs organize content across different screens, data sets, and other interactions."),
|
||||||
|
"demoTabsNonScrollingTitle":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Non-scrolling"),
|
||||||
|
"demoTabsScrollingTitle":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Scrolling"),
|
||||||
"demoTabsSubtitle": MessageLookupByLibrary.simpleMessage(
|
"demoTabsSubtitle": MessageLookupByLibrary.simpleMessage(
|
||||||
"Tabs with independently scrollable views"),
|
"Tabs with independently scrollable views"),
|
||||||
"demoTabsTitle": MessageLookupByLibrary.simpleMessage("Tabs"),
|
"demoTabsTitle": MessageLookupByLibrary.simpleMessage("Tabs"),
|
||||||
|
|||||||
Reference in New Issue
Block a user