|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'avatar_gradients.dart';
|
|
|
|
|
|
|
|
class LargeAvatar extends StatelessWidget {
|
|
|
|
LargeAvatar(
|
|
|
|
{Key key,
|
|
|
|
this.name,
|
|
|
|
this.url,
|
|
|
|
this.disableProfileView: false,
|
|
|
|
this.radius = 60.0,
|
|
|
|
this.width = 90,
|
|
|
|
this.height = 90})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
final String name;
|
|
|
|
final String url;
|
|
|
|
final bool disableProfileView;
|
|
|
|
final double radius;
|
|
|
|
final double width;
|
|
|
|
final double height;
|
|
|
|
|
|
|
|
Widget _getAvatar() {
|
|
|
|
if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) {
|
|
|
|
return Center(
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(radius)),
|
|
|
|
child: Image.network(
|
|
|
|
url.trim(),
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: width,
|
|
|
|
height: height,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
} else if (name == null || name.isEmpty) {
|
|
|
|
return Center(
|
|
|
|
child: AppText(
|
|
|
|
'DR',
|
|
|
|
color: Colors.white,
|
|
|
|
));
|
|
|
|
} else {
|
|
|
|
return Center(
|
|
|
|
child: AppText(
|
|
|
|
name[0].toUpperCase(),
|
|
|
|
color: Colors.white,
|
|
|
|
fontSize: 18,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
var vlr = name;
|
|
|
|
var asd;
|
|
|
|
return InkWell(
|
|
|
|
onTap: disableProfileView
|
|
|
|
? null
|
|
|
|
: () {
|
|
|
|
//TODO when we need that
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
gradient: LinearGradient(
|
|
|
|
begin: Alignment(-1, -1),
|
|
|
|
end: Alignment(1, 1),
|
|
|
|
colors: [
|
|
|
|
Colors.grey[100],
|
|
|
|
Colors.grey[800],
|
|
|
|
]),
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.08),
|
|
|
|
offset: Offset(0.0, 5.0),
|
|
|
|
blurRadius: 16.0)
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(50.0)),
|
|
|
|
),
|
|
|
|
width: width,
|
|
|
|
height: height,
|
|
|
|
child: _getAvatar()),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|