marianocordoba / fab-circular-menu

A Flutter package to create a nice circular menu using a Floating Action Button.
https://pub.dev/packages/fab_circular_menu
MIT License
198 stars 72 forks source link

Need ringWidth, please Advise? #12

Closed YohanWadia closed 4 years ago

YohanWadia commented 4 years ago

Hi, I am trying out my project on Web too. Thats where I need the ringWidth. I see you get this from ringDiameter.. and that from screenWidth.

Is there any recommended way that I may get that present ringWidth? Besides doing the entire thing from scratch with Screen class?? Also, if there isnt, how may I know when the widget has finished its constructor, because thats the time I might try to trap the fabKey.currentState.widget.ringDiameter value into a double variable.

thanks, Great package by the way!

marianocordoba commented 4 years ago

Hi @YohanWadia! Actually, there is a ringWidth property that you can use:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Placeholder(),
        floatingActionButton: FabCircularMenu(
          ringDiameter: 200.0,
          ringWidth: 50.0,
          children: <Widget>[
            IconButton(icon: Icon(Icons.home), onPressed: () {
              print('Home');
            }),
            IconButton(icon: Icon(Icons.favorite), onPressed: () {
              print('Favorite');
            })
          ]
        )
      )
    );
  }
}
YohanWadia commented 4 years ago

Hi, First of all, Congratulations of a great package. I dont think you understood my Q.

you see by default you already have got ring diameter as screenWidth * 1.25 i wanted to extract that value from your widget... rather than me re doing a double width = MediaQuery.of(context).size.width;

did you get it? How could I get it from your already set default value... only if it is possible

thanks.