Coder Social home page Coder Social logo

robbendebiene / freestyle_speed_dial Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 0.0 524 KB

A lightweight yet powerful speed dial widget for Flutter, offering full control over the appearance, layout and animations of the speed dial.

Home Page: https://pub.dev/packages/freestyle_speed_dial

License: MIT License

Kotlin 0.17% Swift 1.63% Objective-C 0.05% Dart 38.51% CMake 25.57% C++ 29.49% C 2.01% HTML 2.56%
flutter flutter-widget speed-dial

freestyle_speed_dial's People

Contributors

robbendebiene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

freestyle_speed_dial's Issues

Question: Is it possible to put the label under the FAB and align it?

Hello,

I am following the lib example repo and i am trying to convert the Example 6 to my design.

image

The current code is:

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:freestyle_speed_dial/freestyle_speed_dial.dart';
import 'package:tuple/tuple.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        theme: ThemeData.dark().copyWith(
            scaffoldBackgroundColor: const Color.fromARGB(255, 18, 32, 47),
            materialTapTargetSize: MaterialTapTargetSize.padded),
        home: const ExamplePage());
  }
}

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

  @override
  Widget build(BuildContext context) {
    final List<double> positions = [-1, 1];
    const double verticalPosition = -1.75;

    return Scaffold(
        body: Center(
            child: SingleChildScrollView(
                padding: EdgeInsets.symmetric(
                    horizontal: min(200, MediaQuery.of(context).size.width / 3),
                    vertical: 200),
                child: Wrap(spacing: 200, runSpacing: 200, children: [
                  // Example 6 (Vertical Slide-In-Place With Labels):
                  // Advanced speed dial where every sub-button/item has an additional label.
                  // Both the item and the label start animating from their target position.
                  SpeedDialBuilder(
                      buttonBuilder: (context, isActive, toggle) =>
                          FloatingActionButton(
                              onPressed: toggle,
                              child: AnimatedRotation(
                                  duration: const Duration(milliseconds: 300),
                                  curve: Curves.easeInOutCubicEmphasized,
                                  turns: isActive ? 0.125 : 0,
                                  child: const Icon(Icons.add))),
                      reverse: true,
                      itemBuilder: (context,
                          Tuple3<IconData, String, LayerLink> item,
                          i,
                          animation) {
                        final offsetAnimation = Tween<Offset>(
                          begin: Offset.zero,
                          end: Offset(positions[i], verticalPosition),
                        ).animate(animation);
                        return SlideTransition(
                            position: offsetAnimation,
                            child: FadeTransition(
                                opacity: animation,
                                child: CompositedTransformTarget(
                                  link: item.item3,
                                  child: FloatingActionButton.small(
                                    onPressed: () {},
                                    child: Icon(item.item1),
                                  ),
                                )));
                      },
                      secondaryItemBuilder: (context,
                          Tuple3<IconData, String, LayerLink> item,
                          i,
                          animation) {
                        return CompositedTransformFollower(
                            link: item.item3,
                            child: FadeTransition(
                                opacity: animation,
                                child: Card(
                                    margin: const EdgeInsets.only(top: 50),
                                    child: Padding(
                                      padding: const EdgeInsets.all(5),
                                      child: Text(item.item2),
                                    )))
                        );
                      },
                      items: [
                        // You can also define and use your own container class
                        // if you don't want to use the tuple package.
                        Tuple3<IconData, String, LayerLink>(
                            Icons.arrow_upward, 'Out', LayerLink()),
                        Tuple3<IconData, String, LayerLink>(
                            Icons.arrow_downward, 'In', LayerLink())
                      ]),
                ]))));
  }
}

I managed to put it under the FAB but im not sure if this is the right approach, also I have tried combinations off modifying targetAnchor and followerAnchor to try to align it but I have not been able to achieve the design:

image

Close fab when any of the icons is clicked.

i am using Tuple3 to make my own custom ui, clicking on any the icon and navigate to another screen, this weird behaviour captures below happens, the icon sits at the top left corner of the next screen

my onPressed looks like
Screenshot 2023-03-18 at 19 31 27

Screenshot_20230318_191908

Close dial when I click on any icon

When I click on any icon, I want to close the dialer, but when I click on any icon and go to another page and come back to this page, it remains open.

Background overlay

Hi,

thanks for this cool library. I really like it and it is very customizable!

However, one feature I am missing: a background overlay when the FAB is in active state.
Can that be added somehow?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.