diff --git a/gallery/gallery/lib/codeviewer/code_segments.dart b/gallery/gallery/lib/codeviewer/code_segments.dart index 5fb6b04be..fc29dfbad 100644 --- a/gallery/gallery/lib/codeviewer/code_segments.dart +++ b/gallery/gallery/lib/codeviewer/code_segments.dart @@ -478,7 +478,7 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'), TextSpan(style: codeStyle.keywordStyle, text: 'class'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'CupertinoNavigationDemo'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoTabBarDemo'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'extends'), TextSpan(style: codeStyle.baseStyle, text: ' '), @@ -501,9 +501,7 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: '<'), - TextSpan(style: codeStyle.classStyle, text: '_TabInfo'), - TextSpan(style: codeStyle.punctuationStyle, text: '>['), + TextSpan(style: codeStyle.punctuationStyle, text: '['), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: '_TabInfo'), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -514,7 +512,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ').'), - TextSpan(style: codeStyle.baseStyle, text: 'cupertinoNavigationHomeTab'), + TextSpan(style: codeStyle.baseStyle, text: 'cupertinoTabBarHomeTab'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'CupertinoIcons'), @@ -533,7 +531,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ').'), - TextSpan(style: codeStyle.baseStyle, text: 'cupertinoNavigationChatTab'), + TextSpan(style: codeStyle.baseStyle, text: 'cupertinoTabBarChatTab'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'CupertinoIcons'), @@ -552,8 +550,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ').'), - TextSpan( - style: codeStyle.baseStyle, text: 'cupertinoNavigationProfileTab'), + TextSpan(style: codeStyle.baseStyle, text: 'cupertinoTabBarProfileTab'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'CupertinoIcons'), @@ -643,25 +640,11 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'switch'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: 'index'), - 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: 'case'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.numberStyle, text: '0'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'CupertinoTabView'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a builder'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -672,164 +655,584 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: '_CupertinoDemoTab'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a title'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.baseStyle, text: 'index'), TextSpan(style: codeStyle.punctuationStyle, text: '].'), TextSpan(style: codeStyle.baseStyle, text: 'title'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a icon'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.baseStyle, text: 'index'), TextSpan(style: codeStyle.punctuationStyle, text: '].'), TextSpan(style: codeStyle.baseStyle, text: 'icon'), 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 defaultTitle'), + style: codeStyle.baseStyle, text: '\u000a defaultTitle'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.baseStyle, text: 'index'), TextSpan(style: codeStyle.punctuationStyle, text: '].'), TextSpan(style: codeStyle.baseStyle, text: 'title'), 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 '), - TextSpan(style: codeStyle.keywordStyle, text: 'break'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'case'), + 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'), + TextSpan(style: codeStyle.keywordStyle, text: 'class'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: '_CupertinoDemoTab'), + 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: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: '_CupertinoDemoTab'), + TextSpan(style: codeStyle.punctuationStyle, text: '({'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Key'), + TextSpan(style: codeStyle.baseStyle, text: ' key'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@required'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'this'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'title'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@required'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'this'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'icon'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '})'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.numberStyle, text: '1'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'super'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'key'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' key'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' title'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'IconData'), + TextSpan(style: codeStyle.baseStyle, text: ' icon'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\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.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'CupertinoTabView'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoPageScaffold'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a navigationBar'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoNavigationBar'), + TextSpan(style: codeStyle.punctuationStyle, text: '(),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a backgroundColor'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoColors'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'systemBackground'), + 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: '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: 'Icon'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a builder'), + style: codeStyle.baseStyle, text: '\u000a semanticLabel'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' title'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a size'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '100'), + 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 cupertinoSliderDemo(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/cupertino.dart\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\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: 'CupertinoSliderDemo'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'extends'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'StatefulWidget'), + 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: '_CupertinoSliderDemoState'), + TextSpan(style: codeStyle.baseStyle, text: ' createState'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: '_CupertinoSliderDemoState'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + 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: '_CupertinoSliderDemoState'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'extends'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'State'), + TextSpan(style: codeStyle.punctuationStyle, text: '<'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoSliderDemo'), + 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: 'double'), + TextSpan(style: codeStyle.baseStyle, text: ' _value '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '25.0'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'double'), + TextSpan(style: codeStyle.baseStyle, text: ' _discreteValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '20.0'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\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.baseStyle, text: 'context'), + 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.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: '_CupertinoDemoTab'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoPageScaffold'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a navigationBar'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoNavigationBar'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a middle'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + 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: 'demoCupertinoSliderTitle'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + 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: 'DefaultTextStyle'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a style'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoTheme'), + 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: 'textTheme'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'textStyle'), + 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: '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: 'Column'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( - style: codeStyle.baseStyle, text: '\u000a title'), + style: codeStyle.baseStyle, + text: '\u000a mainAxisAlignment'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'MainAxisAlignment'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'spaceEvenly'), + 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.numberStyle, text: '1'), - TextSpan(style: codeStyle.punctuationStyle, text: '].'), - TextSpan(style: codeStyle.baseStyle, text: 'title'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Column'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a mainAxisSize'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'MainAxisSize'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'min'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a icon'), + style: codeStyle.baseStyle, text: '\u000a children'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.numberStyle, text: '1'), - TextSpan(style: codeStyle.punctuationStyle, text: '].'), - TextSpan(style: codeStyle.baseStyle, text: 'icon'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'SizedBox'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a width'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'double'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'infinity'), 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: 'CupertinoSlider'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a value'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _value'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a min'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '0.0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a max'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '100.0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a onChanged'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a setState'), + TextSpan(style: codeStyle.punctuationStyle, text: '(()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _value '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' value'), + 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.classStyle, text: 'MergeSemantics'), + 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: '\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: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan( + style: codeStyle.baseStyle, text: 'demoCupertinoSliderContinuous'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _value'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'toStringAsFixed'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '1'), + 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.classStyle, text: 'Column'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a defaultTitle'), + text: '\u000a mainAxisSize'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'MainAxisSize'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'min'), + 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.numberStyle, text: '1'), - TextSpan(style: codeStyle.punctuationStyle, text: '].'), - TextSpan(style: codeStyle.baseStyle, text: 'title'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'SizedBox'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a width'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'double'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'infinity'), 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.keywordStyle, text: 'break'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'case'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.numberStyle, text: '2'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoSlider'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a value'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _discreteValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a min'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'CupertinoTabView'), + TextSpan(style: codeStyle.numberStyle, text: '0.0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a max'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '100.0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a divisions'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '5'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a onChanged'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a setState'), + TextSpan(style: codeStyle.punctuationStyle, text: '(()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _discreteValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' value'), + 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.classStyle, text: 'MergeSemantics'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( - style: codeStyle.baseStyle, text: '\u000a builder'), + 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: '\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: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: '=>'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: '_CupertinoDemoTab'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( - style: codeStyle.baseStyle, text: '\u000a title'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), - TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.numberStyle, text: '2'), - TextSpan(style: codeStyle.punctuationStyle, text: '].'), - TextSpan(style: codeStyle.baseStyle, text: 'title'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), + style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'demoCupertinoSliderDiscrete'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( - style: codeStyle.baseStyle, text: '\u000a icon'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), - TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.numberStyle, text: '2'), - TextSpan(style: codeStyle.punctuationStyle, text: '].'), - TextSpan(style: codeStyle.baseStyle, text: 'icon'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, + text: '\u000a _discreteValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'toStringAsFixed'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '1'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan( - style: codeStyle.baseStyle, - text: '\u000a defaultTitle'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _tabInfo'), - TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.numberStyle, text: '2'), - TextSpan(style: codeStyle.punctuationStyle, text: '].'), - TextSpan(style: codeStyle.baseStyle, text: 'title'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: ');'), + 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.keywordStyle, text: 'break'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '}'), + 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.keywordStyle, text: 'return'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'null'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -839,60 +1242,79 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a'), TextSpan(style: codeStyle.punctuationStyle, text: '}'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'), + ]); + } + + static TextSpan cupertinoSwitchDemo(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/cupertino.dart\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\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: '_CupertinoDemoTab'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoSwitchDemo'), 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.classStyle, text: 'StatefulWidget'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: '_CupertinoSwitchDemoState'), + TextSpan(style: codeStyle.baseStyle, text: ' createState'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: '_CupertinoDemoTab'), - TextSpan(style: codeStyle.punctuationStyle, text: '({'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'Key'), - TextSpan(style: codeStyle.baseStyle, text: ' key'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: '@required'), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'this'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'title'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: '@required'), + TextSpan(style: codeStyle.classStyle, text: '_CupertinoSwitchDemoState'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + 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.keywordStyle, text: 'this'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'icon'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '})'), + TextSpan(style: codeStyle.classStyle, text: '_CupertinoSwitchDemoState'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.keywordStyle, text: 'extends'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'super'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: 'key'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' key'), - TextSpan(style: codeStyle.punctuationStyle, text: ');'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.classStyle, text: 'State'), + TextSpan(style: codeStyle.punctuationStyle, text: '<'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoSwitchDemo'), + TextSpan(style: codeStyle.punctuationStyle, text: '>'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'String'), - TextSpan(style: codeStyle.baseStyle, text: ' title'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' _switchValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'IconData'), - TextSpan(style: codeStyle.baseStyle, text: ' icon'), + TextSpan(style: codeStyle.keywordStyle, text: 'false'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), @@ -914,14 +1336,26 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'CupertinoNavigationBar'), - TextSpan(style: codeStyle.punctuationStyle, text: '(),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a backgroundColor'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a middle'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'CupertinoColors'), + TextSpan(style: codeStyle.classStyle, text: '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: 'systemBackground'), + 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: 'demoSelectionControlsSwitchTitle'), 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 child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), @@ -930,20 +1364,59 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'Icon'), + TextSpan(style: codeStyle.classStyle, text: 'Semantics'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a container'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'true'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a semanticLabel'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a label'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' title'), + 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: 'demoSelectionControlsSwitchTitle'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a size'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.numberStyle, text: '100'), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoSwitch'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a value'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _switchValue'), TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a onChanged'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a setState'), + TextSpan(style: codeStyle.punctuationStyle, text: '(()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _switchValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' value'), + 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 '), @@ -3420,13 +3893,35 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Semantics'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a container'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'true'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a label'), + 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: 'demoSelectionControlsSwitchTitle'), + 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: 'Switch'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a value'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a value'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' switchValue'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a onChanged'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a onChanged'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -3434,19 +3929,21 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a setState'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a setState'), TextSpan(style: codeStyle.punctuationStyle, text: '(()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a switchValue '), + style: codeStyle.baseStyle, text: '\u000a switchValue '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' value'), 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 '), + 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 '), diff --git a/gallery/gallery/lib/data/demos.dart b/gallery/gallery/lib/data/demos.dart index 9e7c068ca..73503f9cc 100644 --- a/gallery/gallery/lib/data/demos.dart +++ b/gallery/gallery/lib/data/demos.dart @@ -10,8 +10,10 @@ import 'package:gallery/data/gallery_options.dart'; import 'package:gallery/data/icons.dart'; import 'package:gallery/demos/cupertino/cupertino_alert_demo.dart'; import 'package:gallery/demos/cupertino/cupertino_button_demo.dart'; -import 'package:gallery/demos/cupertino/cupertino_tab_bar_demo.dart'; import 'package:gallery/demos/cupertino/cupertino_segmented_control_demo.dart'; +import 'package:gallery/demos/cupertino/cupertino_slider_demo.dart'; +import 'package:gallery/demos/cupertino/cupertino_switch_demo.dart'; +import 'package:gallery/demos/cupertino/cupertino_tab_bar_demo.dart'; import 'package:gallery/demos/material/bottom_navigation_demo.dart'; import 'package:gallery/demos/material/bottom_sheet_demo.dart'; import 'package:gallery/demos/material/button_demo.dart'; @@ -467,6 +469,39 @@ List cupertinoDemos(BuildContext context) { ), ], ), + GalleryDemo( + title: GalleryLocalizations.of(context).demoCupertinoSliderTitle, + icon: GalleryIcons.sliders, + subtitle: GalleryLocalizations.of(context).demoCupertinoSliderSubtitle, + configurations: [ + GalleryDemoConfiguration( + title: GalleryLocalizations.of(context).demoCupertinoSliderTitle, + description: + GalleryLocalizations.of(context).demoCupertinoSliderDescription, + documentationUrl: + 'https://api.flutter.dev/flutter/cupertino/CupertinoSlider-class.html', + buildRoute: (_) => CupertinoSliderDemo(), + code: CodeSegments.cupertinoSliderDemo, + ), + ], + ), + GalleryDemo( + title: GalleryLocalizations.of(context).demoSelectionControlsSwitchTitle, + icon: GalleryIcons.switches, + subtitle: GalleryLocalizations.of(context).demoCupertinoSwitchSubtitle, + configurations: [ + GalleryDemoConfiguration( + title: + GalleryLocalizations.of(context).demoSelectionControlsSwitchTitle, + description: + GalleryLocalizations.of(context).demoCupertinoSwitchDescription, + documentationUrl: + 'https://api.flutter.dev/flutter/cupertino/CupertinoSwitch-class.html', + buildRoute: (_) => CupertinoSwitchDemo(), + code: CodeSegments.cupertinoSwitchDemo, + ), + ], + ), GalleryDemo( title: GalleryLocalizations.of(context).demoCupertinoTabBarTitle, icon: GalleryIcons.bottomNavigation, diff --git a/gallery/gallery/lib/demos/cupertino/cupertino_slider_demo.dart b/gallery/gallery/lib/demos/cupertino/cupertino_slider_demo.dart new file mode 100644 index 000000000..d4c7f8fa0 --- /dev/null +++ b/gallery/gallery/lib/demos/cupertino/cupertino_slider_demo.dart @@ -0,0 +1,93 @@ +// Copyright 2019 The Flutter team. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/cupertino.dart'; + +import 'package:gallery/l10n/gallery_localizations.dart'; + +// BEGIN cupertinoSliderDemo + +class CupertinoSliderDemo extends StatefulWidget { + @override + _CupertinoSliderDemoState createState() => _CupertinoSliderDemoState(); +} + +class _CupertinoSliderDemoState extends State { + double _value = 25.0; + double _discreteValue = 20.0; + + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text(GalleryLocalizations.of(context).demoCupertinoSliderTitle), + ), + child: DefaultTextStyle( + style: CupertinoTheme.of(context).textTheme.textStyle, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: double.infinity, + child: CupertinoSlider( + value: _value, + min: 0.0, + max: 100.0, + onChanged: (value) { + setState(() { + _value = value; + }); + }, + ), + ), + MergeSemantics( + child: Text( + GalleryLocalizations.of(context) + .demoCupertinoSliderContinuous( + _value.toStringAsFixed(1), + ), + ), + ), + ], + ), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: double.infinity, + child: CupertinoSlider( + value: _discreteValue, + min: 0.0, + max: 100.0, + divisions: 5, + onChanged: (value) { + setState(() { + _discreteValue = value; + }); + }, + ), + ), + MergeSemantics( + child: Text( + GalleryLocalizations.of(context) + .demoCupertinoSliderDiscrete( + _discreteValue.toStringAsFixed(1), + ), + ), + ), + ], + ), + ], + ), + ), + ), + ); + } +} + +// END diff --git a/gallery/gallery/lib/demos/cupertino/cupertino_switch_demo.dart b/gallery/gallery/lib/demos/cupertino/cupertino_switch_demo.dart new file mode 100644 index 000000000..4238f9e81 --- /dev/null +++ b/gallery/gallery/lib/demos/cupertino/cupertino_switch_demo.dart @@ -0,0 +1,46 @@ +// Copyright 2019 The Flutter team. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/cupertino.dart'; + +import 'package:gallery/l10n/gallery_localizations.dart'; + +// BEGIN cupertinoSwitchDemo + +class CupertinoSwitchDemo extends StatefulWidget { + @override + _CupertinoSwitchDemoState createState() => _CupertinoSwitchDemoState(); +} + +class _CupertinoSwitchDemoState extends State { + bool _switchValue = false; + + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text( + GalleryLocalizations.of(context).demoSelectionControlsSwitchTitle, + ), + ), + child: Center( + child: Semantics( + container: true, + label: + GalleryLocalizations.of(context).demoSelectionControlsSwitchTitle, + child: CupertinoSwitch( + value: _switchValue, + onChanged: (value) { + setState(() { + _switchValue = value; + }); + }, + ), + ), + ), + ); + } +} + +// END diff --git a/gallery/gallery/lib/demos/material/selection_controls_demo.dart b/gallery/gallery/lib/demos/material/selection_controls_demo.dart index c2608ecce..fc1d07408 100644 --- a/gallery/gallery/lib/demos/material/selection_controls_demo.dart +++ b/gallery/gallery/lib/demos/material/selection_controls_demo.dart @@ -155,13 +155,18 @@ class _SwitchDemoState extends State<_SwitchDemo> { @override Widget build(BuildContext context) { return Center( - child: Switch( - value: switchValue, - onChanged: (value) { - setState(() { - switchValue = value; - }); - }, + child: Semantics( + container: true, + label: + GalleryLocalizations.of(context).demoSelectionControlsSwitchTitle, + child: Switch( + value: switchValue, + onChanged: (value) { + setState(() { + switchValue = value; + }); + }, + ), ), ); } diff --git a/gallery/gallery/lib/l10n/gallery_localizations.dart b/gallery/gallery/lib/l10n/gallery_localizations.dart index 01b1e91a6..7ce048528 100644 --- a/gallery/gallery/lib/l10n/gallery_localizations.dart +++ b/gallery/gallery/lib/l10n/gallery_localizations.dart @@ -1560,6 +1560,61 @@ class GalleryLocalizations { desc: r'Title for the cupertino segmented control component demo.'); } + String demoCupertinoSliderContinuous(Object value) { + return Intl.message(r'Continuous: $value', + locale: _localeName, + name: 'demoCupertinoSliderContinuous', + desc: + r'A label for a continuous slider that indicates what value it is set to.', + args: [value]); + } + + String get demoCupertinoSliderDescription { + return Intl.message( + r'A slider can be used to select from either a continuous or a discrete set of values.', + locale: _localeName, + name: 'demoCupertinoSliderDescription', + desc: r'Description for the cupertino slider component demo.'); + } + + String demoCupertinoSliderDiscrete(Object value) { + return Intl.message(r'Discrete: $value', + locale: _localeName, + name: 'demoCupertinoSliderDiscrete', + desc: + r'A label for a discrete slider that indicates what value it is set to.', + args: [value]); + } + + String get demoCupertinoSliderSubtitle { + return Intl.message(r'iOS-style slider', + locale: _localeName, + name: 'demoCupertinoSliderSubtitle', + desc: r'Subtitle for the cupertino slider component demo.'); + } + + String get demoCupertinoSliderTitle { + return Intl.message(r'Slider', + locale: _localeName, + name: 'demoCupertinoSliderTitle', + desc: r'Title for the cupertino slider component demo.'); + } + + String get demoCupertinoSwitchDescription { + return Intl.message( + r'A switch is used to toggle the on/off state of a single setting.', + locale: _localeName, + name: 'demoCupertinoSwitchDescription', + desc: r'Description for the cupertino switch component demo.'); + } + + String get demoCupertinoSwitchSubtitle { + return Intl.message(r'iOS-style switch', + locale: _localeName, + name: 'demoCupertinoSwitchSubtitle', + desc: r'Subtitle for the cupertino switch component demo.'); + } + String get demoCupertinoTabBarDescription { return Intl.message( r'An iOS-style bottom navigation tab bar. Displays multiple tabs with one tab being active, the first tab by default.', diff --git a/gallery/gallery/lib/l10n/intl_en_US.arb b/gallery/gallery/lib/l10n/intl_en_US.arb index 1e7dc39ff..e540c2e40 100644 --- a/gallery/gallery/lib/l10n/intl_en_US.arb +++ b/gallery/gallery/lib/l10n/intl_en_US.arb @@ -645,6 +645,44 @@ "@demoCupertinoSegmentedControlDescription": { "description": "Description for the cupertino segmented control component demo." }, + "demoCupertinoSliderTitle": "Slider", + "@demoCupertinoSliderTitle": { + "description": "Title for the cupertino slider component demo." + }, + "demoCupertinoSliderSubtitle": "iOS-style slider", + "@demoCupertinoSliderSubtitle": { + "description": "Subtitle for the cupertino slider component demo." + }, + "demoCupertinoSliderDescription": "A slider can be used to select from either a continuous or a discrete set of values.", + "@demoCupertinoSliderDescription": { + "description": "Description for the cupertino slider component demo." + }, + "demoCupertinoSliderContinuous": "Continuous: {value}", + "@demoCupertinoSliderContinuous": { + "description": "A label for a continuous slider that indicates what value it is set to.", + "placeholders": { + "value": { + "example": "1" + } + } + }, + "demoCupertinoSliderDiscrete": "Discrete: {value}", + "@demoCupertinoSliderDiscrete": { + "description": "A label for a discrete slider that indicates what value it is set to.", + "placeholders": { + "value": { + "example": "1" + } + } + }, + "demoCupertinoSwitchSubtitle": "iOS-style switch", + "@demoCupertinoSwitchSubtitle": { + "description": "Subtitle for the cupertino switch component demo." + }, + "demoCupertinoSwitchDescription": "A switch is used to toggle the on/off state of a single setting.", + "@demoCupertinoSwitchDescription": { + "description": "Description for the cupertino switch component demo." + }, "demoCupertinoTabBarTitle": "Tab Bar", "@demoCupertinoTabBarTitle": { "description": "Title for the cupertino bottom tab bar demo." diff --git a/gallery/gallery/lib/l10n/intl_en_US.xml b/gallery/gallery/lib/l10n/intl_en_US.xml index 7ed170da1..c5158ddff 100644 --- a/gallery/gallery/lib/l10n/intl_en_US.xml +++ b/gallery/gallery/lib/l10n/intl_en_US.xml @@ -609,6 +609,34 @@ name="demoCupertinoSegmentedControlDescription" description="Description for the cupertino segmented control component demo." >Used to select between a number of mutually exclusive options. When one option in the segmented control is selected, the other options in the segmented control cease to be selected. + Slider + iOS-style slider + A slider can be used to select from either a continuous or a discrete set of values. + Continuous: {value} + Discrete: {value} + iOS-style switch + A switch is used to toggle the on/off state of a single setting. "Failed to copy to clipboard: ${error}"; + static m23(value) => "Continuous: ${value}"; + + static m24(value) => "Discrete: ${value}"; + static m7(name, phoneNumber) => "${name} phone number is ${phoneNumber}"; static m8(value) => "You selected: \"${value}\""; @@ -400,6 +404,18 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("iOS-style segmented control"), "demoCupertinoSegmentedControlTitle": MessageLookupByLibrary.simpleMessage("Segmented Control"), + "demoCupertinoSliderContinuous": m23, + "demoCupertinoSliderDescription": MessageLookupByLibrary.simpleMessage( + "A slider can be used to select from either a continuous or a discrete set of values."), + "demoCupertinoSliderDiscrete": m24, + "demoCupertinoSliderSubtitle": + MessageLookupByLibrary.simpleMessage("iOS-style slider"), + "demoCupertinoSliderTitle": + MessageLookupByLibrary.simpleMessage("Slider"), + "demoCupertinoSwitchDescription": MessageLookupByLibrary.simpleMessage( + "A switch is used to toggle the on/off state of a single setting."), + "demoCupertinoSwitchSubtitle": + MessageLookupByLibrary.simpleMessage("iOS-style switch"), "demoCupertinoTabBarDescription": MessageLookupByLibrary.simpleMessage( "An iOS-style bottom navigation tab bar. Displays multiple tabs with one tab being active, the first tab by default."), "demoCupertinoTabBarSubtitle":