diff --git a/CHANGELOG.md b/CHANGELOG.md index 953d092..e064374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [6.2.0] - 14 October 2022 + +- Fix Overlay error for once and for all +- Improve Example Code + ## [6.1.0+1] - 06 October 2022 ## [6.1.0] - 05 October 2022 diff --git a/example/lib/main.dart b/example/lib/main.dart index 9e3730e..0dc8c9f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -82,259 +82,311 @@ class _MyHomePageState extends State with TickerProviderStateMixin { title: const Text("Flutter Speed Dial Example"), ), body: SingleChildScrollView( + padding: const EdgeInsets.all(16), physics: const BouncingScrollPhysics(), child: Center( child: Container( constraints: const BoxConstraints(maxWidth: 800), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: const EdgeInsets.all(15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("SpeedDial Location", - style: Theme.of(context).textTheme.bodyText1), - const SizedBox(height: 10), - Container( - decoration: BoxDecoration( - color: Theme.of(context).brightness == - Brightness.dark - ? Colors.grey[800] - : Colors.grey[200], - borderRadius: BorderRadius.circular(10)), - child: - DropdownButton( - value: selectedfABLocation, - isExpanded: true, - icon: const Icon(Icons.arrow_drop_down), - iconSize: 20, - underline: const SizedBox(), - onChanged: (fABLocation) => setState( - () => selectedfABLocation = fABLocation!), - selectedItemBuilder: (BuildContext context) { - return items.map((item) { - return Align( - alignment: Alignment.centerLeft, - child: Container( - padding: const EdgeInsets.symmetric( - vertical: 4, horizontal: 10), - child: Text(item.value))); - }).toList(); - }, - items: items.map((item) { - return DropdownMenuItem< - FloatingActionButtonLocation>( - child: Text( - item.value, - ), - value: item, - ); - }).toList(), - ), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.symmetric( + vertical: 6, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("SpeedDial Location", + style: Theme.of(context).textTheme.bodyText1), + const SizedBox(height: 10), + Container( + decoration: BoxDecoration( + color: Theme.of(context).brightness == + Brightness.dark + ? Colors.grey[800] + : Colors.grey[200], + borderRadius: BorderRadius.circular(10)), + child: DropdownButton( + value: selectedfABLocation, + isExpanded: true, + icon: const Icon(Icons.arrow_drop_down), + iconSize: 20, + underline: const SizedBox(), + onChanged: (fABLocation) => setState( + () => selectedfABLocation = fABLocation!), + selectedItemBuilder: (BuildContext context) { + return items.map((item) { + return Align( + alignment: Alignment.centerLeft, + child: Container( + padding: const EdgeInsets.symmetric( + vertical: 4, horizontal: 10), + child: Text(item.value))); + }).toList(); + }, + items: items.map((item) { + return DropdownMenuItem< + FloatingActionButtonLocation>( + child: Text( + item.value, + ), + value: item, + ); + }).toList(), ), - ], - ), + ), + ], ), - Container( - padding: const EdgeInsets.all(15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("SpeedDial Direction", - style: Theme.of(context).textTheme.bodyText1), - const SizedBox(height: 10), - Container( - decoration: BoxDecoration( - color: Theme.of(context).brightness == - Brightness.dark - ? Colors.grey[800] - : Colors.grey[200], - borderRadius: BorderRadius.circular(10)), - child: DropdownButton( - value: speedDialDirection, - isExpanded: true, - icon: const Icon(Icons.arrow_drop_down), - iconSize: 20, - underline: const SizedBox(), - onChanged: (sdo) { - setState(() { - speedDialDirection = sdo!; - selectedfABLocation = (sdo.isUp && - selectedfABLocation.value - .contains("Top")) || - (sdo.isLeft && - selectedfABLocation.value - .contains("start")) - ? FloatingActionButtonLocation.endDocked - : sdo.isDown && - !selectedfABLocation.value - .contains("Top") - ? FloatingActionButtonLocation - .endTop - : sdo.isRight && - selectedfABLocation.value - .contains("end") - ? FloatingActionButtonLocation - .startDocked - : selectedfABLocation; - }); - }, - selectedItemBuilder: (BuildContext context) { - return SpeedDialDirection.values - .toList() - .map((item) { - return Container( - padding: const EdgeInsets.symmetric( - vertical: 4, horizontal: 10), - child: Align( - alignment: Alignment.centerLeft, - child: Text(describeEnum(item) - .toUpperCase())), - ); - }).toList(); - }, - items: SpeedDialDirection.values + ), + Container( + padding: const EdgeInsets.symmetric( + vertical: 6, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("SpeedDial Direction", + style: Theme.of(context).textTheme.bodyText1), + const SizedBox(height: 10), + Container( + decoration: BoxDecoration( + color: Theme.of(context).brightness == + Brightness.dark + ? Colors.grey[800] + : Colors.grey[200], + borderRadius: BorderRadius.circular(10)), + child: DropdownButton( + value: speedDialDirection, + isExpanded: true, + icon: const Icon(Icons.arrow_drop_down), + iconSize: 20, + underline: const SizedBox(), + onChanged: (sdo) { + setState(() { + speedDialDirection = sdo!; + selectedfABLocation = (sdo.isUp && + selectedfABLocation.value + .contains("Top")) || + (sdo.isLeft && + selectedfABLocation.value + .contains("start")) + ? FloatingActionButtonLocation.endDocked + : sdo.isDown && + !selectedfABLocation.value + .contains("Top") + ? FloatingActionButtonLocation.endTop + : sdo.isRight && + selectedfABLocation.value + .contains("end") + ? FloatingActionButtonLocation + .startDocked + : selectedfABLocation; + }); + }, + selectedItemBuilder: (BuildContext context) { + return SpeedDialDirection.values .toList() - .map((item) { - return DropdownMenuItem( - child: - Text(describeEnum(item).toUpperCase()), - value: item, + .map((item) { + return Container( + padding: const EdgeInsets.symmetric( + vertical: 4, horizontal: 10), + child: Align( + alignment: Alignment.centerLeft, + child: Text( + describeEnum(item).toUpperCase())), ); - }).toList(), - ), + }).toList(); + }, + items: SpeedDialDirection.values + .toList() + .map((item) { + return DropdownMenuItem( + child: Text(describeEnum(item).toUpperCase()), + value: item, + ); + }).toList(), ), - ], - ), + ), + ], ), - if (!customDialRoot) - SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: extend, - title: const Text("Extend Speed Dial"), - onChanged: (val) { - setState(() { - extend = val; - }); - }), - SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: visible, - title: const Text("Visible"), - onChanged: (val) { - setState(() { - visible = val; - }); - }), - SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: mini, - title: const Text("Mini"), - onChanged: (val) { - setState(() { - mini = val; - }); - }), - SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: customDialRoot, - title: const Text("Custom dialRoot"), - onChanged: (val) { - setState(() { - customDialRoot = val; - }); - }), - SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: renderOverlay, - title: const Text("Render Overlay"), - onChanged: (val) { - setState(() { - renderOverlay = val; - }); - }), - SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: closeManually, - title: const Text("Close Manually"), - onChanged: (val) { - setState(() { - closeManually = val; - }); - }), + ), + if (!customDialRoot) SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: rmicons, - title: const Text("Remove Icons (for children)"), + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: extend, + title: const Text("Extend Speed Dial"), onChanged: (val) { setState(() { - rmicons = val; + extend = val; }); }), - if (!customDialRoot) - SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: useRAnimation, - title: const Text("Use Rotation Animation"), - onChanged: (val) { - setState(() { - useRAnimation = val; - }); - }), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: visible, + title: const Text("Visible"), + onChanged: (val) { + setState(() { + visible = val; + }); + }), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: mini, + title: const Text("Mini"), + onChanged: (val) { + setState(() { + mini = val; + }); + }), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: customDialRoot, + title: const Text("Custom dialRoot"), + onChanged: (val) { + setState(() { + customDialRoot = val; + }); + }), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: renderOverlay, + title: const Text("Render Overlay"), + onChanged: (val) { + setState(() { + renderOverlay = val; + }); + }), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: closeManually, + title: const Text("Close Manually"), + onChanged: (val) { + setState(() { + closeManually = val; + }); + }), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: rmicons, + title: const Text("Remove Icons (for children)"), + onChanged: (val) { + setState(() { + rmicons = val; + }); + }), + if (!customDialRoot) SwitchListTile( - contentPadding: const EdgeInsets.all(15), - value: switchLabelPosition, - title: const Text("Switch Label Position"), + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: useRAnimation, + title: const Text("Use Rotation Animation"), onChanged: (val) { setState(() { - switchLabelPosition = val; - if (val) { - if ((selectedfABLocation.value - .contains("end") || - selectedfABLocation.value - .toLowerCase() - .contains("top")) && - speedDialDirection.isUp) { - selectedfABLocation = - FloatingActionButtonLocation.startDocked; - } else if ((selectedfABLocation.value - .contains("end") || - !selectedfABLocation.value - .toLowerCase() - .contains("top")) && - speedDialDirection.isDown) { - selectedfABLocation = - FloatingActionButtonLocation.startTop; - } - } + useRAnimation = val; }); }), - const Text("Button Size"), - Slider( - value: buttonSize.width, - min: 50, - max: 500, - label: "Button Size", + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 6, + ), + value: switchLabelPosition, + title: const Text("Switch Label Position"), onChanged: (val) { setState(() { - buttonSize = Size(val, val); + switchLabelPosition = val; + if (val) { + if ((selectedfABLocation.value.contains("end") || + selectedfABLocation.value + .toLowerCase() + .contains("top")) && + speedDialDirection.isUp) { + selectedfABLocation = + FloatingActionButtonLocation.startDocked; + } else if ((selectedfABLocation.value + .contains("end") || + !selectedfABLocation.value + .toLowerCase() + .contains("top")) && + speedDialDirection.isDown) { + selectedfABLocation = + FloatingActionButtonLocation.startTop; + } + } }); - }, + }), + const Text("Button Size"), + Slider( + value: buttonSize.width, + min: 50, + max: 500, + label: "Button Size", + onChanged: (val) { + setState(() { + buttonSize = Size(val, val); + }); + }, + ), + const Text("Children Button Size"), + Slider( + value: childrenButtonSize.height, + min: 50, + max: 500, + onChanged: (val) { + setState(() { + childrenButtonSize = Size(val, val); + }); + }, + ), + Container( + padding: const EdgeInsets.symmetric( + vertical: 6, ), - const Text("Children Button Size"), - Slider( - value: childrenButtonSize.height, - min: 50, - max: 500, - onChanged: (val) { - setState(() { - childrenButtonSize = Size(val, val); - }); - }, - ) - ]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("Navigation", + style: Theme.of(context).textTheme.bodyText1), + const SizedBox(height: 10), + ElevatedButton( + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => + MyHomePage(theme: widget.theme), + ), + ); + }, + child: const Text("Push Duplicate Page")), + ], + ), + ), + ], + ), ), )), floatingActionButtonLocation: selectedfABLocation, diff --git a/pubspec.yaml b/pubspec.yaml index 8c48ba9..52acc4e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_speed_dial description: Flutter plugin to implement a beautiful and dynamic Material Design Speed Dial with labels, animated icons, multi-directional children and much more. -version: 6.1.0+1 +version: 6.2.0 homepage: https://github.com/darioielardi/flutter_speed_dial/ dependencies: