| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
本项目提供了αLab组件库的示例,以下是向项目添加新组件说明的步骤:
在 menu.dart 文件中,找到 _treeItems 列表,并添加一个新的 TreeNode 项。示例如下:
TreeNode(
title: '新组件名称',
routeName: '/newComponent',
builder: (context) => const NewComponentExample(),
),title 是组件的名称,routeName 是路由名称,builder 是对应的组件示例页面。
在 example/lib/page 文件夹中,创建一个新的 Dart 文件,例如 new_component_example.dart,并实现组件的示例代码。示例如下:
import 'package:flutter/material.dart';
class NewComponentExample extends StatelessWidget {
const NewComponentExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('新组件示例'),
),
body: const Center(
child: Text('这是新组件的示例页面'),
),
);
}
}项目中提供了一些组件,使构建组件说明更加容易
可以参考 demo 文件夹中的示例:
| Back | FazBrowse Home | New Git URL |