added ingredients list and dropdown textfield
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rezepte/widgets/dropdown_textfield.dart';
|
||||||
|
import 'package:rezepte/widgets/ingredients_list.dart';
|
||||||
|
|
||||||
import '../models/difficulty.dart';
|
import '../models/difficulty.dart';
|
||||||
import '../widgets/difficulty_dropdown.dart';
|
import '../widgets/difficulty_dropdown.dart';
|
||||||
@@ -39,6 +41,8 @@ class _CreateRecipeState extends State<CreateRecipe> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const DifficultyDropdown(),
|
const DifficultyDropdown(),
|
||||||
|
const IngredientsList(),
|
||||||
|
const DropdownTextfield(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
41
lib/widgets/dropdown_textfield.dart
Normal file
41
lib/widgets/dropdown_textfield.dart
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DropdownTextfield extends StatefulWidget {
|
||||||
|
const DropdownTextfield({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DropdownTextfield> createState() => _DropdownTextfieldState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DropdownTextfieldState extends State<DropdownTextfield> {
|
||||||
|
List<DropdownMenuItem> get _getDropdownItems {
|
||||||
|
return [
|
||||||
|
const DropdownMenuItem(
|
||||||
|
child: Text('rsitensroe'),
|
||||||
|
value: 1,
|
||||||
|
),
|
||||||
|
const DropdownMenuItem(
|
||||||
|
child: Text('rstiersnmti'),
|
||||||
|
value: 2,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final dropdownValue = _getDropdownItems.first.value;
|
||||||
|
return SizedBox(
|
||||||
|
width: 500,
|
||||||
|
child: TextField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
suffix: DropdownButton(
|
||||||
|
items: _getDropdownItems,
|
||||||
|
onChanged: _onDropdownChanged,
|
||||||
|
value: dropdownValue,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onDropdownChanged(value) {}
|
||||||
|
}
|
||||||
45
lib/widgets/ingredients_list.dart
Normal file
45
lib/widgets/ingredients_list.dart
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class IngredientsList extends StatefulWidget {
|
||||||
|
const IngredientsList({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<IngredientsList> createState() => _IngredientsListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _IngredientsListState extends State<IngredientsList> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: 2,
|
||||||
|
itemBuilder: _ingredientsBuilder,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget? _ingredientsBuilder(BuildContext context, int index) {
|
||||||
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth / 4,
|
||||||
|
child: const TextField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
label: Text('Ingredient'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: screenWidth / 4,
|
||||||
|
child: const TextField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
label: Text('Count'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user