-
Notifications
You must be signed in to change notification settings - Fork 19
/
day077_cupertino_activity_indicator.dart
63 lines (60 loc) · 1.85 KB
/
day077_cupertino_activity_indicator.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class Day77CupertinoActivityIndicator extends StatefulWidget {
const Day77CupertinoActivityIndicator({Key key}) : super(key: key);
@override
_Day77CupertinoActivityIndicatorState createState() =>
_Day77CupertinoActivityIndicatorState();
}
class _Day77CupertinoActivityIndicatorState
extends State<Day77CupertinoActivityIndicator> {
bool loader = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('CupertinoActivityIndicator'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.help),
onPressed: () async {
const url =
'https://github.com/sanjaysanju618/100-Days-Of-Flutter-Widgets/' +
'blob/master/hundred_days_of_flutter_widget/' +
'lib/day077_cupertino_activity_indicator.dart';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
},
)
],
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CupertinoActivityIndicator(
radius: 50,
animating: loader,
),
RaisedButton(
color: Theme.of(context).primaryColor,
onPressed: () {
setState(() {
loader = !loader;
});
},
child: Text(
loader ? "Stop Loading" : "Start Loading",
style: TextStyle(color: Colors.white),
),
)
],
),
),
);
}
}