MvcWidget<TControllerType extends MvcController> mixin
Mvc framework widget
Don't use this class directly, use MvcStatelessWidget or MvcStatefulWidget instead.
Can be update by MvcController.$ if extends MvcStatelessWidget or MvcStatefulWidget.
Example:
class MyWidget extends MvcStatelessWidget {
const MyWidget({required this.title, super.key, super.id, super.classes});
final String title;
@override
Widget build(BuildContext context) {
return Text(title);
}
}
// In the controller
class MyController extends MvcController {
void updateMyWidget() {
$<MyWidget>().update(() => title = "MyWidget Title Updated");
}
}
// In the view
class MyView extends MvcView {
@override
MvcViewBuilder build(BuildContext context) {
return MyWidget(title: controller.title);
}
}
Also can be update by MvcController.$ if MvcWidget.id or MvcWidget.classes be set.
Example:
class MyWidget extends MvcStatelessWidget {
const MyWidget({required this.title, super.key, super.id, super.classes});
final String title;
@override
Widget build(BuildContext context) {
return Text(title);
}
}
// In the controller
class MyController extends MvcController {
String title = "MyWidget Title";
void updateMyWidget() {
$("#my-widget").update(() => title = "MyWidget Title Updated");; // or $(".my-widget").update(() => title = "MyWidget Title Updated");;
}
}
// In the view
class MyView extends MvcView {
@override
MvcViewBuilder build(BuildContext context) {
return MyWidget(title: controller.title, id: "my-widget", classes: ["my-widget"]);
}
}
- Superclass constraints
- Mixin applications
Properties
Methods
-
createElement(
) → Element -
Inflates this configuration to a concrete instance.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited