SeoScaffold class
A Scaffold-like widget designed for Flutter Web that automatically
injects SEO-friendly HTML meta tags and semantic HTML structure into the DOM.
SeoScaffold behaves like Flutter's standard Scaffold
but adds the ability to:
- Inject
<title>and<meta>tags into the document's<head> - Add Open Graph meta tags for social sharing
- Include canonical URLs for SEO optimization
- Render semantic HTML tags (
<header>,<main>,<footer>) alongside Flutter widgets
This widget should be used only for web builds (kIsWeb == true).
Example usage:
SeoScaffold(
metaTitle: 'My Page Title',
metaDescription: 'A description for SEO purposes',
metaKeywords: 'kyewords for SEO purpose',
canonicalUrl: 'https://example.com/my-page',
ogTitle: 'Open Graph Title',
ogDescription: 'Open Graph Description',
ogImageLink: 'https://example.com/image.jpg',
appBar: SeoAppBar(),
body: SeoText('Hello World'),
footer: SeoFooter(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- SeoScaffold
Constructors
- SeoScaffold({Key? key, required String metaTitle, SeoInjectableLayout? appBar, required Widget body, Color? backgroundColor, Widget? floatingActionButton, FloatingActionButtonLocation? floatingActionButtonLocation, FloatingActionButtonAnimator? floatingActionButtonAnimator, Widget? drawer, void onDrawerChanged(bool)?, Widget? endDrawer, void onEndDrawerChanged(bool)?, String? metaDescription, String? metaKeywords, String? canonicalUrl, String? ogTitle, String? ogImageLink, String? ogDescription})
-
Creates a SeoScaffold with optional parameters.
const
Properties
- appBar → SeoInjectableLayout?
-
Optional AppBar widget that also supports HTML injection.
final
- backgroundColor → Color?
-
Scaffold background color.
final
- body → Widget
-
Main content of the page.
final
-
Optional bottom navigation bar that supports HTML injection.
final
- canonicalUrl → String?
-
Canonical URL for SEO (
<link rel="canonical">).final - drawer → Widget?
-
Optional navigation drawer.
final
- endDrawer → Widget?
-
Optional end drawer (right side).
final
- floatingActionButton → Widget?
-
Optional floating action button.
final
- floatingActionButtonAnimator → FloatingActionButtonAnimator?
-
Animation behavior for the floating action button.
final
- floatingActionButtonLocation → FloatingActionButtonLocation?
-
Position for the floating action button.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- metaDescription → String?
-
<meta name="description">content.final - metaKeywords → String?
-
<meta name="keywords">content.final - metaTitle → String
-
The
<title>tag content for the page.final - ogDescription → String?
-
<meta property="og:description">Open Graph tag content.final - ogImageLink → String?
-
<meta property="og:image">Open Graph tag content.final - ogTitle → String?
-
<meta property="og:title">Open Graph tag content.final - onDrawerChanged → void Function(bool)?
-
Callback when the drawer state changes.
final
- onEndDrawerChanged → void Function(bool)?
-
Callback when the end drawer state changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
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