tiagojencmartins / unicornspeeddial

Flutter Floating Action Button with Speed Dial
Other
345 stars 76 forks source link

UnicornButton action is not working #13

Open diegoveloper opened 6 years ago

diegoveloper commented 6 years ago

It's weird because it was working, I tested the sample from the page https://pub.dartlang.org/packages/unicorndial#-example-tab- but now it's not working

Tested ( 1.1.1 , 1.1.2 ) , either the background color of the UnicornDialer is not displayed

The child buttons appears but the action is never called

childButtons.add(UnicornButton( currentButton: FloatingActionButton( onPressed: () => print("action"), heroTag: "directions", backgroundColor: Colors.blueAccent, mini: true, child: Icon(Icons.directions_car))));

print is never called and the items are not dismissed

flutter doctor -v [✓] Flutter (Channel dev, v0.5.8, on Mac OS X 10.13.6 17G65, locale en-PE) • Flutter version 0.5.8 at /Users/diegoveloper/Development/SDKS/flutter • Framework revision e4b989bf3d (9 days ago), 2018-08-09 09:45:44 -0700 • Engine revision 3777931801 • Dart version 2.0.0-dev.69.5.flutter-eab492385c

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.0) • Android SDK at /Users/diegoveloper/Development/SDKS/Android/android-sdk/ • Android NDK at /Users/diegoveloper/Development/SDKS/Android/android-sdk/ndk-bundle • Platform android-28, build-tools 28.0.0 • ANDROID_HOME = /Users/diegoveloper/Development/SDKS/Android/android-sdk/ • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01) • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 9.4.1, Build version 9F2000 • ios-deploy 1.9.2 • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] VS Code (version 1.26.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 2.17.1

dereklakin commented 6 years ago

In my original app I upgraded to the new version and the positioning and notch worked fine, but the background overlay was missing, the child buttons onPressed is not fired and the buttons are not in vertical alignment.

I've tried in a clean app (and have run flutter clean) and as mentioned above, the background overlay is missing and the child buttons do not fire onPressed and are not aligned properly (see screenshot).

Here's my test code:

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Container(color: Colors.green.withOpacity(0.5)),
      bottomNavigationBar: BottomAppBar(
        child: Row(
          children: <Widget>[
            IconButton(
              icon: Icon(Icons.textsms),
              onPressed: () => print('BottomAppBar button pressed'),
            ),
          ],
        ),
        color: Colors.blue,
        notchMargin: 8.0,
        shape: CircularNotchedRectangle(),
      ),
      floatingActionButton: UnicornDialer(
        childButtons: <UnicornButton>[
          UnicornButton(
            currentButton: FloatingActionButton(
              child: Icon(Icons.account_balance),
              mini: true,
              onPressed: () => print('Unicorn BUTTON pressed'),
            ),
          )
        ],
        hasBackground: true,
        hasNotch: true,
        onMainButtonPressed: () => print('Unicorn DIALER pressed'),
        parentButton: Icon(Icons.add),
      ),
    );
  }
}

Here's my flutter doctor output:

PS C:\Projects\Test Centre\unicorn> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, v0.5.8, on Microsoft Windows [Version 10.0.17134.228], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[√] Android Studio (version 3.1)
[√] VS Code, 64-bit edition (version 1.26.0)
[√] Connected devices (1 available)

• No issues found!

screenshot_1534598868

jeprojects commented 6 years ago

Same here.

Version 1.1.3 is not firing onPressed.

    childButtons.add(
      UnicornButton(
        currentButton: FloatingActionButton(
          heroTag: "Home",
          mini: true,
          child: Icon(Icons.home, color: Colors.black.withOpacity(0.8)),
          onPressed: () => print('test'),
        ),
      ),
    );
tiagojencmartins commented 6 years ago

Thank you for your input, I'll update the plugin tonight (2.25PM ~GMT+0 now) with the BAB + FAB fixed,

diegoveloper commented 6 years ago

I tested 1.1.3 and It fixed the background and the button actions , but the child buttons are not aligned at least in vertical. I noticed another bug , when there is only one child , the animation is not working properly when the child is displayed.

diegoveloper commented 6 years ago

I tested 1.1.4 , the items in vertical are not aligned yet. The animation doesn't work when there is one child.(When press the float action button and the child appears)

tiagojencmartins commented 6 years ago

Hey @diegoveloper - can't reproduce the one child issue. Could you make a quick gif?

jeprojects commented 6 years ago

@tiagojencmartins Buttons are clickable now thanks. It has created other issues though. I will open another issue.

diegoveloper commented 6 years ago

Issue

Code

` var childButtons = List();

childButtons.add(UnicornButton(
    currentButton: FloatingActionButton(
  backgroundColor: Colors.redAccent,
  heroTag: "tag_flight",
  child: Icon(Icons.flight),
  onPressed: _onTapFlightDetails,
)));

UnicornDialer(
        backgroundColor: Colors.black38,
        parentButtonBackground: Colors.blueAccent,
        orientation: UnicornOrientation.VERTICAL,
        parentButton: Icon(Icons.person_pin),
        childButtons: childButtons),
  ),

`

dereklakin commented 6 years ago

Child buttons and background working again in 1.1.4 (though vertical alignment is still not centered between main and child buttons), just the issue with the notch again (see #14)

mayankjanmejay commented 6 years ago

The child button's onPressed is not working, with the new version of flutter v0.9.5. Could you please perform your magic on the property again?

tiagojencmartins commented 6 years ago

Tested with 0.9.7 - everything seems fine. Are you still experiencing this?

dereklakin commented 6 years ago

Yes, child button actions working for me. Background is not protecting underlying content, though :( i.e. pressing the background with content underneath activates that content.

diegoveloper commented 6 years ago

Using the last version, childPadding is ignored. unicorndial: ^1.1.5

error_unicorn
mayankjanmejay commented 6 years ago
      Tested with 0.9.7 - everything seems fine. Are you still experiencing this?

pageCart.zip

Hello, I am still facing the same issue. The child button's onPressed does not fire. I am attaching the code file which has the unicorn buttons in use.

nicksav commented 5 years ago

Yes the same OnPressed doesn't work

koraxis commented 5 years ago

I have the same issue , onPressed is not called

nicksav commented 5 years ago

Ok I found what was the issue In my case I had to give more space for area when you can click. Check your case. All works ok for me now.

image

Mehedi50200 commented 4 years ago

Hi.. child button not working when using UnicornOrientation.HORIZONTAL. if i use UnicornOrientation.VERTICAL it works great. but horizontal is a problem.

mvfavila commented 4 years ago

Hi.. child button not working when using UnicornOrientation.HORIZONTAL. if i use UnicornOrientation.VERTICAL it works great. but horizontal is a problem.

Same here

renatosouzacano commented 4 years ago

Using version 1.1.15, replace the unicornDialWidget code and the unicorndial will work in both HORIZONTAL and VERTICAL orientations. Make a PR if you wish, no time to do it.

  var unicornDialWidget = Container(
      margin: widget.hasNotch ? EdgeInsets.only(bottom: 15.0) : null,
      height: MediaQuery.of(context).size.height,
      width: MediaQuery.of(context).size.width,
      child: Stack(
        //fit: StackFit.expand,
          alignment: Alignment.bottomRight,
          overflow: Overflow.visible,
          children: childButtonsList.toList()
            ..add(Positioned(
                right: null, bottom: null, child: mainFloatingButton))));