我想讓我的列文本居中,我也想改變我的對話框背景顏色。這個怎么做。
我想讓我的列文本居中,我也想改變我的對話框背景顏色。這個怎么做。
這是我的對話框代碼。
import 'package:bellaz/Extension/AppColor.dart';
import 'package:bellaz/Utils/Constants.dart';
import 'package:flutter/material.dart';
class LocationDialog extends StatelessWidget {
dialogContent(BuildContext context) {
return Container(
padding: EdgeInsets.all(10),
decoration: new BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 10.0,
offset: const Offset(0.0, 10.0),
),
],
),
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, // To make the card compact
children: <Widget>[
SizedBox(height: 20,),
Image.asset(
"lib/Assets/searchYellow.png",
height: 50,
width: 50,
),
Align(
alignment: Alignment.center,
child: Text(
"Device location is not enabled",
style: TextStyle(
fontSize: t2Size,
fontWeight: FontWeight.w600,
),
),
),
SizedBox(height: 16.0),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Please enable device location to ensure accurate nearby salons location for easy search",
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: t3Size,
color: extraLightColor),
),
],
),
SizedBox(height: 24.0),
Container(
padding: EdgeInsets.symmetric(vertical: 14),
decoration: BoxDecoration(color: appGreenColor,
borderRadius: BorderRadius.circular(5),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.my_location_rounded,
color: Colors.white,
),SizedBox(width: 7,),
Text(
'Enable Device Location',
style: TextStyle(color: Colors.white,fontSize: t3Size),
)
],
),
),
SizedBox(height: 4.0),
Container(
padding: EdgeInsets.symmetric(vertical: 14),
decoration: BoxDecoration(color: Colors.white,
borderRadius: BorderRadius.circular(5),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"lib/Assets/searchYellow.png",
height: 23,
width: 23,
),
SizedBox(width: 7,),
Text(
'Enter Location Manually',
style: TextStyle(color: appYellowColor),
)
],
),
),
SizedBox(height: 20.0),
],
),
);
}
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
elevation: 0.0,
backgroundColor: ,
child: dialogContent(context),
);
}
}
如何將此文本居中,我還想更改透明顯示的背景顏色

這是我的實際用戶界面,我想做這樣的

這對我來說是作業。
Text("Please enable device location to ensure accurate nearby salons locatio for easy search",
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 22,
color: Colors.blue),
textAlign: TextAlign.center,
),
uj5u.com熱心網友回復:
=> 你必須添加 textAlign: TextAlign.center 這行所有文本小部件你可以看到下面的例子。
前任 :
Text("Please enable device location to ensure accurate nearby salons locatio for easy search",
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 22,
color: Colors.blue),
textAlign: TextAlign.center,
),
uj5u.com熱心網友回復:
嘗試洗掉您的第二個列小部件并給出 TextAlign.center

uj5u.com熱心網友回復:
Text("Please enable device location to ensure accurate nearby salons locatio for easy search",
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 22,
color: Colors.blue),
textAlign: TextAlign.center,
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/380697.html
