上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页
摘要: 在Flutter中自定义组件其实就是一个类,这个类需要继承StatelessWidget/StatefulWidget。 StatelessWidget是无状态组件,状态不可变的widget StatefulWidget是有状态组件,持有的状态可能在widget生命周期改变。 通俗的讲:如果我们想改 阅读全文
posted @ 2023-11-23 16:23 鲤斌 阅读(44) 评论(0) 推荐(0)
摘要: Wrap可以实现流布局,单行的Wrap跟Row表现几乎一致,单列的Wrap则跟Column表现几乎一致。但 Row与Column都是单行单列的,Wrap则突破了这个限制,mainAxis上空间不足时,则向crossAxis上 去扩展显示。 Wrap组件的使用 //自定义按钮组件 class MyAp 阅读全文
posted @ 2023-11-22 10:13 鲤斌 阅读(183) 评论(0) 推荐(0)
摘要: 按钮组件的属性 ButtonStylee里面的常用的参数 ElevatedButton ElevatedButton 即"凸起"按钮,它默认带有阴影和灰色背景。按下后,阴影会变大 class MyApp extends StatelessWidget { const MyApp({super.key 阅读全文
posted @ 2023-11-21 13:40 鲤斌 阅读(195) 评论(0) 推荐(0)
摘要: Card是卡片组件块,内容可以由大多数类型的Widget构成,Card具有圆角和阴影,这让它看起来有立 体感。 Card实现一个通讯录的卡片 class MyApp2 extends StatelessWidget { const MyApp2({super.key}); @override Wid 阅读全文
posted @ 2023-11-20 11:20 鲤斌 阅读(335) 评论(0) 推荐(0)
摘要: AspectRatio的作用是根据设置调整子元素child的宽高比。 childAspectRatio 是 GridView 和 AspectRatio 控件中的一个参数 AspectRatio首先会在布局限制条件允许的范围内尽可能的扩展,widget的高度是由宽度和比率决定 的,类似于BoxFit 阅读全文
posted @ 2023-11-20 10:15 鲤斌 阅读(329) 评论(0) 推荐(0)
摘要: Flutter Stack组件 Stack表示堆的意思,我们可以用Stack或者Stack结合Align或者Stack结合 Positiond来实现页面的定位 布局 Alignment(对齐)类是用于表示相对于父容器的对齐方式的; Alignment 类的常见用法: Alignment.topLef 阅读全文
posted @ 2023-11-17 21:06 鲤斌 阅读(394) 评论(0) 推荐(0)
摘要: 自定义的IconContainer class IconContainer extends StatelessWidget { Color color; IconData icon; // IconContainer(this.icon ,{super.key,required this.color 阅读全文
posted @ 2023-11-16 19:43 鲤斌 阅读(39) 评论(0) 推荐(0)
摘要: 自定义的IconContainer void main() { runApp(MaterialApp( theme: ThemeData(primarySwatch: Colors.yellow), home: Scaffold( appBar: AppBar(title: const Text(" 阅读全文
posted @ 2023-11-16 18:53 鲤斌 阅读(108) 评论(0) 推荐(0)
摘要: Padding组件处理容器与子元素之间的间距。 class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return Containe 阅读全文
posted @ 2023-11-16 10:46 鲤斌 阅读(23) 评论(0) 推荐(0)
摘要: GridView创建网格列表主要有下面三种方式 1、可以通过GridView.count 实现网格布局 一行的 Widget 数量 class HomePage extends StatelessWidget { const HomePage({Key? key}) : super(key: key 阅读全文
posted @ 2023-11-15 18:52 鲤斌 阅读(752) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页