changed theming of ingredient list

This commit is contained in:
SomnusVeritas
2023-11-01 15:44:52 +01:00
parent 83063f23d7
commit ef9da054ed
2 changed files with 47 additions and 23 deletions

View File

@@ -43,17 +43,23 @@ class _CreateRecipeState extends State<CreateRecipe> {
decoration: const InputDecoration(
label: Text('Title'),
),
style: TextStyle(
color: Theme.of(context).colorScheme.onBackground),
),
TextFormField(
onChanged: (value) => recipe.description = value,
decoration: const InputDecoration(
label: Text('Description'),
),
style: TextStyle(
color: Theme.of(context).colorScheme.onBackground),
),
DropdownMenu<Difficulty?>(
dropdownMenuEntries: DifficultyUtil.getDropdownList(),
onSelected: (value) => recipe.difficulty = value,
label: const Text('Difficulty'),
textStyle: TextStyle(
color: Theme.of(context).colorScheme.onBackground),
),
ElevatedButton(
onPressed: _openIngredientBottomSheet,
@@ -87,27 +93,42 @@ class _CreateRecipeState extends State<CreateRecipe> {
recipe.ingredients.add(ingredient);
});
void _onIngredientRemoveTapped(int index) {}
Widget? _ingredientListBuilder(BuildContext context, int index) {
final ingredient = recipe.ingredients.elementAt(index);
final textTheme = Theme.of(context).textTheme.titleMedium;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
return ListTile(
contentPadding: EdgeInsets.zero,
title: Text(ingredient.ingredient.title),
subtitle: ingredient.optional ? const Text('optional') : null,
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(ingredient.ingredient.title, style: textTheme),
Row(
children: [
Text(
ingredient.amount.toString(),
style: textTheme,
),
const Padding(padding: EdgeInsets.symmetric(horizontal: 2)),
Text(
ingredient.unit.name,
style: textTheme,
),
],
Text(
ingredient.amount.toString(),
style: Theme.of(context)
.textTheme
.bodyLarge!
.copyWith(color: Theme.of(context).colorScheme.onBackground),
),
const Padding(padding: EdgeInsets.symmetric(horizontal: 2)),
Text(
ingredient.unit.name,
style: Theme.of(context)
.textTheme
.bodyLarge!
.copyWith(color: Theme.of(context).colorScheme.onBackground),
),
const Padding(padding: EdgeInsets.symmetric(horizontal: 5)),
SizedBox(
width: 30,
height: 30,
child: IconButton(
padding: EdgeInsets.zero,
onPressed: () => _onIngredientRemoveTapped(index),
icon: const Icon(Icons.delete),
),
),
],
),

View File

@@ -4,7 +4,7 @@ final _baseTheme = ThemeData(
fontFamily: "Ubuntu",
useMaterial3: true,
).copyWith(
dividerTheme: const DividerThemeData(indent: 20, endIndent: 20),
dividerTheme: const DividerThemeData(indent: 0, endIndent: 0),
);
final lightTheme = _baseTheme.copyWith(
@@ -17,8 +17,11 @@ final lightTheme = _baseTheme.copyWith(
));
final darkTheme = _baseTheme.copyWith(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.purple.shade100,
brightness: Brightness.dark,
),
colorScheme: _darkColorScheme,
scaffoldBackgroundColor: _darkColorScheme.background,
);
final _darkColorScheme = ColorScheme.fromSeed(
seedColor: Colors.purple.shade100,
brightness: Brightness.dark,
);