correct sizing
This commit is contained in:
@@ -11,12 +11,16 @@ class MihCircleAvatar extends StatefulWidget {
|
|||||||
final bool editable;
|
final bool editable;
|
||||||
final TextEditingController fileNameController;
|
final TextEditingController fileNameController;
|
||||||
final onChange;
|
final onChange;
|
||||||
|
final PlatformFile? userSelectedfile;
|
||||||
|
final Color frameColor;
|
||||||
const MihCircleAvatar({
|
const MihCircleAvatar({
|
||||||
super.key,
|
super.key,
|
||||||
required this.imageFile,
|
required this.imageFile,
|
||||||
required this.width,
|
required this.width,
|
||||||
required this.editable,
|
required this.editable,
|
||||||
required this.fileNameController,
|
required this.fileNameController,
|
||||||
|
required this.userSelectedfile,
|
||||||
|
required this.frameColor,
|
||||||
required this.onChange,
|
required this.onChange,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -38,23 +42,25 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
// color: Colors.white,
|
||||||
|
alignment: Alignment.center,
|
||||||
width: widget.width,
|
width: widget.width,
|
||||||
height: widget.width,
|
height: widget.width,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
CircleAvatar(
|
||||||
padding: const EdgeInsets.all(6.0),
|
radius: widget.width / 2.2,
|
||||||
child: CircleAvatar(
|
backgroundColor: widget.frameColor,
|
||||||
radius: widget.width / 2,
|
|
||||||
backgroundColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
backgroundImage: imagePreview,
|
backgroundImage: imagePreview,
|
||||||
),
|
),
|
||||||
),
|
FittedBox(
|
||||||
Icon(
|
fit: BoxFit.fill,
|
||||||
|
child: Icon(
|
||||||
size: widget.width,
|
size: widget.width,
|
||||||
MihIcons.mihCircleFrame,
|
MihIcons.mihCircleFrame,
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
color: widget.frameColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: widget.editable,
|
visible: widget.editable,
|
||||||
@@ -77,7 +83,7 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
|
|||||||
PlatformFile? selectedFile = result.files.first;
|
PlatformFile? selectedFile = result.files.first;
|
||||||
setState(() {
|
setState(() {
|
||||||
// print("Here 4");
|
// print("Here 4");
|
||||||
widget.onChange(MemoryImage(selectedFile.bytes!));
|
widget.onChange(selectedFile);
|
||||||
// print("Here 5");
|
// print("Here 5");
|
||||||
imagePreview = MemoryImage(selectedFile.bytes!);
|
imagePreview = MemoryImage(selectedFile.bytes!);
|
||||||
});
|
});
|
||||||
@@ -96,7 +102,7 @@ class _MihCircleAvatarState extends State<MihCircleAvatar> {
|
|||||||
//extension: fileExtension,
|
//extension: fileExtension,
|
||||||
);
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.onChange(MemoryImage(androidFile.bytes!));
|
widget.onChange(androidFile);
|
||||||
imagePreview = FileImage(file);
|
imagePreview = FileImage(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user