Skip to main content

material_hooks 0.1.0 copy "material_hooks: ^0.1.0" to clipboard
material_hooks: ^0.1.0 copied to clipboard

Flutter hooks for the Material Design library (package:material_ui).

material_hooks #

flutter_hooks for material_ui.

Since Flutter 3.47, package:flutter/material.dart is deprecated in favor of package:material_ui. This package provides hooks for the controllers of package:material_ui:

Name Description
useTabController Creates and disposes a TabController.
useSearchController Creates and disposes a SearchController.
useCarouselController Creates and disposes a CarouselController.

Usage #

Import material_hooks alongside flutter_hooks:

import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:material_hooks/material_hooks.dart';
import 'package:material_ui/material_ui.dart';

While flutter_hooks still contains the deprecated versions of these hooks, using one of them in a file that imports both packages is ambiguous. Hide the deprecated version from flutter_hooks:

import 'package:flutter_hooks/flutter_hooks.dart' hide useCarouselController, useSearchController, useTabController;

Migrating from flutter_hooks #

The hooks listed above used to be part of flutter_hooks and returned controllers from package:flutter/material.dart. Those versions are deprecated.

To migrate:

  1. Add material_hooks and material_ui to your dependencies.
  2. Replace package:flutter/material.dart imports with package:material_ui/material_ui.dart.
  3. Import package:material_hooks/material_hooks.dart in files using these hooks, and hide them from the flutter_hooks import as shown above.
0
likes
150
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter hooks for the Material Design library (package:material_ui).

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, flutter_hooks, material_ui

More

Packages that depend on material_hooks