【发布时间】:2023-02-10 15:50:26
【问题描述】:
我希望文本和图标在正文中的一个小部件下排成一行。我试过了,但出现以下错误
位置参数太多,预期为 0,但收到了 1
谁能帮我这个?提前致谢!
void main() => runApp(const Myapp()); class Myapp extends StatefulWidget { const myapp({Key? key}) : super(key: key); _MyappState createState() => _MyappState(); } class _MyappState extends State<Myapp> { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( body: Padding( padding: EdgeInsets.only(top: 30), child: Stack( alignment: AlignmentDirectional.center, children: <Widget>[ /** Positioned WIdget **/ Positioned( top: 0.0, child: Image.asset( 'images/logo.png', height: 150, width: 150, ), ), //Positioned /** Positioned WIdget **/ //Positioned ], //<Widget>[] ), //Stack ), Text.rich( TextSpan( children: [ TextSpan(text: 'Click'), WidgetSpan(child: Icon(Icons.add)), TextSpan(text: 'to add'), ], ), ) ), ); } }
【问题讨论】:
-
您在哪一行/小部件中遇到错误?
标签: flutter flutter-web-browser