如果我有一个想要简化的复杂布局,Android Studio(或IntelliJ)中将小部件提取到方法中的快捷方式是什么?
例子:
我想提取堆栈中的三个主要小部件.
class BodyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/image.jpg'),
fit: BoxFit.cover,
),
),
),
Align(
alignment: Alignment(-0.7, -0.7),
child: Container(
height: 300,
child: RichText(
text: TextSpan(
text: 'My text',
style: TextStyle(
color: Colors.white70,
fontSize: 30,
),
),
),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Text(
'Some other text',
style: TextStyle(
color: Colors.white70,
fontSize: 20.0,
fontWeight: FontWeight.w900,
letterSpacing: 5.0,
),
),
),
],
);
}
}
我可以用手做,但我在找一条近路.