It is probably a basic question, but I did not found an answer. I execute CircularProgressIndicator() and the screen shows the circle but the circle is stopped? In my case, it continues... endless... Why? Do I need to make a call in order to stop it?
below the sample code:
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:web_scraper/web_scraper.dart';
import 'dart:io';
void main() => runApp(MyApp());
/// This Widget is the main application widget.
class MyApp extends StatelessWidget {
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: MyStatefulWidget(),
);
}
}
class MyStatefulWidget extends StatefulWidget {
MyStatefulWidget({Key key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
int _count = 0;
bool ShowCircle = true;
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Sample Code'),
),
body: Center(
child : Column(
children: <Widget>[
//sleep(const Duration(seconds:2)),
Text("Sample",style:TextStyle(fontSize: 21)),
]
)),
backgroundColor: Colors.blueGrey.shade200,
floatingActionButton: FloatingActionButton(
onPressed: () {
ShowCircle = !ShowCircle;
if (ShowCircle)
CircularProgressIndicator(value:0.0);
else
CircularProgressIndicator(value:1.0);
},
tooltip: 'Increment Counter',
child: const Icon(Icons.add),
),
);
}
}
BR Asi