我怎么做才能让原material 按钮的大小与我的设备相对.
我想让主页中的按钮具有恒定的宽度,而不管其中的文本有多大,并且该宽度应该与屏幕大小相关.
Container(
margin: EdgeInsets.all(10),
child: FittedBox(
child: RawMaterialButton(
width: 150px,
fillColor: const Color(0xFF411F97),
padding: const EdgeInsets.fromLTRB(50, 10, 50, 10),
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20),)),
child: const Text("San Francisco Area", style: TextStyle(fontSize: 50, color: Colors.white,), textAlign: TextAlign.center,),
//Sends user to weather list view
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => WeatherList(title: "San Francisco Metro Area", cityNames: sfaNames,)),
);
},
),
),
//Box shadow is essentially made here for the botton
decoration: BoxDecoration(
color: Colors.teal,
borderRadius: BorderRadius.circular(20),
boxShadow: const [
BoxShadow(
color: Colors.black26,
offset: Offset(10, 10), // Shadow position
),
],
)
),