Skip to content

Wheel breaks when wrapped with FittedBox & SizedBox #87

@LenaWirtz

Description

@LenaWirtz

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?

vlc-record-2024-05-15-12h21m07s-2024-05-15.12-18-28.mkv-.mp4
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<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  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;
                });
              },
            ),
          ),
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions