Skip to main content

aligned_tooltip 0.0.2 copy "aligned_tooltip: ^0.0.2" to clipboard
aligned_tooltip: ^0.0.2 copied to clipboard

A tooltip that shows any widget as content, aligned to its target along any axis, with automatic fallback to the opposite side when space runs out.

example/lib/main.dart

import 'package:example/pages/default_page.dart';
import 'package:example/pages/scroll_page.dart';
import 'package:example/pages/tooltip_area_page.dart';
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData.dark(),
      home: const HomePage(),
      onGenerateRoute: (RouteSettings settings) {
        switch (settings.name) {
          case '':
          case 'default':
            return MaterialPageRoute<void>(
              settings: settings,
              builder: (BuildContext context) => const DefaultPageExample(),
            );
          case 'scroll':
            return MaterialPageRoute<void>(
              settings: settings,
              builder: (BuildContext context) => const ScrollExamplePage(),
            );
          case 'tooltipArea':
            return MaterialPageRoute<void>(
              settings: settings,
              builder: (BuildContext context) => const TooltipAreaExamplePage(),
            );
          default:
            throw UnimplementedError();
        }
      },
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Example app')),
      body: SizedBox.expand(
        child: Column(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              style: ElevatedButton.styleFrom(
                backgroundColor: Colors.amber.shade700,
              ),
              onPressed: () {
                Navigator.of(context).pushNamed('default');
              },
              child: const Text('default'),
            ),
            ElevatedButton(
              style: ElevatedButton.styleFrom(backgroundColor: Colors.blueGrey),
              onPressed: () {
                Navigator.of(context).pushNamed('scroll');
              },
              child: const Text('scroll'),
            ),
            ElevatedButton(
              style: ElevatedButton.styleFrom(backgroundColor: Colors.teal),
              onPressed: () {
                Navigator.of(context).pushNamed('tooltipArea');
              },
              child: const Text('tooltipArea'),
            ),
          ],
        ),
      ),
    );
  }
}
10
likes
160
points
72.1k
downloads

Documentation

API reference

Publisher

verified publisherwenkaifan.com

Weekly Downloads

A tooltip that shows any widget as content, aligned to its target along any axis, with automatic fallback to the opposite side when space runs out.

Repository (GitHub)
View/report issues

Topics

#tooltip #overlay #popup #widget

License

MIT (license)

Dependencies

flutter

More

Packages that depend on aligned_tooltip