Flutter 如何为颤振中的文本设置右边距值?
我有一个卡片视图如下 在这里,红色文本行有2个Flutter 如何为颤振中的文本设置右边距值?,flutter,Flutter,我有一个卡片视图如下 在这里,红色文本行有2个text字段。我想在卡片右侧和右侧的文本字段之间保留一个空格(与黑色文本行完全相同)。下面是我的实现。我怎样才能做到这一点?提前谢谢 Container( margin: const EdgeInsets.only(top: 20.0), child: Center( child: Align( alignment: Alignment.topCenter,
text
字段。我想在卡片右侧和右侧的文本
字段之间保留一个空格(与黑色文本行完全相同)。下面是我的实现。我怎样才能做到这一点?提前谢谢
Container(
margin: const EdgeInsets.only(top: 20.0),
child: Center(
child: Align(
alignment: Alignment.topCenter,
child: Card(
child: InkWell(
splashColor: Colors.blue.withAlpha(30),
onTap: (){
print('Card Tapped');
},
child: Container(
width: 380,
height: 140,
child: Align(
alignment: Alignment.centerLeft,
child: new Column(
children : <Widget>[
Container(
margin: const EdgeInsets.only(left: 25, top: 25),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Account Number',
textAlign: TextAlign.left,
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15, color: Colors.redAccent),
),
// Spacer(flex: 1),
Text('12345678',
textAlign: TextAlign.right,
textDirection: TextDirection.rtl,
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15, color: Colors.redAccent),) //<------- This text field should keep a space from right
],
),
),
Container(
margin: const EdgeInsets.only(left: 25, top: 15),
alignment: Alignment.centerLeft,
child: Text('Available Amount LKR 1200.00', //<------- I will re-implement these too in a Row once I figure out this
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),
),
),
Container(
margin: const EdgeInsets.only(right: 21, top: 15),
alignment: Alignment.centerRight,
child: Text('Active',
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),
),
),
],
),
),
),
),
),
),
)
),
容器(
边距:仅限常量边集(顶部:20.0),
儿童:中心(
子对象:对齐(
对齐:alignment.topCenter,
孩子:卡片(
孩子:InkWell(
飞溅颜色:颜色。蓝色。带有alpha(30),
onTap:(){
打印(“卡片点击”);
},
子:容器(
宽度:380,
身高:140,
子对象:对齐(
对齐:alignment.centerLeft,
子:新列(
儿童:[
容器(
边距:仅限常量边集(左:25,上:25),
对齐:alignment.centerLeft,
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
文本('账号',
textAlign:textAlign.left,
样式:TextStyle(fontWeight:fontWeight.bold,fontSize:15,颜色:color.redAccent),
),
//垫片(挠性:1),
文本('12345678',
textAlign:textAlign.right,
textDirection:textDirection.rtl,
style:TextStyle(fontwweight:fontwweight.bold,fontSize:15,color:Colors.redAccent),/你做得对。你只需要一个填充字段:
Container(
THIS -------------> padding: EdgeInsets.only(left: 20, right: 20),
margin: const EdgeInsets.only(left: 25, top: 25),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Account Number',
textAlign: TextAlign.left,
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15, color: Colors.redAccent),
),
Text('12345678',
textAlign: TextAlign.right,
textDirection: TextDirection.rtl,
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15, color: Colors.redAccent),) //<------- This text field should keep a space from right
],
),
),
容器(
此----------------->填充:边设置。仅限(左:20,右:20),
边距:仅限常量边集(左:25,上:25),
对齐:alignment.centerLeft,
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
文本('账号',
textAlign:textAlign.left,
样式:TextStyle(fontWeight:fontWeight.bold,fontSize:15,颜色:color.redAccent),
),
文本('12345678',
textAlign:textAlign.right,
textDirection:textDirection.rtl,
样式:TextStyle(fontWeight:fontWeight.bold,fontSize:15,颜色:Colors.redAccent),/添加右边框,如下所示
margin: const EdgeInsets.only(left: 25, top: 25, right: 25),
代码:
Container(
margin: const EdgeInsets.only(left: 25, top: 25, right: 25),
alignment: Alignment.centerLeft,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Account Number',
textAlign: TextAlign.left,
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15, color: Colors.redAccent),
),
// Spacer(flex: 1),
Text('12345678',
textAlign: TextAlign.right,
textDirection: TextDirection.rtl,
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15, color: Colors.redAccent),) //<------- This text field should keep a space from right
],
),
),
容器(
边距:仅限常量边集(左:25,上:25,右:25),
对齐:alignment.centerLeft,
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
文本('账号',
textAlign:textAlign.left,
样式:TextStyle(fontWeight:fontWeight.bold,fontSize:15,颜色:color.redAccent),
),
//垫片(挠性:1),
文本('12345678',
textAlign:textAlign.right,
textDirection:textDirection.rtl,
样式:TextStyle(fontWeight:fontWeight.bold,fontSize:15,颜色:Colors.redAccent),)//