webf-native-ui-dev
WebF Native UI Dev
This skill guides the development of custom native UI components for WebF (Web on Flutter). It bridges Flutter widgets to standard HTML custom elements.
Concept
WebF allows you to render HTML/CSS using Flutter's rendering engine. This skill helps you expose complex Flutter widgets as <custom-element> tags usable in HTML.
Workflow
- Create Flutter Widget: Build the widget using standard Flutter code.
- Define Element Class: Create a class extending
WidgetElement. - Register Custom Element: Use
defineCustomElementto map the tag name to the class.
Example
import 'package:webf/webf.dart';
import 'package:flutter/material.dart';
// 1. Define the Element
class FlutterButtonElement extends WidgetElement {
FlutterButtonElement(BindingContext? context) : super(context);
Widget build(BuildContext context, List<Widget> children) {
return ElevatedButton(
onPressed: () {
// Dispatch custom event to JS
dispatchEvent(Event('click'));
},
child: Text(getAttribute('label') ?? 'Click Me'),
);
}
}
// 2. Register (usually in main.dart)
void main() {
WebF.defineCustomElement('flutter-button', (context) => FlutterButtonElement(context));
runApp(MyApp());
}
Usage in HTML
<flutter-button label="Submit Order" id="btn"></flutter-button>
<script>
document.getElementById('btn').addEventListener('click', () => {
console.log('Button clicked via Flutter!');
});
</script>
Best Practices
- Attributes: Map HTML attributes to Widget properties.
- Events: Dispatch standard DOM events from Flutter user interactions.
- Performance: Avoid heavy computations in the
buildmethod; use state management.
More from first-fluke/fullstack-starter
fastapi-router-creator
Guide for creating and organizing FastAPI routes using a file-based routing system or modular router pattern. Helps organize complex API structures.
46component-refactoring
Refactor high-complexity React components. Use when complexity metrics are high or to split monolithic UI.
33ui-ux-pro-max
Advanced design intelligence for professional UI/UX. Use for implementing modern design patterns (Glassmorphism, Bento Grid), ensuring accessibility, and generating tailored design systems for web and mobile.
26frontend-code-review
Standardized checklist and process for reviewing frontend code (.tsx, .ts, .js).
23frontend-engineer
Develop production-grade frontend code using shadcn/ui, best practices, and strict design alignment.
17skill-lookup
Discover, retrieve, and learn about available Agent Skills. key capability for finding tools to solve specific problems.
16