AdoptAWidget - Progress indicator (#69498)
* Add examples for LinearProgressIndicator * Add examples for CircularProgressIndicator * Change name Linear -> Circular * Remove unnecessary changes * Add images to docs * Fix semi-colon bugs * Fix trailing spaces * Fix more semicolon bugs * Remove imports in docs * Remove error causing line breaks * Add ticker providers * Add more ticker providers * Remove assets and combine samples * Removed 6 samples * Remove unnecessary animation Co-authored-by: John Ryan <ryjohn@google.com> * Remove unnecessary animation Co-authored-by: John Ryan <ryjohn@google.com> * Use material theme Co-authored-by: John Ryan <ryjohn@google.com> * Apply suggestions from code review Co-authored-by: John Ryan <ryjohn@google.com>
This commit is contained in:
@@ -243,6 +243,54 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
|
||||
/// The minimum height of the indicator can be specified using [minHeight].
|
||||
/// The indicator can be made taller by wrapping the widget with a [SizedBox].
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_ticker}
|
||||
///
|
||||
/// This example shows a [LinearProgressIndicator] with a changing value.
|
||||
///
|
||||
/// ```dart
|
||||
/// AnimationController controller;
|
||||
///
|
||||
/// @override
|
||||
/// void initState() {
|
||||
/// controller = AnimationController(
|
||||
/// vsync: this,
|
||||
/// duration: const Duration(seconds: 5),
|
||||
/// )..addListener(() {
|
||||
/// setState(() {});
|
||||
/// });
|
||||
/// controller.repeat(reverse: true);
|
||||
/// super.initState();
|
||||
/// }
|
||||
///
|
||||
/// @override
|
||||
/// void dispose() {
|
||||
/// controller.dispose();
|
||||
/// super.dispose();
|
||||
/// }
|
||||
///
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return Scaffold(
|
||||
/// body: Padding(
|
||||
/// padding: const EdgeInsets.all(20.0),
|
||||
/// child: Column(
|
||||
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
/// children: [
|
||||
/// Text(
|
||||
/// 'Linear progress indicator with a fixed color',
|
||||
/// style: const TextStyle(fontSize: 20),
|
||||
/// ),
|
||||
/// LinearProgressIndicator(
|
||||
/// value: controller.value,
|
||||
/// semanticsLabel: 'Linear progress indicator',
|
||||
/// ),
|
||||
/// ],
|
||||
/// ),
|
||||
/// ),
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [CircularProgressIndicator], which shows progress along a circular arc.
|
||||
@@ -433,6 +481,54 @@ class _CircularProgressIndicatorPainter extends CustomPainter {
|
||||
/// The indicator arc is displayed with [valueColor], an animated value. To
|
||||
/// specify a constant color use: `AlwaysStoppedAnimation<Color>(color)`.
|
||||
///
|
||||
/// {@tool dartpad --template=stateful_widget_material_ticker}
|
||||
///
|
||||
/// This example shows a [CircularProgressIndicator] with a changing value.
|
||||
///
|
||||
/// ```dart
|
||||
/// AnimationController controller;
|
||||
///
|
||||
/// @override
|
||||
/// void initState() {
|
||||
/// controller = AnimationController(
|
||||
/// vsync: this,
|
||||
/// duration: const Duration(seconds: 5),
|
||||
/// )..addListener(() {
|
||||
/// setState(() {});
|
||||
/// });
|
||||
/// controller.repeat(reverse: true);
|
||||
/// super.initState();
|
||||
/// }
|
||||
///
|
||||
/// @override
|
||||
/// void dispose() {
|
||||
/// controller.dispose();
|
||||
/// super.dispose();
|
||||
/// }
|
||||
///
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return Scaffold(
|
||||
/// body: Padding(
|
||||
/// padding: const EdgeInsets.all(20.0),
|
||||
/// child: Column(
|
||||
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
/// children: [
|
||||
/// Text(
|
||||
/// 'Linear progress indicator with a fixed color',
|
||||
/// style: Theme.of(context).textTheme.headline6,
|
||||
/// ),
|
||||
/// CircularProgressIndicator(
|
||||
/// value: controller.value,
|
||||
/// semanticsLabel: 'Linear progress indicator',
|
||||
/// ),
|
||||
/// ],
|
||||
/// ),
|
||||
/// ),
|
||||
/// );
|
||||
/// }
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [LinearProgressIndicator], which displays progress along a line.
|
||||
|
||||
Reference in New Issue
Block a user