66 lines
1.8 KiB
Dart
66 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rezepte/widgets/ingredients_bottomsheet.dart';
|
|
import '../models/difficulty.dart';
|
|
|
|
class CreateRecipe extends StatefulWidget {
|
|
const CreateRecipe({super.key});
|
|
static const routeName = '/createRecipe';
|
|
|
|
@override
|
|
State<CreateRecipe> createState() => _CreateRecipeState();
|
|
}
|
|
|
|
class _CreateRecipeState extends State<CreateRecipe> {
|
|
Difficulty? _recipeDifficulty;
|
|
|
|
TextEditingController titleText = TextEditingController();
|
|
TextEditingController descriptionText = TextEditingController();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final width = MediaQuery.of(context).size.width;
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Create Recipe'),
|
|
),
|
|
body: Form(
|
|
child: Column(
|
|
children: [
|
|
TextFormField(
|
|
controller: titleText,
|
|
decoration: const InputDecoration(
|
|
label: Text('Title'),
|
|
),
|
|
),
|
|
TextFormField(
|
|
controller: descriptionText,
|
|
decoration: const InputDecoration(
|
|
label: Text('Description'),
|
|
),
|
|
),
|
|
DropdownMenu<Difficulty?>(
|
|
dropdownMenuEntries: DifficultyUtil.getDropdownList(),
|
|
onSelected: (value) {},
|
|
),
|
|
ElevatedButton(
|
|
onPressed: _openIngredientBottomSheet,
|
|
child: const Text('Add Ingredient'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _onChanged(int index) {
|
|
_recipeDifficulty = Difficulty.values.elementAt(index);
|
|
}
|
|
|
|
void _openIngredientBottomSheet() {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
builder: (context) => const IngredientsBottomsheet(),
|
|
);
|
|
}
|
|
}
|