在此處輸入圖片說明
我正在設計在 Flutter 中具有回應性。我想處理寬度自動,100%,我該怎么做?我已經處理了 double.infinity。
Widget _bottomSubText(subtext) {
return Container(
padding: const EdgeInsets.only(top: 15),
width: 977,
height: 70,
decoration: BoxDecoration(
color: const Color.fromARGB(255, 245, 245, 245),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: const Offset(0, 3),
)
],
),
child: Text(
subtext,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 30),
),
);
}
uj5u.com熱心網友回復:
width: MediaQuery.of(context).size.width在您的容器中使用。
Widget _bottomSubText(subtext) {
return Container(
padding: const EdgeInsets.only(top: 15),
//Set this width, if you want to half of screen multiplied it by 0.5 and so on...
width: MediaQuery.of(context).size.width,
height: 70,
decoration: BoxDecoration(
color: const Color.fromARGB(255, 245, 245, 245),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 3,
blurRadius: 7,
offset: const Offset(0, 3),
)
],
),
child: Text(
subtext,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 30),
),
);
}
uj5u.com熱心網友回復:
通過小部件呼叫包裝您的容器(擴展)
https://api.flutter.dev/flutter/widgets/Expanded-class.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/312897.html
