From 8d4c30a782fa6306a2dc196b03153ea0610ee617 Mon Sep 17 00:00:00 2001 From: rami-a <2364772+rami-a@users.noreply.github.com> Date: Thu, 2 Jan 2020 15:16:08 -0500 Subject: [PATCH] [Gallery] Implement material progress indicator and cupertino activity indicator demos (#200) --- .../gallery/lib/codeviewer/code_segments.dart | 655 ++++++++++++++++++ gallery/gallery/lib/data/demos.dart | 54 +- .../cupertino_activity_indicator_demo.dart | 26 + .../material/progress_indicator_demo.dart | 113 +++ .../lib/l10n/gallery_localizations.dart | 67 ++ gallery/gallery/lib/l10n/intl_en_US.arb | 36 + gallery/gallery/lib/l10n/intl_en_US.xml | 36 + gallery/gallery/lib/l10n/messages_en_US.dart | 22 + .../lib/themes/material_demo_theme_data.dart | 2 + 9 files changed, 1010 insertions(+), 1 deletion(-) create mode 100644 gallery/gallery/lib/demos/cupertino/cupertino_activity_indicator_demo.dart create mode 100644 gallery/gallery/lib/demos/material/progress_indicator_demo.dart diff --git a/gallery/gallery/lib/codeviewer/code_segments.dart b/gallery/gallery/lib/codeviewer/code_segments.dart index e6177c41e..bd63cee7c 100644 --- a/gallery/gallery/lib/codeviewer/code_segments.dart +++ b/gallery/gallery/lib/codeviewer/code_segments.dart @@ -814,6 +814,110 @@ class CodeSegments { ]); } + static TextSpan cupertinoActivityIndicatorDemo(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'), + 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: 'CupertinoProgressIndicatorDemo'), + 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.keywordStyle, text: 'return'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + 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.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: 'demoCupertinoActivityIndicatorTitle'), + 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: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + 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: 'CupertinoActivityIndicator'), + 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: [ @@ -9587,6 +9691,557 @@ class CodeSegments { ]); } + static TextSpan progressIndicatorsDemo(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: 'enum'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'ProgressIndicatorDemoType'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a circular'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a linear'), + 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: 'ProgressIndicatorDemo'), + 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: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'ProgressIndicatorDemo'), + TextSpan(style: codeStyle.punctuationStyle, text: '({'), + TextSpan(style: codeStyle.classStyle, text: 'Key'), + TextSpan(style: codeStyle.baseStyle, text: ' key'), + 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: 'type'), + TextSpan(style: codeStyle.punctuationStyle, text: '})'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + 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: 'ProgressIndicatorDemoType'), + TextSpan(style: codeStyle.baseStyle, text: ' type'), + 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: '_ProgressIndicatorDemoState'), + 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: '_ProgressIndicatorDemoState'), + 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: '_ProgressIndicatorDemoState'), + 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: 'ProgressIndicatorDemo'), + TextSpan(style: codeStyle.punctuationStyle, text: '>'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.classStyle, text: 'SingleTickerProviderStateMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'AnimationController'), + TextSpan(style: codeStyle.baseStyle, text: ' _controller'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Animation'), + TextSpan(style: codeStyle.punctuationStyle, text: '<'), + TextSpan(style: codeStyle.keywordStyle, text: 'double'), + TextSpan(style: codeStyle.punctuationStyle, text: '>'), + TextSpan(style: codeStyle.baseStyle, text: ' _animation'), + 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.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' initState'), + 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: 'super'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'initState'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _controller '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'AnimationController'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a duration'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Duration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'milliseconds'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '1500'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a vsync'), + 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: '\u000a animationBehavior'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'AnimationBehavior'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'preserve'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: ')..'), + TextSpan(style: codeStyle.baseStyle, text: 'forward'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a _animation '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CurvedAnimation'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a parent'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _controller'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a curve'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Interval'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '0.0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '0.9'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' curve'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Curves'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'fastOutSlowIn'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a reverseCurve'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Curves'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'fastOutSlowIn'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: ')..'), + TextSpan(style: codeStyle.baseStyle, text: 'addStatusListener'), + TextSpan(style: codeStyle.punctuationStyle, text: '(('), + TextSpan(style: codeStyle.baseStyle, text: 'status'), + 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: 'if'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'status '), + TextSpan(style: codeStyle.punctuationStyle, text: '=='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'AnimationStatus'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'dismissed'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _controller'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'forward'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'else'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'if'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'status '), + TextSpan(style: codeStyle.punctuationStyle, text: '=='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'AnimationStatus'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'completed'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _controller'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'reverse'), + 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: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' dispose'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _controller'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'stop'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'super'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'dispose'), + 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.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' _title '), + 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: 'widget'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'type'), + 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.classStyle, text: 'ProgressIndicatorDemoType'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'circular'), + 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: '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: 'demoCircularProgressIndicatorTitle'), + 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.classStyle, text: 'ProgressIndicatorDemoType'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'linear'), + 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: '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: 'demoLinearProgressIndicatorTitle'), + 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.stringStyle, text: '\u0027\u0027'), + 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.classStyle, text: 'Widget'), + TextSpan(style: codeStyle.baseStyle, text: ' _buildIndicators'), + 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.classStyle, text: 'Widget'), + TextSpan(style: codeStyle.baseStyle, text: ' child'), + 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: 'switch'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'widget'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'type'), + 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.classStyle, text: 'ProgressIndicatorDemoType'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'circular'), + 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: 'Column'), + 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: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CircularProgressIndicator'), + TextSpan(style: codeStyle.punctuationStyle, text: '(),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'SizedBox'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'height'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '32'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'CircularProgressIndicator'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _animation'), + 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.keywordStyle, text: 'case'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'ProgressIndicatorDemoType'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'linear'), + 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: 'Column'), + 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: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'LinearProgressIndicator'), + TextSpan(style: codeStyle.punctuationStyle, text: '(),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'SizedBox'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'height'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '32'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'LinearProgressIndicator'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _animation'), + 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.keywordStyle, text: 'default'), + 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: 'Container'), + 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: '@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: '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 title'), + 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: '_title'), + 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: '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: 'SingleChildScrollView'), + 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: 'Container'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a padding'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'EdgeInsets'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'all'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '8'), + 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: 'AnimatedBuilder'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a animation'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _animation'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _buildIndicators'), + 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 bottomSheetDemoModal(BuildContext context) { final CodeStyle codeStyle = CodeStyle.of(context); return TextSpan(children: [ diff --git a/gallery/gallery/lib/data/demos.dart b/gallery/gallery/lib/data/demos.dart index 896aa6a78..b9e9060bb 100644 --- a/gallery/gallery/lib/data/demos.dart +++ b/gallery/gallery/lib/data/demos.dart @@ -8,6 +8,7 @@ import 'package:gallery/codeviewer/code_displayer.dart'; import 'package:gallery/codeviewer/code_segments.dart'; import 'package:gallery/data/gallery_options.dart'; import 'package:gallery/data/icons.dart'; +import 'package:gallery/demos/cupertino/cupertino_activity_indicator_demo.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_segmented_control_demo.dart'; @@ -21,6 +22,7 @@ import 'package:gallery/demos/material/button_demo.dart'; import 'package:gallery/demos/material/chip_demo.dart'; import 'package:gallery/demos/material/dialog_demo.dart'; import 'package:gallery/demos/material/list_demo.dart'; +import 'package:gallery/demos/material/progress_indicator_demo.dart'; import 'package:gallery/demos/material/selection_controls_demo.dart'; import 'package:gallery/demos/material/sliders_demo.dart'; import 'package:gallery/demos/material/snackbar_demo.dart'; @@ -299,6 +301,37 @@ List materialDemos(BuildContext context) { ), ], ), + GalleryDemo( + title: GalleryLocalizations.of(context).demoProgressIndicatorTitle, + icon: GalleryIcons.progressActivity, + subtitle: GalleryLocalizations.of(context).demoProgressIndicatorSubtitle, + configurations: [ + GalleryDemoConfiguration( + title: GalleryLocalizations.of(context) + .demoCircularProgressIndicatorTitle, + description: GalleryLocalizations.of(context) + .demoCircularProgressIndicatorDescription, + documentationUrl: + 'https://api.flutter.dev/flutter/material/CircularProgressIndicator-class.html', + buildRoute: (context) => ProgressIndicatorDemo( + type: ProgressIndicatorDemoType.circular, + ), + code: CodeSegments.progressIndicatorsDemo, + ), + GalleryDemoConfiguration( + title: + GalleryLocalizations.of(context).demoLinearProgressIndicatorTitle, + description: GalleryLocalizations.of(context) + .demoLinearProgressIndicatorDescription, + documentationUrl: + 'https://api.flutter.dev/flutter/material/LinearProgressIndicator-class.html', + buildRoute: (context) => ProgressIndicatorDemo( + type: ProgressIndicatorDemoType.linear, + ), + code: CodeSegments.progressIndicatorsDemo, + ), + ], + ), GalleryDemo( title: GalleryLocalizations.of(context).demoSelectionControlsTitle, icon: GalleryIcons.checkBox, @@ -429,6 +462,25 @@ List materialDemos(BuildContext context) { List cupertinoDemos(BuildContext context) { return [ + GalleryDemo( + title: + GalleryLocalizations.of(context).demoCupertinoActivityIndicatorTitle, + icon: GalleryIcons.cupertinoProgress, + subtitle: GalleryLocalizations.of(context) + .demoCupertinoActivityIndicatorSubtitle, + configurations: [ + GalleryDemoConfiguration( + title: GalleryLocalizations.of(context) + .demoCupertinoActivityIndicatorTitle, + description: GalleryLocalizations.of(context) + .demoCupertinoActivityIndicatorDescription, + documentationUrl: + 'https://api.flutter.dev/flutter/cupertino/CupertinoActivityIndicator-class.html', + buildRoute: (_) => CupertinoProgressIndicatorDemo(), + code: CodeSegments.cupertinoActivityIndicatorDemo, + ), + ], + ), GalleryDemo( title: GalleryLocalizations.of(context).demoCupertinoButtonsTitle, icon: GalleryIcons.genericButtons, @@ -540,7 +592,7 @@ List cupertinoDemos(BuildContext context) { ), GalleryDemo( title: GalleryLocalizations.of(context).demoSelectionControlsSwitchTitle, - icon: GalleryIcons.switches, + icon: GalleryIcons.cupertinoSwitch, subtitle: GalleryLocalizations.of(context).demoCupertinoSwitchSubtitle, configurations: [ GalleryDemoConfiguration( diff --git a/gallery/gallery/lib/demos/cupertino/cupertino_activity_indicator_demo.dart b/gallery/gallery/lib/demos/cupertino/cupertino_activity_indicator_demo.dart new file mode 100644 index 000000000..c7b27d5a7 --- /dev/null +++ b/gallery/gallery/lib/demos/cupertino/cupertino_activity_indicator_demo.dart @@ -0,0 +1,26 @@ +// 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 cupertinoActivityIndicatorDemo + +class CupertinoProgressIndicatorDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + middle: Text( + GalleryLocalizations.of(context).demoCupertinoActivityIndicatorTitle, + ), + ), + child: const Center( + child: CupertinoActivityIndicator(), + ), + ); + } +} + +// END diff --git a/gallery/gallery/lib/demos/material/progress_indicator_demo.dart b/gallery/gallery/lib/demos/material/progress_indicator_demo.dart new file mode 100644 index 000000000..51190a9e2 --- /dev/null +++ b/gallery/gallery/lib/demos/material/progress_indicator_demo.dart @@ -0,0 +1,113 @@ +// 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/material.dart'; +import 'package:gallery/l10n/gallery_localizations.dart'; + +// BEGIN progressIndicatorsDemo + +enum ProgressIndicatorDemoType { + circular, + linear, +} + +class ProgressIndicatorDemo extends StatefulWidget { + const ProgressIndicatorDemo({Key key, this.type}) : super(key: key); + + final ProgressIndicatorDemoType type; + + @override + _ProgressIndicatorDemoState createState() => _ProgressIndicatorDemoState(); +} + +class _ProgressIndicatorDemoState extends State + with SingleTickerProviderStateMixin { + AnimationController _controller; + Animation _animation; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + duration: const Duration(milliseconds: 1500), + vsync: this, + animationBehavior: AnimationBehavior.preserve, + )..forward(); + + _animation = CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.9, curve: Curves.fastOutSlowIn), + reverseCurve: Curves.fastOutSlowIn, + )..addStatusListener((status) { + if (status == AnimationStatus.dismissed) { + _controller.forward(); + } else if (status == AnimationStatus.completed) { + _controller.reverse(); + } + }); + } + + @override + void dispose() { + _controller.stop(); + super.dispose(); + } + + String get _title { + switch (widget.type) { + case ProgressIndicatorDemoType.circular: + return GalleryLocalizations.of(context) + .demoCircularProgressIndicatorTitle; + case ProgressIndicatorDemoType.linear: + return GalleryLocalizations.of(context) + .demoLinearProgressIndicatorTitle; + } + return ''; + } + + Widget _buildIndicators(BuildContext context, Widget child) { + switch (widget.type) { + case ProgressIndicatorDemoType.circular: + return Column( + children: [ + const CircularProgressIndicator(), + SizedBox(height: 32), + CircularProgressIndicator(value: _animation.value), + ], + ); + case ProgressIndicatorDemoType.linear: + return Column( + children: [ + const LinearProgressIndicator(), + SizedBox(height: 32), + LinearProgressIndicator(value: _animation.value), + ], + ); + default: + return Container(); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(_title), + ), + body: Center( + child: SingleChildScrollView( + child: Container( + padding: const EdgeInsets.all(8), + child: AnimatedBuilder( + animation: _animation, + builder: _buildIndicators, + ), + ), + ), + ), + ); + } +} + +// END diff --git a/gallery/gallery/lib/l10n/gallery_localizations.dart b/gallery/gallery/lib/l10n/gallery_localizations.dart index 44e970b75..d29f933bc 100644 --- a/gallery/gallery/lib/l10n/gallery_localizations.dart +++ b/gallery/gallery/lib/l10n/gallery_localizations.dart @@ -1464,6 +1464,21 @@ class GalleryLocalizations { desc: r'Title for the choice chip component demo.'); } + String get demoCircularProgressIndicatorDescription { + return Intl.message( + r'A Material Design circular progress indicator, which spins to indicate that the application is busy.', + locale: _localeName, + name: 'demoCircularProgressIndicatorDescription', + desc: r'Description for circular progress indicator demo.'); + } + + String get demoCircularProgressIndicatorTitle { + return Intl.message(r'Circular Progress Indicator', + locale: _localeName, + name: 'demoCircularProgressIndicatorTitle', + desc: r'Title for circular progress indicator demo.'); + } + String get demoCodeTooltip { return Intl.message(r'Code Sample', locale: _localeName, @@ -1535,6 +1550,29 @@ class GalleryLocalizations { desc: r'Title for the cupertino action sheet component demo.'); } + String get demoCupertinoActivityIndicatorDescription { + return Intl.message( + r'An iOS-style activity indicator that spins clockwise.', + locale: _localeName, + name: 'demoCupertinoActivityIndicatorDescription', + desc: + r'Description for the cupertino activity indicator component demo.'); + } + + String get demoCupertinoActivityIndicatorSubtitle { + return Intl.message(r'iOS-style activity indicators', + locale: _localeName, + name: 'demoCupertinoActivityIndicatorSubtitle', + desc: r'Subtitle for the cupertino activity indicator component demo.'); + } + + String get demoCupertinoActivityIndicatorTitle { + return Intl.message(r'Activity Indicator', + locale: _localeName, + name: 'demoCupertinoActivityIndicatorTitle', + desc: r'Title for the cupertino activity indicator component demo.'); + } + String get demoCupertinoAlertButtonsOnlyTitle { return Intl.message(r'Alert Buttons Only', locale: _localeName, @@ -1839,6 +1877,21 @@ class GalleryLocalizations { desc: r'Error message when opening the URL for a demo.'); } + String get demoLinearProgressIndicatorDescription { + return Intl.message( + r'A Material Design linear progress indicator, also known as a progress bar.', + locale: _localeName, + name: 'demoLinearProgressIndicatorDescription', + desc: r'Description for linear progress indicator demo.'); + } + + String get demoLinearProgressIndicatorTitle { + return Intl.message(r'Linear Progress Indicator', + locale: _localeName, + name: 'demoLinearProgressIndicatorTitle', + desc: r'Title for linear progress indicator demo.'); + } + String get demoListsDescription { return Intl.message( r'A single fixed-height row that typically contains some text as well as a leading or trailing icon.', @@ -1914,6 +1967,20 @@ class GalleryLocalizations { desc: r'Title for the outline button component demo.'); } + String get demoProgressIndicatorSubtitle { + return Intl.message(r'Linear, circular, indeterminate', + locale: _localeName, + name: 'demoProgressIndicatorSubtitle', + desc: r'Subtitle for progress indicators demo.'); + } + + String get demoProgressIndicatorTitle { + return Intl.message(r'Progress indicators', + locale: _localeName, + name: 'demoProgressIndicatorTitle', + desc: r'Title for progress indicators demo.'); + } + String get demoRaisedButtonDescription { return Intl.message( r'Raised buttons add dimension to mostly flat layouts. They emphasize functions on busy or wide spaces.', diff --git a/gallery/gallery/lib/l10n/intl_en_US.arb b/gallery/gallery/lib/l10n/intl_en_US.arb index b23355441..d29b17bc2 100644 --- a/gallery/gallery/lib/l10n/intl_en_US.arb +++ b/gallery/gallery/lib/l10n/intl_en_US.arb @@ -673,6 +673,18 @@ "@demoFullscreenDialogDescription": { "description": "Description for the fullscreen dialog component demo." }, + "demoCupertinoActivityIndicatorTitle": "Activity Indicator", + "@demoCupertinoActivityIndicatorTitle": { + "description": "Title for the cupertino activity indicator component demo." + }, + "demoCupertinoActivityIndicatorSubtitle": "iOS-style activity indicators", + "@demoCupertinoActivityIndicatorSubtitle": { + "description": "Subtitle for the cupertino activity indicator component demo." + }, + "demoCupertinoActivityIndicatorDescription": "An iOS-style activity indicator that spins clockwise.", + "@demoCupertinoActivityIndicatorDescription": { + "description": "Description for the cupertino activity indicator component demo." + }, "demoCupertinoButtonsTitle": "Buttons", "@demoCupertinoButtonsTitle": { "description": "Title for the cupertino buttons component demo." @@ -892,6 +904,30 @@ "@demoListsSecondary": { "description": "Text that appears in the second line of a list item." }, + "demoProgressIndicatorTitle": "Progress indicators", + "@demoProgressIndicatorTitle": { + "description": "Title for progress indicators demo." + }, + "demoProgressIndicatorSubtitle": "Linear, circular, indeterminate", + "@demoProgressIndicatorSubtitle": { + "description": "Subtitle for progress indicators demo." + }, + "demoCircularProgressIndicatorTitle": "Circular Progress Indicator", + "@demoCircularProgressIndicatorTitle": { + "description": "Title for circular progress indicator demo." + }, + "demoCircularProgressIndicatorDescription": "A Material Design circular progress indicator, which spins to indicate that the application is busy.", + "@demoCircularProgressIndicatorDescription": { + "description": "Description for circular progress indicator demo." + }, + "demoLinearProgressIndicatorTitle": "Linear Progress Indicator", + "@demoLinearProgressIndicatorTitle": { + "description": "Title for linear progress indicator demo." + }, + "demoLinearProgressIndicatorDescription": "A Material Design linear progress indicator, also known as a progress bar.", + "@demoLinearProgressIndicatorDescription": { + "description": "Description for linear progress indicator demo." + }, "demoTabsTitle": "Tabs", "@demoTabsTitle": { "description": "Title for tabs demo." diff --git a/gallery/gallery/lib/l10n/intl_en_US.xml b/gallery/gallery/lib/l10n/intl_en_US.xml index 066259e43..748386da8 100644 --- a/gallery/gallery/lib/l10n/intl_en_US.xml +++ b/gallery/gallery/lib/l10n/intl_en_US.xml @@ -637,6 +637,18 @@ name="demoFullscreenDialogDescription" description="Description for the fullscreen dialog component demo." >The fullscreenDialog property specifies whether the incoming page is a fullscreen modal dialog + Activity Indicator + iOS-style activity indicators + An iOS-style activity indicator that spins clockwise. Secondary text + Progress indicators + Linear, circular, indeterminate + Circular Progress Indicator + A Material Design circular progress indicator, which spins to indicate that the application is busy. + Linear Progress Indicator + A Material Design linear progress indicator, also known as a progress bar.