English 中文(简体)
如何在使用图像坐标的液晶中准确展示图像?
原标题:How to position an image precisely on a background image in Flutter using image coordinates?

我试图利用动态图像坐标和增加动态图像规模值,在另一个图像之上传播图像。 我雇用了一名Stack人,作为父母的植被,有两个形象的植被是儿童。 然而,我面临着使其立场和规模准确一致的挑战。

我附上背景图谱。 我需要把另一个形象放在白色空间上。

背景图

“entergraph

第二版图:

“enterography

图像坐标:-

{
  img_width: 540,  
       img_height: 960,  
       image_coordinates: { 
       width_in_px: 280,  
       height_in_px: 398,  
       top_in_px: 405,  
       left_in_px: 173,  
       width: 51.85,  
       height: 41.46,  
       top: 62.92,  
       left: 57.97,  
       type: box}
}
import  package:flutter/cupertino.dart ;
import  package:flutter/material.dart ;

class EditActivity extends StatefulWidget{
  @override
  _EditActivity createState() => new _EditActivity();
}

class _EditActivity extends State<EditActivity> {

  String image =  https://lh3.googleusercontent.com/a/ACg8ocKeSe_PhCD8mS7RySGmfDcwAcnHbiEXEk5fv4G2fTqbce4=s576-c-no ;
  String bgImage =  https://files.verbs.world/2023/11/13/19/Zf13UiLP8.PNG ;

  String coordinates =   
       img_width: 540,  
       img_height: 960,  
       image_coordinates: { 
       width_in_px: 280,  
       height_in_px: 398,  
       top_in_px: 405,  
       left_in_px: 173,  
       width: 51.85,  
       height: 41.46,  
       top: 62.92,  
       left: 57.97,  
       type: box} ;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      body: Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        child: Stack(
          children: [
            
            Container(
              width: 540,
              height: 960,
              child: Image.network(bgImage,fit: BoxFit.fitWidth,),
            ),
            Positioned(left: 173,top: 408 ,child: Container(
              color: Colors.amber,
              width: 280,
              height: 398,
              alignment: Alignment.center,
              child: Image.network(image,fit: BoxFit.cover,width: 280,
                height: 398,
              ),
            ),)

          ],
        ),
      ),
    );
  }
}

我试图利用动态图像坐标和增加动态图像规模值,在另一个图像之上传播图像。 我雇用了一名Stack人,作为父母的植被,有两个形象的植被是儿童。 然而,我面临着使其立场和规模准确一致的挑战。

问题回答

改变位置,把胎带走到屋顶上,然后把图像放在底部,使图像更适合你。

class EditActivity extends StatefulWidget {
  const EditActivity({super.key});

  @override
  _EditActivity createState() => _EditActivity();
}

class _EditActivity extends State<EditActivity> {
  String image =
       https://lh3.googleusercontent.com/a/ACg8ocKeSe_PhCD8mS7RySGmfDcwAcnHbiEXEk5fv4G2fTqbce4=s576-c-no ;
  String bgImage =  https://files.verbs.world/2023/11/13/19/Zf13UiLP8.PNG ;

  String coordinates =   
       img_width: 540,  
       img_height: 960,  
       image_coordinates: { 
       width_in_px: 280,  
       height_in_px: 398,  
       top_in_px: 405,  
       left_in_px: 173,  
       width: 51.85,  
       height: 41.46,  
       top: 62.92,  
       left: 57.97,  
       type: box} ;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      body: SizedBox(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        child: Stack(
          children: [
            Padding(
              padding: const EdgeInsets.only(
                left: 92,
                top: 240,
              ),
              child: Center(
                child: Container(
                  color: Colors.amber,
                  width: 280,
                  height: 398,
                  alignment: Alignment.center,
                  child: Image.network(
                    image,
                    fit: BoxFit.cover,
                    width: 280,
                    height: 398,
                  ),
                ),
              ),
            ),
            Center(
              child: SizedBox(
                width: 540,
                height: 960,
                child: Image.network(
                  bgImage,
                  fit: BoxFit.fitWidth,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}




相关问题
Having many stacks with different types

I m making a C program that needs to use two stacks. One needs to hold chars, the other needs to hold doubles. I have two structs, node and stack: struct node { double value; struct node *...

定型语言是否具有范围概念?

定型语言是否具有范围概念? 在我看来,如果职能参数被放在职能执行之前的位置上,这些参数就会以不正统的方式出现。

Stack memory fundamentals

Consider this code: char* foo(int myNum) { char* StrArray[5] = {"TEST","ABC","XYZ","AA","BB"}; return StrArray[4]; } When I return StrArray[4] to the caller, is this supposed to work? ...

negative number in the stack

I am a new student in the compilers world ^_^ and I want to know is legal represent negative number in the stack. For example: infix: 1-5=-4 postfix: 15- The statements are: push(1) push(5) x=...

热门标签