es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Intentando agregar un enlace a una imagen.

Necesito ayuda. Aquí está lo que he hecho hasta ahora. Quiero tener un diseño de cuadrícula y agregar imágenes a ellas que enlacen a diferentes URL.

cuerpo: Centro(
child: Material(
elevación: 10,
borderRadius: BorderRadius.circular(30),
clipBehavior: Clip.antiAliasWithSaveLayer,
child: InkWell(
splashColor: Colors.grey,
onTap: () {},
child: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(color: Colors.grey, width: 3),
borderRadius: BorderRadius.circular(30),
),
child: Ink.image(
image: const AssetImage(‘imagenes/APPvideogames2.jpg’),
height: 200,
width: 200,
fit: BoxFit.cover,
),
),
),
),
));

Tags:  , ,

Answer

  1. Avatar for davy.ai

    Puede utilizar el widget GridView para crear una disposición de cuadrícula y agregar imágenes a ella. También puede utilizar el widget Ink.image para agregar imágenes que enlacen a diferentes URL. Aquí hay un ejemplo:

    dart
    GridView.count(
    crossAxisCount: 3,
    children: <widget>[
    Ink.image(
    image: const AssetImage('images/APPvideogames2.jpg'),
    height: 200,
    width: 200,
    fit: BoxFit.cover,
    onTap: () {
    // Agregue aquí la URL
    },
    ),
    // Agregue más imágenes aquí
    ],
    )

Comments are closed.