我想使文本小部件成为Flutter上的Flex End。
这里是我的代码:
return MaterialApp(
title: 'Nature',
home: Scaffold(
appBar: AppBar(
title: Text('John Doe'),
),
body: Center(
child: Text('Copyright © 2020'),
),
),
我希望我的窗口小部件文本位于底部。
答案 0 :(得分:1)
Text()
return MaterialApp(
title: 'Nature',
home: Scaffold(
appBar: AppBar(
title: Text('John Doe'),
),
body: Align(
alignment: Alignment.bottomCenter,
child: Text('Copyright © 2020'),
),
),
);
Text()
位于底部,数据显示在屏幕上return MaterialApp(
title: 'Nature',
home: Scaffold(
appBar: AppBar(
title: Text('John Doe'),
),
body: ListView(
shrinkWrap: true,
children: [
Container(
height: MediaQuery.of(context).size.height - 50,
// Your Screen Data Here
),
Container(
height: 50,
child: Center(child: Text('Copyright © 2020')),
),
],
),
),
);
答案 1 :(得分:0)
我认为脚手架小部件的底页是在屏幕底部写入任何内容的最佳方法。
Scaffold(
bottomSheet: Container(
child: Text("Copyright © 2020"),
),
body: Container(
....
答案 2 :(得分:0)
请尝试一下...
return MaterialApp(
title: 'Nature',
home: Scaffold(
appBar: AppBar(
title: Text('John Doe'),
),
body: Stack(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Copyright © 2020'),
)),
],
),
),
);