rydmike / flex_color_picker

A highly customizable Flutter color picker.
BSD 3-Clause "New" or "Revised" License
198 stars 41 forks source link

Wheel breaks when wrapped with FittedBox & SizedBox #87

Closed LenaWirtz closed 2 months ago

LenaWirtz commented 3 months ago

Hi all,

i created a very simple flutter project (version 3.3.9, Picker version 3.0.2). when wrapping the Scaffold with a Fitted & Sized box as you see in the example code below, the touch points of the color wheel are broken (like in the video). Is there any way to fix this?

https://github.com/rydmike/flex_color_picker/assets/74858037/c9c5dc42-707c-47f2-8ca4-92edf7e3c18d

` import 'package:flex_color_picker/flex_color_picker.dart'; import 'package:flutter/material.dart';

void main() { runApp(const MyApp()); }

class MyApp extends StatelessWidget { const MyApp({super.key});

@override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } }

class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title;

@override State createState() => _MyHomePageState(); }

class _MyHomePageState extends State { Color currentColor = Colors.blue;

@override Widget build(BuildContext context) { return FittedBox( child: SizedBox( width: 1920, height: 1080, child: Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: ColorPicker( pickersEnabled: const <ColorPickerType, bool>{ ColorPickerType.wheel: true, ColorPickerType.primary: false, ColorPickerType.accent: false, }, wheelDiameter: 500, wheelSquarePadding: 50, wheelWidth: 40, wheelSquareBorderRadius: 16, enableShadesSelection: false, color: currentColor, onColorChanged: (value) { setState(() { currentColor = value; }); }, ), ), ), ), ); } }

`

rydmike commented 3 months ago

It seems to be working. The painted wheel seems to have a diameter of 500 in the video as specified and it works.

What do you expect it to do?

Please note that the wheel is fixed size painter, kind of like e.g. Switch, it does not expand/shrink to fit surrounding constraints. You can of course compute the max diameter of the the wheel that would fit into the area you have and give that as diameter, if you need it to respond to available space.

rydmike commented 2 months ago

Closed due to no response. If more info is presented we can open this again.