• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    Dart
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Stand With Ukraine

Popover

Popover screenshots

Popover for Flutter

Supported platforms Popover is released under the MIT license. Effective Dart PRs welcome!
Current Build Status.

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.18.0+
  • Flutter: 3.3.0+

Install

dependencies:
  popover: ^0.2.8+2

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.bottom,
            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 Padding(
        padding: const EdgeInsets.symmetric(vertical: 8),
        child: ListView(
          padding: const EdgeInsets.all(8),
          children: [
            InkWell(
              onTap: () {
                Navigator.of(context)
                  ..pop()
                  ..push(
                    MaterialPageRoute<SecondRoute>(
                      builder: (context) => SecondRoute(),
                    ),
                  );
              },
              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')),
            ),
            const Divider(),
            Container(
              height: 50,
              color: Colors.amber[300],
              child: const Center(child: Text('Entry C')),
            ),
          ],
        ),
    );
  }
}

class SecondRoute extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Second Route'),
        automaticallyImplyLeading: false,
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () => Navigator.pop(context),
          child: const Text('Go back!'),
        ),
      ),
    );
  }
}

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.

More Repositories

1

flutter-web-demo

๐ŸŒ Responsive web app powered by Flutter and Dart
C++
208
star
2

audio_player_flutter

๐ŸŽง Apple Music / Tidal Audio Player for Flutter
Dart
125
star
3

soundcloud_audio_player

๐ŸŽน SoundCloud Audio Player for Flutter.
Dart
55
star
4

swiftui-mapkit

SwiftUI meets MapKit
Swift
18
star
5

result_type

๐Ÿ’Š Result Type for Dart represents either a success or a failure, including an associated value in each case.
Dart
11
star
6

ItemsDataSource

โ™ป๏ธ Generic datasource for UICollectionView
Swift
10
star
7

tagged

๐Ÿท๏ธ Tagged: A Newtype Pattern, a Safe & Type-Restricted Wrapper for Dart.
4
star
8

extensions

๐Ÿ“šBenchmark of Swift extensions vs methods
Swift
4
star
9

Kebab-Swift

Kebab O'Clock iOS Application written in Swift 2.1- https://goo.gl/9cH6le
Swift
3
star
10

json_server_for_audio_player_flutter

Companion repo for https://github.com/minikin/audio_player_flutter
JavaScript
3
star
11

twitter-rs

Simple Twitter API Clone in Rust.
Rust
2
star
12

SketchCacheCleaner

Sketch Cache Cleaner
HTML
2
star
13

sign-in-with-apple-flutter

SignIn with Apple Flutter Plugin
Dart
2
star
14

EMP

Electronic Music Production and Sound Design | COURSE PROGRAM 2016 (Spring).
2
star
15

BLoC

๐Ÿข A predictable state management library that helps implement the BLoC design pattern in Swift.
Swift
2
star
16

books

Selected books which I read or listen to.
1
star
17

Mapnik3

Manik 3 pre build for iOS (arm64, arm7 & and fat lib)
C++
1
star
18

flutter-vs-react-native

Flutter vs React Native vs iOS (Swift)
Swift
1
star
19

VoiceControlledDrumMachine

๐ŸŽน Siri Controlled Drum Machine
JavaScript
1
star
20

hey

Swift
1
star
21

slow_image_download_flutter

This project demonstrates slow image download in Flutter/Dart apps.
C++
1
star
22

cyclic_numbers

๐Ÿ”‰Cyclic Numbers is electronic music label run by Andrey Sirotkin & Sasha Prokhorenko :
Ruby
1
star
23

dart-algorithms

๐Ÿงฎ Algorithms and data structures implemented in Dart with explanations and links to further readings
1
star
24

iOSmeetsD3

Demo app which demonstrates how to use D3.JS and NVD3.JS inside an iOS app.
JavaScript
1
star
25

flutter_ble

BLE FLutter Demo
Dart
1
star
26

FlutterDartTips

๐Ÿš€ Not a nonsense collection of Dart & Flutter tips & tricks that I've shared on Twitter.
1
star
27

swiftui-mapkit-services

Contains foundation sources that are used in multiple components of the SwiftUI meets MapKit, like a HTTP client.
Swift
1
star
28

network_image_slow_download_time

This project demonstrates slow image download (or not) in Flutter apps with Image.network widget.
C++
1
star
29

youtube

Desktop App for YouTube
Swift
1
star
30

openai-rs

Rust client for the OpenAI API.
Rust
1
star
31

grpc-chat-server

1
star
32

NewsReader

News Reader an iOS App which use NSLinguisticTagger
Swift
1
star
33

flutter_cross_os_auth

Auth workflow implementation for iOS, Android, macOS & Web in Flutter/Dart with Firebase.
Dart
1
star
34

cross-sensors

cross sensors
Dart
1
star
35

app-on-blocs

Demo flutter app on BLoCs
Dart
1
star
36

Algorithmics

A collection of algorithms and data structure implemented in Swift 2.1 for self-development purpose.
Swift
1
star
37

flutter-hacker-news

Yet another Hacker News mobile client.
Dart
1
star
38

smpl-blockchain-rs

Naive blockchain implementation in Rust.
Rust
1
star
39

panic

Panic allows a Flutter app to terminate immediately and provide feedback to the caller of the program.
C++
1
star
40

Discoverer

Discoverer an iOS/iPadOS/macOS native app powered by SwiftUI
Swift
1
star