widget_arrows 0.5.2 copy "widget_arrows: ^0.5.2" to clipboard
widget_arrows: ^0.5.2 copied to clipboard

Simply draw customizable arrows between any widgets in your app.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:widget_arrows/widget_arrows.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) => MaterialApp(
        home: MyHomePage(),
      );
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool showArrows = true;

  @override
  Widget build(BuildContext context) => ArrowContainer(
        child: Scaffold(
          appBar: AppBar(
            title: ArrowElement(
              show: showArrows,
              color: Colors.red,
              id: 'title',
              targetId: 'text2',
              targetAnchor: Alignment.topCenter,
              sourceAnchor: Alignment.bottomCenter,
              child: Text('Arrows everywhere'),
            ),
          ),
          body: Center(
            child: Column(
              mainAxisSize: MainAxisSize.max,
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                Align(
                  alignment: Alignment.centerLeft,
                  child: ArrowElement(
                    show: showArrows,
                    id: 'text',
                    targetIds: ['fab', 'title'],
                    sourceAnchor: Alignment.bottomCenter,
                    color: Colors.green,
                    child: Text('Arrows and stuff'),
                  ),
                ),
                Align(
                  alignment: Alignment.centerRight,
                  child: ArrowElement(
                    show: showArrows,
                    id: 'text2',
                    targetId: 'text',
                    targetAnchor: Alignment.centerRight,
                    child: Text(
                      'Arrow here please',
                      style: Theme.of(context).textTheme.headline4,
                    ),
                  ),
                ),
              ],
            ),
          ),
          floatingActionButton: ArrowElement(
            id: 'fab',
            child: FloatingActionButton(
              onPressed: () => setState(() {
                showArrows = !showArrows;
              }),
              tooltip: 'hide/show',
              child: Icon(Icons.remove_red_eye),
            ),
          ),
        ),
      );
}
94
likes
160
points
1.03k
downloads

Publisher

unverified uploader

Weekly Downloads

Simply draw customizable arrows between any widgets in your app.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on widget_arrows