From ec140beda1009c0387fec2b3755cff400388fa1a Mon Sep 17 00:00:00 2001 From: Jonas Cerqueira Junior Date: Mon, 28 Feb 2022 16:57:09 -0300 Subject: [PATCH] Enable mouse scrolling on Carousel sample (#965) * Enable mouse scrollBehavior on carousel sample Overriding PageVeiw scrollBehavior , adding PointerDeviceKind.mouse as a dragDevice * Flutter format --- animations/lib/src/misc/carousel.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/animations/lib/src/misc/carousel.dart b/animations/lib/src/misc/carousel.dart index a742251e6..0df484fa2 100644 --- a/animations/lib/src/misc/carousel.dart +++ b/animations/lib/src/misc/carousel.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:ui'; import 'package:flutter/material.dart'; class CarouselDemo extends StatelessWidget { @@ -77,6 +78,12 @@ class _CarouselState extends State { }); }, controller: _controller, + scrollBehavior: ScrollConfiguration.of(context).copyWith( + dragDevices: { + PointerDeviceKind.touch, + PointerDeviceKind.mouse, + }, + ), itemBuilder: (context, index) => AnimatedBuilder( animation: _controller, builder: (context, child) {