iws_help 0.4.1
iws_help: ^0.4.1 copied to clipboard
Add documentation pages and contextual help to widgets using the IWS service.
example/main.dart
import 'package:flutter/material.dart';
import 'package:iws_help/iws_help.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final iwsHelp = IwsHelp();
// If you want to use a custom content builder, set it here
iwsHelp.contentBuilder = (documentaion) {
return Text(documentaion.rawContent ?? 'Help not available');
};
// Load help from server
iwsHelp.loadHelp();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
actions: const [GeneralHelpButton(), SizedBox(width: 10)],
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
HelpIcon(
helpKey: 'money',
fullScreen: false,
child: SizedBox(
width: 200,
child: TextField(
decoration: InputDecoration(labelText: 'Money'),
),
),
),
SizedBox(height: 20),
HelpIcon(
helpKey: 'recovery_pass',
fullScreen: true,
child: SizedBox(
width: 300,
child: FilledButton(
onPressed: null, child: Text('Password recovery'))),
),
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}