Created the populatedDrawer widget and the Avatar widget
This commit is contained in:
parent
0d47b271fe
commit
3c1c3c68b2
6 changed files with 192 additions and 32 deletions
39
lib/src/widgets/avatar.dart
Normal file
39
lib/src/widgets/avatar.dart
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class Avatar extends StatelessWidget {
|
||||
/// The url of hte image to be displayed.
|
||||
final String imageUrl;
|
||||
|
||||
/// The size of the Avatar.
|
||||
final double size;
|
||||
|
||||
Avatar({
|
||||
this.imageUrl,
|
||||
this.size = 60.0,
|
||||
});
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return imageUrl == null
|
||||
? Container(
|
||||
height: size,
|
||||
width: size,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(
|
||||
FontAwesomeIcons.question,
|
||||
),
|
||||
),
|
||||
)
|
||||
: ClipOval(
|
||||
child: Image.network(
|
||||
imageUrl,
|
||||
height: size,
|
||||
width: size,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue