CupertinoActivityIndicator widget and Attributes

CupertinoActivityIndicator widget and Attributes

ยท

1 min read

The CupertinoActivityIndicator widget in Flutter is part of the Cupertino (iOS-style) library and is used to display an iOS-style activity indicator, commonly known as a spinner. It indicates that some operation is ongoing and provides a visual representation of progress.

Attributes:

  1. animating (bool):

    • Determines whether the activity indicator is currently running.
  2. radius (double):

    • The radius of the activity indicator. The default value is 11.0.

Example:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CupertinoActivityIndicatorExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        middle: Text('CupertinoActivityIndicator Example'),
      ),
      child: Center(
        child: CupertinoActivityIndicator(),
      ),
    );
  }
}

void main() {
  runApp(
    MaterialApp(
      home: CupertinoActivityIndicatorExample(),
    ),
  );
}

In this example, a CupertinoActivityIndicator is displayed at the center of the screen within a CupertinoPageScaffold. The indicator will automatically start animating when the widget is rendered.

Customize the attributes like animating and radius based on your specific use case. The CupertinoActivityIndicator provides a clean and native-looking way to indicate ongoing activity in an iOS-style app.

ย