1

【笔记】Flutter 的 Padding 边距组件

 10 months ago
source link: https://loli.fj.cn/2023/06/25/Flutter%E7%9A%84Padding%E8%BE%B9%E8%B7%9D%E7%BB%84%E4%BB%B6/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

【笔记】Flutter 的 Padding 边距组件

2023-06-25 2023-06-26Flutter 学习指北

Flutter 的 Padding 边距组件学习笔记

Padding 边距组件

  • Padding 组件的功能比较单一,只能在四周添加间距
  • 如果只是希望添加间距,直接使用 Padding 组件要比使用 Container 组件添加 padding 属性节省内存
import 'package:flutter/material.dart';

void main() {
runApp(MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text("文本内容"),
),
body: const App(),
),
));
}

class App extends StatelessWidget {
const App({super.key});

@override
Widget build(BuildContext context) {
return const Padding(
padding: EdgeInsets.all(10),
);
}
}

哔哩哔哩 —— 筱筱知晓


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK