Skip to content

Commit

Permalink
ref: use new color picker package
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed May 14, 2024
1 parent 0fd414c commit 139d029
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
10 changes: 3 additions & 7 deletions lib/components/settings/settings_color.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -50,16 +50,12 @@ class _SettingsSwitchState extends State<SettingsColor> {
}

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;
},
Expand Down
4 changes: 2 additions & 2 deletions lib/components/toolbar/color_bar.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -319,7 +319,7 @@ class _ColorBarState extends State<ColorBar> {
title: Text(t.settings.accentColorPicker.pickAColor),
content: SingleChildScrollView(
child: ColorPicker(
pickerColor: pickedColor,
color: pickedColor,
onColorChanged: (Color color) {
pickedColor = color;
},
Expand Down
19 changes: 14 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 139d029

Please sign in to comment.