From 139d029446042c5904d947cb94278a8012e20a1c Mon Sep 17 00:00:00 2001 From: Adil Hanney Date: Tue, 14 May 2024 18:42:01 +0100 Subject: [PATCH] ref: use new color picker package --- lib/components/settings/settings_color.dart | 10 +++------- lib/components/toolbar/color_bar.dart | 4 ++-- pubspec.lock | 19 ++++++++++++++----- pubspec.yaml | 7 ++++++- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/lib/components/settings/settings_color.dart b/lib/components/settings/settings_color.dart index 8f510abd0..116487fac 100644 --- a/lib/components/settings/settings_color.dart +++ b/lib/components/settings/settings_color.dart @@ -1,6 +1,6 @@ +import 'package:flex_color_picker/flex_color_picker.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:saber/components/theming/adaptive_alert_dialog.dart'; import 'package:saber/data/prefs.dart'; import 'package:saber/i18n/strings.g.dart'; @@ -50,16 +50,12 @@ class _SettingsSwitchState extends State { } AdaptiveAlertDialog get colorPickerDialog { - final platform = Theme.of(context).platform; - final cupertino = - platform == TargetPlatform.iOS || platform == TargetPlatform.macOS; return AdaptiveAlertDialog( title: Text(t.settings.accentColorPicker.pickAColor), content: SingleChildScrollView( child: ColorPicker( - colorPickerWidth: cupertino ? 270 : 300, - portraitOnly: cupertino, - pickerColor: color ?? defaultColor, + color: color ?? defaultColor, + pickersEnabled: const {ColorPickerType.wheel: true}, onColorChanged: (Color color) { Prefs.accentColor.value = color.value; }, diff --git a/lib/components/toolbar/color_bar.dart b/lib/components/toolbar/color_bar.dart index cccc1bb1a..901665947 100644 --- a/lib/components/toolbar/color_bar.dart +++ b/lib/components/toolbar/color_bar.dart @@ -1,6 +1,6 @@ +import 'package:flex_color_picker/flex_color_picker.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:saber/components/theming/adaptive_alert_dialog.dart'; import 'package:saber/components/toolbar/color_option.dart'; @@ -319,7 +319,7 @@ class _ColorBarState extends State { title: Text(t.settings.accentColorPicker.pickAColor), content: SingleChildScrollView( child: ColorPicker( - pickerColor: pickedColor, + color: pickedColor, onColorChanged: (Color color) { pickedColor = color; }, diff --git a/pubspec.lock b/pubspec.lock index a24ad3e74..e166bc7df 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -417,6 +417,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + flex_color_picker: + dependency: "direct main" + description: + name: flex_color_picker + sha256: "5c846437069fb7afdd7ade6bf37e628a71d2ab0787095ddcb1253bf9345d5f3a" + url: "https://pub.dev" + source: hosted + version: "3.4.1" flex_seed_scheme: dependency: "direct main" description: @@ -431,12 +439,13 @@ packages: source: sdk version: "0.0.0" flutter_colorpicker: - dependency: "direct main" + dependency: "direct overridden" description: - name: flutter_colorpicker - sha256: "458a6ed8ea480eb16ff892aedb4b7092b2804affd7e046591fb03127e8d8ef8b" - url: "https://pub.dev" - source: hosted + path: "." + ref: HEAD + resolved-ref: "92bdb69a313a56c391ef148c12ef6539bd31253d" + url: "https://github.com/mchome/flutter_colorpicker" + source: git version: "1.0.3" flutter_driver: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index 976de84a5..b4bb13672 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -77,7 +77,7 @@ dependencies: slang: ^3.9.0 slang_flutter: - flutter_colorpicker: ^1.0.3 + flex_color_picker: ^3.4.1 google_fonts: ^6.0.0 @@ -184,6 +184,11 @@ dependency_overrides: git: url: https://github.com/adil192/simulator ref: fix-linux-support + + # https://github.com/mchome/flutter_colorpicker/issues/105 + flutter_colorpicker: + git: + url: https://github.com/mchome/flutter_colorpicker # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec