视频学习地址:https://www.bilibili.com/video/BV1S4411E7LY?p=31&vd_source=cee744cae4ead27f8193fc7904647073
学习笔记
1.自定义一个button,并用wrap展示
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({
Key? key}) : super(key: key);
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primarySwatch: Colors.blue),
home: Scaffold(
appBar: AppBar(
title: const Text("Flutter Demo"),
),
body: MyHomePage(),
),
);
}
}
class MyHomePage extends StatelessWidget {
Widget build(BuildContext context) {
return Wrap(
children: [
Button("第1集", onPressed: () {
}),
Button("第2集", onPressed: () {
}),
Button("第3集", onPressed: () {
}),
Button("第4集", onPressed: () {
}),
Button("第5集", onPressed: () {
}),
Button("第6集"
Flutter Wrap布局优化与按钮垂直排列实践

最低0.47元/天 解锁文章
2028

被折叠的 条评论
为什么被折叠?



