我寫這個原因是不想一行代碼太長,也每次都寫 某一個 上信峻、下、左盹舞、右等,覺得你能用到你就拿過去用吧踢步。
純屬個人愛好寫的
代碼如下:
/// 上邊 間距
insetT(double t) => EdgeInsets.only(top: t);
/// 左邊 間距
insetL(double l) => EdgeInsets.only(left: l);
/// 右邊 間距
insetR(double r) => EdgeInsets.only(right: r);
/// 下邊 間距
insetB(double b) => EdgeInsets.only(bottom: b);
/// 左、上 間距
insetLT(double l, double t) => EdgeInsets.only(left: l, top: t);
/// 右获印、上 間距
insetRT(double r, double t) => EdgeInsets.only(right: r, top: t);
/// 左、右 間距
insetLR(double l, double r) => EdgeInsets.only(left: l, right: r);
/// 上兼丰、下 間距
insetTB(double t, double b) => EdgeInsets.only(top: t, bottom: b);
/// 左玻孟、下 間距
insetLB(double l, double b) => EdgeInsets.only(left: l, bottom: b);
/// 右鳍征、下 間距
insetRB(double r, double b) => EdgeInsets.only(right: r, bottom: b);
/// 上黍翎,下艳丛、左 間距
insetTBL(double t, double b, double l) =>
EdgeInsets.only(left: l, top: t, bottom: b);
/// 上,下质礼、右 間距
insetTBR(double b, double r, double t) =>
EdgeInsets.only(bottom: b, right: r, top: t);
/// 左旺聚,右眶蕉、上 間距
insetLRT(double l, double r, double t) =>
EdgeInsets.only(left: l, right: r, top: t);
/// 左唧躲,右造挽、下 間距
insetLRB(double l, double r, double b) =>
EdgeInsets.only(left: l, right: r, bottom: b);
/// 圓弄痹、邊框饭入、顏色
circleDecoration(
double r,
double w,
Color color, [
Color bgColor,
]) =>
BoxDecoration(
color: bgColor ?? Colors.transparent,
borderRadius: BorderRadius.circular(r),
border: Border.all(width: w, color: color),
);
其它Flutter 封裝:
Text 傳送門一
Container 傳送門二
隨機顏色:傳送門三
謝謝~