p-hatan/ mirror

pub repository

mirror.p-hatan.ir

popover

0.2.1

A popover is a transient view that appears above other content onscreen when you tap a control or in an area.

Download archive

Readme

Content

Features

A popover is a transient view that appears above other content onscreen when you tap a control or in an area. Typically, a popover includes an arrow pointing to the location from which it emerged. Popovers can be nonmodal or modal. A nonmodal popover is dismissed by tapping another part of the screen or a button on the popover. A modal popover is dismissed by tapping a Cancel or other button on the popover.

Source: Human Interface Guidelines.

Requirements

  • Dart: 2.12.0+
  • Flutter : 2.0.0+

Install

dependencies:
  popover: ^0.2.1

Example

See example/lib/main.dart.

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

class PopoverExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Popover Example')),
        body: const SafeArea(
          child: Padding(
            padding: EdgeInsets.all(16),
            child: Button(),
          ),
        ),
      ),
    );
  }
}

class Button extends StatelessWidget {
  const Button({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 80,
      height: 40,
      decoration: const BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.all(Radius.circular(5)),
        boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 5)],
      ),
      child: GestureDetector(
        child: const Center(child: Text('Click Me')),
        onTap: () {
          showPopover(
            context: context,
            bodyBuilder: (context) => const ListItems(),
            onPop: () => print('Popover was popped!'),
            direction: PopoverDirection.top,
            width: 200,
            height: 400,
            arrowHeight: 15,
            arrowWidth: 30,
          );
        },
      ),
    );
  }
}

class ListItems extends StatelessWidget {
  const ListItems({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scrollbar(
      child: Padding(
        padding: const EdgeInsets.symmetric(vertical: 8),
        child: ListView(
          padding: const EdgeInsets.all(8),
          children: [
            InkWell(
              onTap: () {
                print('GestureDetector was called on Entry A');
                Navigator.of(context).pop();
              },
              child: Container(
                height: 50,
                color: Colors.amber[100],
                child: const Center(child: Text('Entry A')),
              ),
            ),
            const Divider(),
            Container(
              height: 50,
              color: Colors.amber[200],
              child: const Center(child: Text('Entry B')),
            ),
          ],
        ),
      ),
    );
  }
}

To see examples of the following package on a device or simulator:

cd example && flutter run

Support

Post issues and feature requests on the GitHub issue tracker.

License

The source code of Popover project is available under the MIT license. See the LICENSE file for more info.

Changelog

[0.2.1] - 04.04.2021.

  • Lower minimum version requirements for Dart and Flutter to pass pub.dev validation.

[0.2.0] - 04.04.2021.

  • Migrate to NNBD.

[0.1.0] - 09.02.2021.

  • BREAKING: Refactor popover implementation to have identical API to included in Flutter modal dialogs e.g. showCupertinoDialog
  • docs: README updates
  • docs: example application updates

[0.0.5] - 08.02.2021.

  • Add Key key, barrierDismissible and showPopover.

[0.0.4] - 27.01.2021.

  • Add arrowDyOffset, arrowDxOffset and contentDyOffset public parameters.

[0.0.3] - 21.01.2021.

  • A child widget can be wrapped in InkWell or GestureDetector.

[0.0.2] - 18.01.2021.

  • Update PopoverItem.
  • Add PopoverDirection to exports.
  • Add documentation.

[0.0.1] - 10.01.2021.

