dash_kit_uikit 3.0.0-dev.1
dash_kit_uikit: ^3.0.0-dev.1 copied to clipboard
The dash component for creation of your own UI component library.
Flutter UIKit #
Flutter library for showing all widgets states
How to use #
Create a builder for a custom widget and include in it all the states of the widget that you want to show in the UIKit:
class TextUiKitBuilder extends UiKitBuilder {
@override
Type get componentType => Text;
@override
void buildComponentStates() {
build('Black text', const Text('Hello world!'));
build(
'Grey text',
const Text(
'Hello world!',
style: TextStyle(color: Colors.grey),
),
);
}
}
When you are using UIKit place builders in the files with a name like <widget name>.uikit.dart
, example: text.uikit.dart
.
Register groups widgets in the UIKit:
void configureUiKit() {
UiKit.register(
() => [
UiComponentGroup('Text widgets', [
TextUiKitBuilder(),
]),
UiComponentGroup('Button widgets', [
FlatButtonUiKitBuilder(),
]),
],
);
}
Use configureUiKit()
in main.dart
:
void main() {
configureUiKit();
runApp(MyApp());
}
Use UIKitPage()
in the place you need:
@override
Widget build(BuildContext context) {
eturn MaterialApp(
title: 'UIKit Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: UiKitPage(),
);
}
you can use componentWithPadding
if neaded:
UiKitPage(componentWithPadding: true)
You can also see the example project