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( decoration: const InputDecoration(
label: Text('Title'), label: Text('Title'),
), ),
style: TextStyle(
color: Theme.of(context).colorScheme.onBackground),
), ),
TextFormField( TextFormField(
onChanged: (value) => recipe.description = value, onChanged: (value) => recipe.description = value,
decoration: const InputDecoration( decoration: const InputDecoration(
label: Text('Description'), label: Text('Description'),
), ),
style: TextStyle(
color: Theme.of(context).colorScheme.onBackground),
), ),
DropdownMenu<Difficulty?>( DropdownMenu<Difficulty?>(
dropdownMenuEntries: DifficultyUtil.getDropdownList(), dropdownMenuEntries: DifficultyUtil.getDropdownList(),
onSelected: (value) => recipe.difficulty = value, onSelected: (value) => recipe.difficulty = value,
label: const Text('Difficulty'), label: const Text('Difficulty'),
textStyle: TextStyle(
color: Theme.of(context).colorScheme.onBackground),
), ),
ElevatedButton( ElevatedButton(
onPressed: _openIngredientBottomSheet, onPressed: _openIngredientBottomSheet,
@@ -87,27 +93,42 @@ class _CreateRecipeState extends State<CreateRecipe> {
recipe.ingredients.add(ingredient); recipe.ingredients.add(ingredient);
}); });
void _onIngredientRemoveTapped(int index) {}
Widget? _ingredientListBuilder(BuildContext context, int index) { Widget? _ingredientListBuilder(BuildContext context, int index) {
final ingredient = recipe.ingredients.elementAt(index); final ingredient = recipe.ingredients.elementAt(index);
final textTheme = Theme.of(context).textTheme.titleMedium;
return Padding( return ListTile(
padding: const EdgeInsets.symmetric(vertical: 10), contentPadding: EdgeInsets.zero,
child: Row( title: Text(ingredient.ingredient.title),
mainAxisAlignment: MainAxisAlignment.spaceBetween, subtitle: ingredient.optional ? const Text('optional') : null,
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [ children: [
Text(ingredient.ingredient.title, style: textTheme), Text(
Row( ingredient.amount.toString(),
children: [ style: Theme.of(context)
Text( .textTheme
ingredient.amount.toString(), .bodyLarge!
style: textTheme, .copyWith(color: Theme.of(context).colorScheme.onBackground),
), ),
const Padding(padding: EdgeInsets.symmetric(horizontal: 2)), const Padding(padding: EdgeInsets.symmetric(horizontal: 2)),
Text( Text(
ingredient.unit.name, ingredient.unit.name,
style: textTheme, 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", fontFamily: "Ubuntu",
useMaterial3: true, useMaterial3: true,
).copyWith( ).copyWith(
dividerTheme: const DividerThemeData(indent: 20, endIndent: 20), dividerTheme: const DividerThemeData(indent: 0, endIndent: 0),
); );
final lightTheme = _baseTheme.copyWith( final lightTheme = _baseTheme.copyWith(
@@ -17,8 +17,11 @@ final lightTheme = _baseTheme.copyWith(
)); ));
final darkTheme = _baseTheme.copyWith( final darkTheme = _baseTheme.copyWith(
colorScheme: ColorScheme.fromSeed( colorScheme: _darkColorScheme,
seedColor: Colors.purple.shade100, scaffoldBackgroundColor: _darkColorScheme.background,
brightness: Brightness.dark, );
),
final _darkColorScheme = ColorScheme.fromSeed(
seedColor: Colors.purple.shade100,
brightness: Brightness.dark,
); );