[英]Place Flutter widget with custom shape perfectly in another widget
要使小部件具有響應性,您可以使用MediaQuery.of(context).size.width
以像素為單位獲取屏幕寬度,例如,如果乘以 0.7,它將占據屏幕的 70%。
//square widget 1:1
SizedBox(
child: SvgPicture.asset('lib/your.svg'),
width: MediaQuery.of(context).size.width * 0.7,
height: MediaQuery.of(context).size.width * 0.7,
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.