  • Initial release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add popover
pubspec.yaml
name: popover
description: A popover is a transient view that appears above other content onscreen when you tap a control or in an area.
version: 0.2.1
homepage: https://github.com/minikin/popover

environment:
  sdk: '>=2.12.0 <3.0.0'
  flutter: ">=2.0.0"

dependencies:
  flutter:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter

Version history

VersionPublishedArchiveSHA-256
0.0.12021-01-10T16:05:11.774612ZDownload88b01eda033caeded5a6c3d360728c0ff16c7bf1ef9a122fae9017ca66bf5273
0.0.22021-01-18T10:51:14.535196ZDownload9d6da05b4c82ef7275d62f0f90dba360fb62923ac1229feec00137583c208a73
0.0.32021-01-21T09:35:38.409796ZDownload75ec1dcfbe54bfcdf8eeec8c5187b097fc2ef4ea1f7fa8a920dfc9a3e6f85d1b
0.0.42021-01-27T13:17:13.360781ZDownload8c08d042e99dc19e1245173e8614cf8a1fcae965a623ff9a0a844540be4752cf
0.0.52021-02-08T11:13:04.078089ZDownload092ea635faca3dfa8d106a49fc8e2ea8e81473c671a9da749155697dc2f05a8f
0.1.02021-02-09T10:27:02.372294ZDownloadecd0913b60c163f85ad8d7fb73f465b5cd87e331c2ffc6977f7981cbcce14e10
0.2.02021-04-04T09:39:39.763172ZDownloadddc74c5975a7cee4b6429d3ef66e1d60f34781cea75e33a486c5daab1195811d
0.2.12021-04-04T10:10:23.890126ZDownloadc0e7ba460a2eb7f86b5dd74dc8ae9b608a0b652c268c1242b9c5eb7e78655291
0.2.22021-04-22T19:32:25.407542ZDownload07285f1eb7a0ab40cbe7ed7037708befb2d68760c6ee8243511959df435b800f
0.2.32021-05-03T15:45:12.472142ZDownload086d8b1ab12da003e49d79ab9df24d19a3673a4a911de75cd33875e7d72a1301
0.2.42021-05-18T09:01:40.553975ZDownloadd48bb7a4e2ed111ab588a8ec7e7b44f68c8c77008b760b4bfafe268f992234a1
0.2.52021-05-18T22:00:31.921862ZDownloadfed0248e40bbbc6ffb4455bad4e5d7d64e24f944b14b81ca6ca8aa57e1d020e1
0.2.62021-05-21T08:08:06.061717ZDownload379b0957e04ed32ffb4a765302817075e41e5cd21956d68843cec01e0e33ccc6
0.2.6+12021-05-21T10:25:36.682087ZDownload93f3b1d804740a7e102381edf54b840a5cc08cd37c90d38f9fdac281633fe28b
0.2.6+22021-06-17T07:21:06.729570ZDownload4dfba8a3c865081f0468ae89c5fe1fdac7050b99cdc3e526259ebab40a00b9c3
0.2.6+32021-10-12T09:46:38.915902ZDownload586192140ed4413779a02e4e4e14ff1ad040346e15bdc5361a16178e9a01f933
0.2.72022-10-24T01:12:39.571177ZDownloadfacec1170550043f859fa65706872f6ffa2fd96da2d6dc56c653a689f3066d67
0.2.82023-01-02T20:39:17.931736ZDownload29b40c4297f5192d4fd4263a2996598eb7b62105437a00d68cf9561311f9cf5f
0.2.8+12023-02-05T19:38:58.565153ZDownload4255a09e3bb64cada6aebdeeeb15453a2790802d4eecb9256ff5c895863582ea
0.2.8+22023-03-01T10:02:11.049592ZDownload59f4a55ebb484d012c8aaa273ad58eee571945231b71fb938c5a69f63b5a94d4
0.2.92023-12-08T09:27:42.256835ZDownload6a0928ccdcf12d46b407372b644a0d94400b316d0ee072a19dcef03c2bb88c3f
0.3.02024-02-08T12:47:32.184638ZDownloadca3bef9d88ebf5c5c3823946a5de3ce8360018fbb6a3e25819586a7d5a203db2
0.3.0+12024-05-19T13:31:13.932983ZDownload5cba40e04115cbbf15c35e00767b91e8bf3f769763a34beb2f8a1b9e8b5fc876
0.3.12024-08-11T09:33:48.970285ZDownload0606f3e10f92fc0459f5c52fd917738c29e7552323b28694d50c2d3312d0e1a2
0.4.02025-10-23T18:11:48.270204ZDownload2b2e1c40658b05089ac9365211983ebdad067d34b9d8fa0313434b38f7efff07
0.5.02026-10-12T19:08:52.329625ZDownload128561533a7b5a856de092073cd90ce7481c907970251db9d90a9513b50a6715
0.5.12026-10-12T20:11:03.251282ZDownload0bad70fe7dd7b182b8358719c1d50092a54f010e612fee1380c7f2302c6d3d3b

Dependencies

flutter { "sdk": "flutter" }