Added color picker

This commit is contained in:
Leandro 2024-05-20 00:13:52 +02:00
parent 22aca9618e
commit dcd05b53b4
5 changed files with 42 additions and 5 deletions

View file

@ -1,8 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:temperaturdecke/widgets/modal_wrapper.dart';
class AddWoolModal extends StatelessWidget {
const AddWoolModal({super.key});
AddWoolModal({super.key});
String selectedColor = "#FFFFFF";
void setSelectedColor(Color color) {
selectedColor = colorToHex(color);
}
@override
Widget build(BuildContext context) {
@ -11,6 +18,16 @@ class AddWoolModal extends StatelessWidget {
children: [
TextField(),
TextField(),
SizedBox(
height: 25,
),
ColorPicker(
displayThumbColor: false,
colorPickerWidth: 200,
enableAlpha: false,
pickerColor: Colors.black,
onColorChanged: setSelectedColor,
)
],
),
title: "Wolle hinzufügen",

View file

@ -25,6 +25,7 @@ class WoolScreen extends StatelessWidget {
floatingActionButton: FloatingActionButton(
onPressed: () {
showModalBottomSheet(
isScrollControlled: true,
showDragHandle: true,
context: context,
builder: (context) {

View file

@ -8,9 +8,14 @@ class ModalWrapper extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
child: SizedBox(
width: 750,
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
),
child: Wrap(
children: [
SizedBox(
width: 500,
height: MediaQuery.of(context).size.height - 100,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 25, vertical: 10),
child: Column(
@ -24,6 +29,10 @@ class ModalWrapper extends StatelessWidget {
child
],
),
)));
),
),
],
),
);
}
}

View file

@ -270,6 +270,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_colorpicker:
dependency: "direct main"
description:
name: flutter_colorpicker
sha256: "969de5f6f9e2a570ac660fb7b501551451ea2a1ab9e2097e89475f60e07816ea"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flutter_lints:
dependency: "direct dev"
description:

View file

@ -33,6 +33,8 @@ dependencies:
blobs:
flutter_colorpicker:
hexcolor:
dynamic_color: