flutter面试

185 阅读1分钟

一般函数形式:

int makeMilkshake() {
    return cows + trampolines;
  }
  
  

胖箭头语法函数:

int makeMilkshake => cows + trampolines;
 
  

getter语法函数:

int get makeMilkshake2 => cows + trampolines;
 
  

解决文字溢出屏幕的方法:使用Expandedwidget来包裹Textwidget css属性:overflow属性

Expanded(
  child: Text(
    personNextToMe,
  ),
),