demoflu 1.2.0 demoflu: ^1.2.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
to configure the menu.
import 'package:demoflu/demoflu.dart';
import 'package:flutter/material.dart';
import 'package:tutorial/examples/stateless.dart';
void main() {
runApp(DemoFluApp(title: 'Tutorial', rootMenus: [_firstExample, _section]));
}
DemoMenuItem get _firstExample =>
DemoMenuItem('First', example: StatelessExample());
DemoMenuItem get _section =>
DemoMenuItem('Section', children: [_secondExample]);
DemoMenuItem get _secondExample =>
DemoMenuItem('Second', example: StatelessExample());
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 clean
flutter build web --release
Use
--base-href
if necessary
Need more? #
See the committed example for more details.