Loading effect in a flutter |
dependencies:flutter:sdk: flutterflutter_widgets: ^0.0.1
import 'package:flutter/material.dart';class MyApp extends StatelessWidget {@overrideWidget build(BuildContext context) {return Scaffold(body: Center(child: CircularProgressIndicator(),),);}}
In this example, the CircularProgressIndicator widget is being used as the child of a Center widget, which is itself being used as the child of the Scaffold widget. This will center the loading effect on the screen.
You can also customize the appearance of the CircularProgressIndicator widget by using the various properties that it provides. For example, you can use the backgroundColor property to change the background color of the loading effect, or the valueColor property to change the color of the spinning circle. Here is an example of how you can use these properties to customize the appearance of the CircularProgressIndicator widget:
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(
backgroundColor: Colors.grey[200],
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
),
),
);
}
}
In this example, the background color of the loading effect is being set to grey, and the color of the spinning circle is being set to blue.
import 'package:flutter/material.dart';class MyApp extends StatelessWidget {@overrideWidget build(BuildContext context) {return Scaffold(body: Center(child: LinearProgressIndicator(backgroundColor: Colors.grey[200]