如何将小部件文本字段放在胸部图像中,就像在照片中的Flutter中那样?

huangapple go评论64阅读模式
英文:

How to put a widget textfield inside the chest image like in the photo flutter?

问题

如何使用堆栈来解决这个问题?

英文:

How can i use stack to solve the problem?

如何将小部件文本字段放在胸部图像中,就像在照片中的Flutter中那样?

答案1

得分: 0

以下是代码的翻译部分:

我正在尝试解决您的问题:

以下是代码:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class TextFieldOnImage extends StatefulWidget {
  const TextFieldOnImage({Key? key}) : super(key: key);

  @override
  State<TextFieldOnImage> createState() => _TextFieldOnImageState();
}

class _TextFieldOnImageState extends State<TextFieldOnImage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Image On Text"),
      ),
      body: Stack(

          children: [
            Image.asset("assets/6lEG8.png"),
            Padding(
                padding: EdgeInsets.only(left: 98,top:150),
                child: Container(
                  height: 40,
                    width: 170,
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: new BorderRadius.circular(10.0),
                    ),
                    child: Padding(
                        padding: EdgeInsets only(left: 15, right: 15, top: 5),
                        child: TextFormField(
                            decoration: InputDecoration(
                              border: InputBorder.none,
                              labelText: '               0              ',
                            ))))),
          ],

    ),
    );
  }
}

视频链接

英文:

I'm Trying to Solve your Problem :

Here is Code:

import &#39;package:flutter/cupertino.dart&#39;;
import &#39;package:flutter/material.dart&#39;;

class TextFieldOnImage extends StatefulWidget {
  const TextFieldOnImage({Key? key}) : super(key: key);

  @override
  State&lt;TextFieldOnImage&gt; createState() =&gt; _TextFieldOnImageState();
}

class _TextFieldOnImageState extends State&lt;TextFieldOnImage&gt; {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(&quot;Image On Text&quot;),
      ),
      body: Stack(

          children: [
            Image.asset(&quot;assets/6lEG8.png&quot;),
            Padding(
                padding: EdgeInsets.only(left: 98,top:150),
                child: Container(
                  height: 40,
                    width: 170,
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: new BorderRadius.circular(10.0),
                    ),
                    child: Padding(
                        padding: EdgeInsets.only(left: 15, right: 15, top: 5),
                        child: TextFormField(
                            decoration: InputDecoration(
                              border: InputBorder.none,
                              labelText: &#39;               0              &#39;,
                            ))))),
          ],

    ),
    );
  }
}

Video Link

huangapple
  • 本文由 发表于 2023年4月13日 16:39:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76003386.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定