0 purchases
wagon wheel
A new Flutter package to create a custom wagon wheel widget for cricket applications.
Getting started #
To use this package, first download it using the following command:
flutter pub add wagon_wheel
copied to clipboard
And run:
flutter pub get
copied to clipboard
Finally,
import 'package:wagon_wheel/models/ball.dart';
import 'package:wagon_wheel/wagon_wheel.dart';
copied to clipboard
Usage #
To use this package, first create a list of balls:
List <Ball> balls = [];
copied to clipboard
And then in the initState of your StatefulWidget
@override
void initState() {
super.initState();
for (int i = 0; i < 15; i++) {
balls.add(
Ball(
angle: (20 * i).toDouble(),
runs: i % 3 == 0 ? 4 : 6,
),
);
}
}
copied to clipboard
After this step, you will be able to use the WagonWheel widget in your build method:
WagonWheel(
balls: balls,
fourColor: Colors.blue,
sixColor: Colors.red,
isInverse: true,
background: Stack(
children: [
Container(
color: Colors.green,
),
Center(
child: Container(
width: 10,
height: 60,
color: Colors.amberAccent,
),
),
],
),
),
copied to clipboard
This will give you the following UI:
Additional information #
As of now, this package only supports lines for 4 and 6. Work is being done to add support to all shots that are played around the field. Till then, please filter out all the shots that are not either 4 or a 6.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.