Reference

Hooks

First-class Flutter Hooks integration with Forui controllers.

Forui provides first class integration with Flutter Hooks. All controllers are exposed as hooks in the companion forui_hooks package.

Installation

From your Flutter project directory, run the following command to install flutter_hooks and forui_hooks.

flutter pub add flutter_hooks
flutter pub add forui_hooks

Usage

To use Forui hooks in your Flutter app, import the forui_hooks package and initialize a hook inside a HookWidget.

1import 'package:flutter/widgets.dart';
2
3import 'package:flutter_hooks/flutter_hooks.dart';
4import 'package:forui/forui.dart';
5import 'package:forui_hooks/forui_hooks.dart';
6
7
8class Example extends HookWidget {
9 @override
10 Widget build(BuildContext _) {
11 final controller = useFAccordionController();
12 return FAccordion(
13 control: .managed(controller: controller),
14 children: const [
15 FAccordionItem(
16 title: Text('Production Information'),
17 child: Text(
18 'Our flagship product combines cutting-edge technology with sleek design. '
19 'Built with premium materials, it offers unparalleled performance and '
20 'reliability.\n'
21 'Key features include advanced processing capabilities, and an intuitive '
22 'user interface designed for both beginners and experts.',
23 ),
24 ),
25 FAccordionItem(
26 initiallyExpanded: true,
27 title: Text('Shipping Details'),
28 child: Text(
29 'We offer worldwide shipping through trusted courier partners. '
30 'Standard delivery takes 3-5 business days, while express shipping '
31 'ensures delivery within 1-2 business days.\n'
32 'All orders are carefully packaged and fully insured. Track your'
33 ' shipment in real-time through our dedicated tracking portal.',
34 ),
35 ),
36 FAccordionItem(
37 title: Text('Return Policy'),
38 child: Text(
39 'We stand behind our products with a comprehensive 30-day return policy. '
40 "If you're not completely satisfied, simply return the item in its "
41 'original condition.\n'
42 'Our hassle-free return process includes free return shipping and full '
43 'refunds processed within 48 hours of receiving the returned item.',
44 ),
45 ),
46 ],
47 );
48 }
49}
50

On this page