forked from qwertypool/flutter-code-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CircleAvatar.dart
63 lines (53 loc) · 2.37 KB
/
CircleAvatar.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
// Text Inside Circle Avatar ---- >>>
body: Center(
child: CircleAvatar(
backgroundColor: Colors.pink[400],
radius: 100,
child: Text(
'Deepa Pandey',
style: TextStyle(fontSize: 25, color: Colors.white),
), //Text
), //CirlceAvatar
),
foregroundColor: Colors.white, // Or use foregroundColor for the default text color for text in the circle.
-----------------------------------------------------------------------------------------------------------------------
// Code snippet for image inside the CircleAvatar
...
body: Center(
child: CircleAvatar(
backgroundImage: NetworkImage(
"https://abc.com//xyz.png"),
radius: 100,
), //CircleAvatar
...
-----------------------------------------------------------------------------------------------------------------------
// To add a colored border in the Circle Avatar :
CircleAvatar(
radius: 21,
backgroundColor: Colors.pink,
child: CircleAvatar(
backgroundColor: Colors.amber,
child: Text(
active[index].name[0], // A model data
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black),
),
-----------------------------------------------------------------------------------------------------------------------
// To add a border and image/text with some space in between the circleAvatar --
Center(
child: CircleAvatar(
backgroundColor: Colors.pink,
radius: 115,
child: CircleAvatar(
backgroundColor: Colors.grey[100],
radius: 110,
child: CircleAvatar(
backgroundImage: NetworkImage(
"https://xyz.jpg"), //NetworkImage
radius: 100,
), //CircleAvatar
), //CircleAvatar
), //CircleAvatar
),