This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
backgroundColor: Theme.of(context).primaryColor, | |
body: SafeArea( | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Column( | |
children: <Widget>[ | |
Expanded( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const double _radiansPerDegree = Math.pi / 180; | |
final double _startAngle = -90.0 * _radiansPerDegree; | |
double _itemSpacing = 360.0 / 5.0; | |
double _calculateItemAngle(int index) { | |
return _startAngle + index * _itemSpacing * _radiansPerDegree; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _CircularLayoutDelegate extends MultiChildLayoutDelegate { | |
static const String actionButton = 'BUTTON'; | |
Offset center; | |
final int itemCount; | |
final double radius; | |
_CircularLayoutDelegate({ | |
@required this.itemCount, | |
@required this.radius, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < 5; i++) { | |
products.add( LayoutId( | |
id: ‘BUTTON$i’, | |
child: item, | |
)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CustomMultiChildLayout( | |
delegate: _CircularLayoutDelegate( | |
itemCount: 5, | |
Radius: 150.0, | |
), | |
children: products, | |
) |