英文:
How to put a widget textfield inside the chest image like in the photo flutter?
问题
如何使用堆栈来解决这个问题?
英文:
How can i use stack to solve the problem?
答案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 '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 ',
))))),
],
),
);
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论