0

tengo el siguiente problema tengo una imagen que le puse InteractiveViewer hace el movimiento de la imagen bien pero cuando le quiero poner un circulo o un icono encima, cuando muevo la imagen se mueve con todo el icono o circulo necesitaria que se mantenga fijo cuando muevo la imagen mando codigo.


introducir la descripción de la imagen aquí

introducir la descripción de la imagen aquí

introducir la descripción de la imagen aquí


import 'package:flutter/material.dart';
import 'package:pruebamapa/main.dart';

void main() => runApp(MyAppprueba());

class MyAppprueba extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      home: Scaffold(
          appBar: AppBar(
            title: Text('Material App Bar'),
          ),
          body: new Stack(
            children: <Widget>[
              InteractiveViewer(
                child: Image.asset('assets/Map1.jpg'),
                minScale: 0.1,
                maxScale: 1.6,
                constrained: false,
              ),
Container(
                alignment: Alignment.topCenter,
                decoration:
                    BoxDecoration(shape: BoxShape.circle, color: Colors.purple ),
              ),
1
  • 1
    No todos podemos ver las imágenes :) Pon el código como texto, con formato.
    – padaleiana
    el 26 ene. 2022 a las 17:43

1 respuesta 1

0

lo que entiendo por tu pregunta es que estás envolviendo en un InteractiveViewer únicamente la imagen, entonces lo que podrías hacer para que solamente se mueva la imagen, es agregar en ese mismo stack tu icono o circulo y arrastar la imagen debajo del icono o arrastrarla donde tú quieras, cabe recalcar que en el Stack tú puedes mover tu widget sin problema, hice un ejemplo con tu mismo código:

Scaffold(
  appBar: AppBar(
    title: Text('Material App Bar'),
  ),
  body: Stack(
    children: <Widget>[
      Container(
        decoration: const BoxDecoration(
            shape: BoxShape.circle, color: Colors.purple),
      ),
       //reemplace la imagen por un container para poder hacer el 
       //ejemplo, tu coloca la imagen
      InteractiveViewer(
        boundaryMargin: const EdgeInsets.all(double.infinity),
        child: Container(
          width: 200,
          height: 200,
          decoration:
              BoxDecoration(shape: BoxShape.circle, color: Colors.black),
        ),
        minScale: 0.4,
        maxScale: 4,
        constrained: false,
      ),
      Align(
        alignment: Alignment.center,
        child: Container(
            width: 200,
            height: 200,
            decoration: BoxDecoration(
                shape: BoxShape.circle,
                color: const Color.fromRGBO(255, 8, 0, 160))),
      ),
    ],
  ),
);

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.