demoflu 1.0.0 demoflu: ^1.0.0 copied to clipboard
Package demo builder. Web application to display package widgets usage.
DemoFlu #
Package demo builder. Web application to display package widgets usage.
Tutorial #
main.dart #
Use the DemoFluApp
configuring menu and examples.
import 'package:demoflu/demoflu.dart';
import 'package:flutter/material.dart';
import 'package:tutorial/examples/stateless.dart';
void main() {
runApp(DemoFluApp(title: 'Tutorial', menuItems: [
DemoMenuItem(name: 'Section'),
DemoMenuItem(name: 'Stateless', example: StatelessExample(), indent: 2)
]));
}
Or formatted using cascade notation
runApp(DemoFluApp(title: 'Tutorial', menuItems: _menuItems()));
List<DemoMenuItem> _menuItems() {
var builder = DemoMenuItem.builder();
builder
..indent(1)
..add('Section')
..indent(2)
..add('Stateless', example: StatelessExample());
return builder.menuItems;
}
Examples #
Create examples using your package.
import 'package:demoflu/demoflu.dart';
import 'package:flutter/material.dart';
class StatelessExample extends Example {
StatelessExample()
: super(
widget: const MainWidget(),
codeFile: 'lib/examples/stateless.dart',
resizable: true);
}
class MainWidget extends StatelessWidget {
const MainWidget({super.key});
@override
Widget build(BuildContext context) {
return Container(
color: Colors.blue[200], child: const Center(child: Text('Stateless')));
}
}
pubspec.yaml #
Configure the assets to make the source code available.
assets:
- lib/examples/
Build for web #
flutter build web --release
Use
--base-href
if necessary
Need more? #
See the committed example for more details.