This repository has been archived on 2025-06-12. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Temperaturdecke/lib/screens/add_wool_modal.dart
2024-05-20 19:31:26 +02:00

97 lines
2.6 KiB
Dart

import 'package:flex_color_picker/flex_color_picker.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:temperaturdecke/db_test.dart';
import 'package:temperaturdecke/widgets/modal_wrapper.dart';
class AddWoolModal extends StatelessWidget {
AddWoolModal({super.key});
Color selectedColor = Colors.white;
String title = "";
String manufacture = "";
void setSelectedColor(Color color) {
selectedColor = color;
}
@override
Widget build(BuildContext context) {
return ModalWrapper(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 15,
),
Text(
"Randdaten",
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headlineSmall,
),
SizedBox(
height: 10,
),
TextField(
onChanged: (value) => {title = value},
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Name',
),
),
SizedBox(
height: 25,
),
TextField(
onChanged: (value) => {manufacture = value},
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Marke',
),
),
SizedBox(
height: 30,
),
Text(
"Farbe",
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headlineSmall,
),
SizedBox(
height: 10,
),
ColorPicker(
spacing: 8,
padding: EdgeInsets.all(0),
borderRadius: 10,
onColorChanged: (value) => setSelectedColor(value),
enableShadesSelection: false,
enableTonalPalette: true,
tonalColorSameSize: true,
pickersEnabled: {ColorPickerType.accent: false},
tonalSubheading: Divider(),
),
SizedBox(
height: 25,
),
Align(
alignment: Alignment.centerRight,
child: FilledButton(
onPressed: () => addWool(
context,
title,
manufacture,
selectedColor,
),
child: Text(
"Hinzufügen",
style: TextStyle(fontSize: 16),
),
),
)
],
),
title: "Wolle hinzufügen",
);
}
}