darioielardi / flutter_speed_dial

Flutter plugin to implement a Material Design Speed Dial
https://pub.dev/packages/flutter_speed_dial
MIT License
416 stars 178 forks source link

The child gets smaller. #316

Open CatEatFishs opened 1 year ago

CatEatFishs commented 1 year ago

I don't know why the child becomes smaller, as is shown in the picture Screenshot_20230709_224055

you can copy this code to main.dart to Repeat the question。 ` import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart';

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

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

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

class _MyAppState extends State { var theme = ValueNotifier(ThemeMode.dark);

@override Widget build(BuildContext context) { const appTitle = 'Flutter Speed Dial Example'; return ValueListenableBuilder( valueListenable: theme, builder: (context, value, child) => MaterialApp( title: appTitle, home: MyHomePage(theme: theme), debugShowCheckedModeBanner: false, theme: ThemeData( brightness: Brightness.light, primaryColor: Colors.blue, ), darkTheme: ThemeData( brightness: Brightness.dark, primaryColor: Colors.white, ), themeMode: value, )); } }

class MyHomePage extends StatefulWidget { final ValueNotifier theme;

const MyHomePage({Key? key, required this.theme}) : super(key: key);

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

class _MyHomePageState extends State with TickerProviderStateMixin { var renderOverlay = true; var visible = true; var switchLabelPosition = false; var extend = false; var mini = false; var rmicons = false; var customDialRoot = false; var closeManually = false; var useRAnimation = true; var isDialOpen = ValueNotifier(false); var speedDialDirection = SpeedDialDirection.up; var buttonSize = const Size(80.0, 80.0); var childrenButtonSize = const Size(80.0, 80.0); var selectedfABLocation = FloatingActionButtonLocation.endDocked; var items = [ FloatingActionButtonLocation.startFloat, FloatingActionButtonLocation.startDocked, FloatingActionButtonLocation.centerFloat, FloatingActionButtonLocation.endFloat, FloatingActionButtonLocation.endDocked, FloatingActionButtonLocation.startTop, FloatingActionButtonLocation.centerTop, FloatingActionButtonLocation.endTop, ];

@override Widget build(BuildContext context) { return WillPopScope( onWillPop: () async { if (isDialOpen.value) { isDialOpen.value = false; return false; } return true; }, child: Scaffold( appBar: AppBar( title: const Text("Flutter Speed Dial Example"), ), floatingActionButtonLocation: selectedfABLocation, floatingActionButton: SpeedDial( child: Container( width: 80.0, height: 80.0, child: Image.asset( 'images/base/ic_floating_button.png', fit: BoxFit.fill, ), ), activeChild: Container( width: 80.0, height: 80.0, child: Image.asset( 'images/base/floating_button_cancel.png', fit: BoxFit.fill, ), ), backgroundColor: Colors.black.withOpacity(0), foregroundColor: Colors.black.withOpacity(0), activeForegroundColor: Colors.black.withOpacity(0), activeBackgroundColor: Colors.black.withOpacity(0), elevation: 0, buttonSize: buttonSize, spacing: 0, mini: mini, openCloseDial: isDialOpen, // childPadding: const EdgeInsets.all(5), overlayColor: Colors.black.withOpacity(0), overlayOpacity: 0, renderOverlay: true, childPadding: EdgeInsets.zero, childMargin: EdgeInsets.zero, spaceBetweenChildren: 0, childrenButtonSize: childrenButtonSize, switchLabelPosition: false, activeLabel: extend ? const Text("Close") : null, visible: visible, direction: speedDialDirection, closeManually: closeManually, onOpen: () => debugPrint('OPENING DIAL'), onClose: () => debugPrint('DIAL CLOSED'), useRotationAnimation: useRAnimation, tooltip: 'Open Speed Dial', heroTag: 'speed-dial-hero-tag', animationCurve: Curves.elasticInOut, isOpenOnStart: false, children: [ SpeedDialChild( child: const Icon(Icons.accessibility), onTap: () => { Navigator.of(context).push( MaterialPageRoute(builder: ((context) => const PageA()))) }, onLongPress: () => debugPrint('FIRST CHILD LONG PRESS'), ), SpeedDialChild( child: const Icon(Icons.brush), onTap: () => { Navigator.of(context).push( MaterialPageRoute(builder: ((context) => const PageA()))) }, ), SpeedDialChild( child: const Icon(Icons.margin), visible: true, onTap: () => { Navigator.of(context).push( MaterialPageRoute(builder: ((context) => const PageA()))) }, onLongPress: () => debugPrint('THIRD CHILD LONG PRESS'), ), ], ), ), ); } }

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

@override State createState() => _PageAState(); }

class _PageAState extends State { @override Widget build(BuildContext context) { return const Scaffold( body: Center( child: Text("Page A"), ), ); } }

extension EnumExt on FloatingActionButtonLocation { /// Get Value of The SpeedDialDirection Enum like Up, Down, etc. in String format String get value => toString().split(".")[1]; }

`

` [✓] Flutter (Channel stable, 3.10.4, on macOS 13.3.1 22E261 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.10.4 on channel stable at /Users/liming/Documents/develop/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 682aa387cf (5 weeks ago), 2023-06-05 18:04:56 -0500 • Engine revision 2a3401c9bb • Dart version 3.0.3 • DevTools version 2.23.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/liming/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/liming/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14B47b • CocoaPods version 1.12.1

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1) • IntelliJ at /Applications/IntelliJ IDEA.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.79.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available) • KOZ AL40 (mobile) • A7JC9X1607G18811 • android-arm64 • Android 10 (API 29) • iPhone 14 (mobile) • 9F8DB2B2-A92B-4851-B8D2-399000B28046 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.198

[✓] Network resources • All expected network resources are available.

• No issues found!

`

https://github.com/darioielardi/flutter_speed_dial/assets/24956075/c0ad2bf7-9285-4e1d-85eb-b2bdfcacd96e

If you know how to solve it, please contact me, thank you!

CatEatFishs commented 1 year ago

flutter_speed_dial: 7.0.0 ios is ok,this bug in android

leifcr commented 1 year ago

I'm seeing similar behaviour. @CatEatFishs Did you find a solution?