Learn CupertinoProgressIndicator creation using these simple examples.
- Open your favorite Flutter IDE.
- Go to
File-->New-->Project
to create a new project.
Here are the examples:
CupertinoProgressIndicatorExample.dart
Example 1: CupertinoProgressIndicator Example
Create a file Dart
named CupertinoProgressIndicatorExample.dart
.
Then import curpertino.dart
:
import 'package:flutter/cupertino.dart';
Extend the StatelessWidget
class:
class CupertinoProgressIndicatorExample extends StatelessWidget {
Define one instance variable:
final String title;
as well as a constructor:
const CupertinoProgressIndicatorExample(this.title);
Then build the widget:
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
previousPageTitle: "Back",
middle: Text(title),
),
child: const Center(
child: CupertinoActivityIndicator(),
),
);
}
Here is the full code
import 'package:flutter/cupertino.dart';
class CupertinoProgressIndicatorExample extends StatelessWidget {
final String title;
const CupertinoProgressIndicatorExample(this.title);
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
previousPageTitle: "Back",
middle: Text(title),
),
child: const Center(
child: CupertinoActivityIndicator(),
),
);
}
}