update
This commit is contained in:
@@ -2,18 +2,23 @@ import 'dart:io';
|
||||
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
|
||||
const double photoSize = 100;
|
||||
const double iconSize = 55;
|
||||
|
||||
class ReferencePhoto extends StatelessWidget {
|
||||
Reference? ref;
|
||||
double size;
|
||||
double sizeIcon;
|
||||
double sizeCircle;
|
||||
ReferencePhoto(
|
||||
{super.key,
|
||||
required this.ref,
|
||||
this.size = photoSize,
|
||||
this.sizeCircle = photoSize});
|
||||
ReferencePhoto({
|
||||
super.key,
|
||||
required this.ref,
|
||||
this.sizeIcon = iconSize,
|
||||
this.size = photoSize,
|
||||
this.sizeCircle = photoSize,
|
||||
});
|
||||
|
||||
Future<Widget> downloadImage() async {
|
||||
try {
|
||||
@@ -33,7 +38,10 @@ class ReferencePhoto extends StatelessWidget {
|
||||
// ignore: empty_catches
|
||||
} catch (e) {}
|
||||
|
||||
return DefaultPhoto(sizeDefault: sizeCircle);
|
||||
return DefaultPhoto(
|
||||
sizeDefault: sizeCircle,
|
||||
iconDefault: sizeIcon,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -43,12 +51,13 @@ class ReferencePhoto extends StatelessWidget {
|
||||
builder: (BuildContext context, AsyncSnapshot<Widget> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
// mientras la llamada asíncrona está en proceso, muestra un mensaje de carga
|
||||
return const SizedBox(
|
||||
width: photoSize,
|
||||
height: photoSize,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
));
|
||||
return SizedBox(
|
||||
width: size,
|
||||
height: size,
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
} else if (snapshot.connectionState == ConnectionState.done &&
|
||||
snapshot.hasData) {
|
||||
return snapshot.data!;
|
||||
@@ -61,7 +70,12 @@ class ReferencePhoto extends StatelessWidget {
|
||||
|
||||
class DefaultPhoto extends StatelessWidget {
|
||||
double sizeDefault;
|
||||
DefaultPhoto({super.key, this.sizeDefault = photoSize});
|
||||
double iconDefault;
|
||||
DefaultPhoto({
|
||||
super.key,
|
||||
this.sizeDefault = photoSize,
|
||||
this.iconDefault = iconSize,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -72,12 +86,12 @@ class DefaultPhoto extends StatelessWidget {
|
||||
color: const Color(0xFF2BA4EC),
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Icons.person,
|
||||
color: Color.fromARGB(255, 255, 255, 255),
|
||||
size: 55,
|
||||
color: const Color.fromARGB(255, 255, 255, 255),
|
||||
size: iconDefault,
|
||||
),
|
||||
);
|
||||
).animate().shake();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user