flutter fragment effect
Add this to your package's pubspec.yaml file:
dependencies:
flutter_fragments: ^0.0.6
class FragmentsDemo extends StatefulWidget {
static final String title = "Fragments";
@override
_FragmentsDemoState createState() => _FragmentsDemoState();
}
class _FragmentsDemoState extends State<FragmentsDemo> {
FragmentsController controller = FragmentsController();
Offset startingOffset = Offset.zero;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: GestureDetector(
onTapUp: (TapUpDetails detail) {
setState(() {
startingOffset = detail.localPosition;
});
controller.start();
},
child: Container(
width: 300,
height: 300,
child: Fragments(
fragmentsController: controller,
startingOffset: startingOffset,
delegate: RadialFragmentsDraw(disableTransition: true),
child: const FragmentsExample(),
),
),
),
),
);
}
}
Fragments(
fragmentsController: controller,
startingOffset: startingOffset,
duration: Duration(milliseconds: 3000),
child: const FragmentsExample(),
),
Fragments(
fragmentsController: controller,
startingOffset: startingOffset,
duration: Duration(milliseconds: 3000),
delegate: RadialFragmentsDraw(rowLength: 25, columnLength: 25),
child: const FragmentsExample(),
),
Fragments(
fragmentsController: controller,
startingOffset: startingOffset,
duration: Duration(milliseconds: 3000),
delegate: SizeFragmentsDrawDelegate(size: Size(20, 20)),
child: const FragmentsExample(),
),