widgetbook 0.0.16 widgetbook: ^0.0.16 copied to clipboard
A flutter storybook that helps professionals and teams to catalogue their widgets.
import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
class CustomWidget extends StatelessWidget {
const CustomWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.green,
child: const Text('hello world'),
);
}
}
class HotReload extends StatelessWidget {
const HotReload({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Widgetbook(
categories: [
Category(
name: 'widgets',
widgets: [
WidgetElement(
name: '$CustomWidget',
stories: [
Story(
name: 'Default',
builder: (context) => const CustomWidget(),
),
],
),
],
folders: [
Folder(
name: 'Texts',
widgets: [
WidgetElement(
name: 'Normal Text',
stories: [
Story(
name: 'Default',
builder: (context) => const Text(
'The brown fox ...',
),
),
],
),
],
),
],
),
],
appInfo: AppInfo(
name: 'Widgetbook Example',
),
);
}
}
void main() {
runApp(const HotReload());
}