diff --git a/lib/components/bottom_sheets/meal_plan_entry_more_bottom_sheet_component.dart b/lib/components/bottom_sheets/meal_plan_entry_more_bottom_sheet_component.dart index 15f603e..45ad624 100644 --- a/lib/components/bottom_sheets/meal_plan_entry_more_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/meal_plan_entry_more_bottom_sheet_component.dart @@ -12,74 +12,49 @@ Future mealPlanEntryMoreBottomSheet(BuildContext context, MealPlanEntry mealPlan MealPlanBloc mealPlanBloc = BlocProvider.of(context); return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - children: [ - Container( - height: 44, + builder: (btsContext) => Wrap( + children: [ + Container( alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - (mealPlan.recipe != null) ? mealPlan.recipe!.name : mealPlan.title, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 12, right: 12, bottom: 6), - child: Column( - children: [ + padding: const EdgeInsets.only(left: 12, right: 12, bottom: 6), + child: Column( + children: [ + ListTile( + onTap: () { + Navigator.pop(btsContext); + upsertMealPlanEntryDialog(context, mealPlan: mealPlan, referer: 'edit'); + }, + leading: const Icon(Icons.edit_outlined), + title: Text(AppLocalizations.of(context)!.edit) + ), + if (mealPlan.recipe != null) ListTile( onTap: () { Navigator.pop(btsContext); - upsertMealPlanEntryDialog(context, mealPlan: mealPlan, referer: 'edit'); + recipeShoppingListBottomSheet(context, mealPlan.recipe!); }, - leading: const Icon(Icons.edit_outlined), - title: Text(AppLocalizations.of(context)!.edit) + leading: const Icon(Icons.add_shopping_cart_outlined), + title: Text(AppLocalizations.of(context)!.addToShoppingList) ), - if (mealPlan.recipe != null) - ListTile( - onTap: () { - Navigator.pop(btsContext); - recipeShoppingListBottomSheet(context, mealPlan.recipe!); - }, - leading: const Icon(Icons.add_shopping_cart_outlined), - title: Text(AppLocalizations.of(context)!.addToShoppingList) - ), - const Divider(), - ListTile( - onTap: () { - Navigator.pop(btsContext); - mealPlanBloc.add(DeleteMealPlan(mealPlan: mealPlan)); - }, - leading: const Icon(Icons.delete_outline, color: Colors.redAccent), - title: Text( - AppLocalizations.of(context)!.mealPlanRemove, - style: const TextStyle(color: Colors.redAccent) - ) + const Divider(), + ListTile( + onTap: () { + Navigator.pop(btsContext); + mealPlanBloc.add(DeleteMealPlan(mealPlan: mealPlan)); + }, + leading: const Icon(Icons.delete_outline, color: Colors.redAccent), + title: Text( + AppLocalizations.of(context)!.mealPlanRemove, + style: const TextStyle(color: Colors.redAccent) ) - ] - ) - ) - ], - ), - ) + ) + ] + ) + ) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/meal_plan_more_bottom_sheet_component.dart b/lib/components/bottom_sheets/meal_plan_more_bottom_sheet_component.dart index e61c995..52d9eb3 100644 --- a/lib/components/bottom_sheets/meal_plan_more_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/meal_plan_more_bottom_sheet_component.dart @@ -5,66 +5,43 @@ import 'package:untare/components/dialogs/edit_meal_type_dialog.dart'; Future mealPlanMoreBottomSheet(BuildContext context) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - spacing: 15, - children: [ - Container( - height: 44, + builder: (btsContext) => Wrap( + spacing: 15, + children: [ + Container( alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - AppLocalizations.of(context)!.mealPlanTitle, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 - ), - ), - ), - Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 12, right: 12, bottom: 6), - child: Column( - children: [ - ListTile( - minLeadingWidth: 35, - onTap: () { - Navigator.pop(btsContext); - editMealTypeDialog(context); - }, - leading: const Icon(Icons.edit_outlined), - title: Text(AppLocalizations.of(context)!.editMealType), - ), - const Divider(), - ListTile( - minLeadingWidth: 35, - onTap: () { - Navigator.pop(btsContext); - deleteMealTypeDialog(context); - }, - leading: const Icon(Icons.delete_outline, color: Colors.redAccent), - title: Text( - AppLocalizations.of(context)!.removeMealType, - style: const TextStyle(color: Colors.redAccent), - ) + padding: const EdgeInsets.only(left: 12, right: 12, bottom: 6), + child: Column( + children: [ + ListTile( + minLeadingWidth: 35, + onTap: () { + Navigator.pop(btsContext); + editMealTypeDialog(context); + }, + leading: const Icon(Icons.edit_outlined), + title: Text(AppLocalizations.of(context)!.editMealType), + ), + const Divider(), + ListTile( + minLeadingWidth: 35, + onTap: () { + Navigator.pop(btsContext); + deleteMealTypeDialog(context); + }, + leading: const Icon(Icons.delete_outline, color: Colors.redAccent), + title: Text( + AppLocalizations.of(context)!.removeMealType, + style: const TextStyle(color: Colors.redAccent), ) - ] - ) - ) - ], - ), - ) + ) + ] + ) + ) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/recipe_more_bottom_sheet_component.dart b/lib/components/bottom_sheets/recipe_more_bottom_sheet_component.dart index ad158a5..3a147ff 100644 --- a/lib/components/bottom_sheets/recipe_more_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/recipe_more_bottom_sheet_component.dart @@ -4,39 +4,14 @@ import 'package:untare/models/recipe.dart'; Future recipeMoreBottomSheet(BuildContext context, Recipe recipe) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - spacing: 15, - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - recipe.name, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - buildRecipeMore(context, btsContext, recipe) - ], - ), - ) + builder: (btsContext) => Wrap( + spacing: 15, + children: [ + buildRecipeMore(context, btsContext, recipe) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/recipe_shopping_list_bottom_sheet_component.dart b/lib/components/bottom_sheets/recipe_shopping_list_bottom_sheet_component.dart index 6c72dc2..27858b1 100644 --- a/lib/components/bottom_sheets/recipe_shopping_list_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/recipe_shopping_list_bottom_sheet_component.dart @@ -6,38 +6,30 @@ import 'package:untare/models/recipe.dart'; Future recipeShoppingListBottomSheet(BuildContext context, Recipe recipe) { return showModalBottomSheet( isScrollControlled: true, - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - recipe.name, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, + builder: (btsContext) => Wrap( + children: [ + Container( + height: 44, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), + ), + child: Text( + recipe.name, + textAlign: TextAlign.center, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18 ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), - SizedBox(height: 600,child: RecipeShoppingListWidget(recipe: recipe, btsContext: btsContext)) - ], - ), - ) + ), + SizedBox(height: 600,child: RecipeShoppingListWidget(recipe: recipe, btsContext: btsContext)) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/recipes_more_bottom_sheet_component.dart b/lib/components/bottom_sheets/recipes_more_bottom_sheet_component.dart index 92096cf..cb72af6 100644 --- a/lib/components/bottom_sheets/recipes_more_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/recipes_more_bottom_sheet_component.dart @@ -5,66 +5,44 @@ import 'package:untare/pages/units_page.dart'; Future recipesBottomSheet(BuildContext context) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - AppLocalizations.of(context)!.recipesTitle, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 + builder: (btsContext) => Wrap( + children: [ + Container( + alignment: Alignment.center, + padding: const EdgeInsets.only(left: 12, right: 12), + child: Column( + children: [ + ListTile( + minLeadingWidth: 35, + onTap: () { + Navigator.pop(btsContext); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const FoodsPage()), + ); + }, + leading: const Icon(Icons.edit_note_outlined), + title: Text(AppLocalizations.of(context)!.manageFoods), ), - ), - ), - Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 12, right: 12), - child: Column( - children: [ - ListTile( + ListTile( minLeadingWidth: 35, onTap: () { Navigator.pop(btsContext); Navigator.push( context, - MaterialPageRoute(builder: (context) => const FoodsPage()), + MaterialPageRoute(builder: (context) => const UnitsPage()), ); }, leading: const Icon(Icons.edit_note_outlined), - title: Text(AppLocalizations.of(context)!.manageFoods), - ), - ListTile( - minLeadingWidth: 35, - onTap: () { - Navigator.pop(btsContext); - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const UnitsPage()), - ); - }, - leading: const Icon(Icons.edit_note_outlined), - title: Text(AppLocalizations.of(context)!.manageUnits) - ) - ], - ), - ) - ], - ), - ) + title: Text(AppLocalizations.of(context)!.manageUnits) + ) + ], + ), + ) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/settings_default_page_bottom_sheet_component.dart b/lib/components/bottom_sheets/settings_default_page_bottom_sheet_component.dart index 45b9098..eef5324 100644 --- a/lib/components/bottom_sheets/settings_default_page_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/settings_default_page_bottom_sheet_component.dart @@ -5,63 +5,41 @@ import 'package:untare/cubits/settings_cubit.dart'; Future settingsDefaultPageBottomSheet(BuildContext context) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - AppLocalizations.of(context)!.settingsDefaultPage, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 + builder: (btsContext) => Wrap( + children: [ + Container( + alignment: Alignment.center, + padding: const EdgeInsets.only(left: 12, right: 12), + child: Column( + children: [ + ListTile( + onTap: () { + context.read().changeDefaultPageTo('plan'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.mealPlanTitle), ), - ), + ListTile( + onTap: () { + context.read().changeDefaultPageTo('recipes'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.recipesTitle), + ), + ListTile( + onTap: () { + context.read().changeDefaultPageTo('shopping'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.shoppingListTitle), + ) + ], ), - Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 12, right: 12), - child: Column( - children: [ - ListTile( - onTap: () { - context.read().changeDefaultPageTo('plan'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.mealPlanTitle), - ), - ListTile( - onTap: () { - context.read().changeDefaultPageTo('recipes'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.recipesTitle), - ), - ListTile( - onTap: () { - context.read().changeDefaultPageTo('shopping'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.shoppingListTitle), - ) - ], - ), - ) - ], - ), - ) + ) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/settings_layout_bottom_sheet_component.dart b/lib/components/bottom_sheets/settings_layout_bottom_sheet_component.dart index 76fb322..3abc004 100644 --- a/lib/components/bottom_sheets/settings_layout_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/settings_layout_bottom_sheet_component.dart @@ -5,56 +5,34 @@ import 'package:untare/cubits/settings_cubit.dart'; Future settingsLayoutBottomSheet(BuildContext context) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - AppLocalizations.of(context)!.settingsRecipeLayout, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 + builder: (btsContext) => Wrap( + children: [ + Container( + alignment: Alignment.center, + padding: const EdgeInsets.only(left: 12, right: 12), + child: Column( + children: [ + ListTile( + onTap: () { + context.read().changeLayoutTo('card'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.settingRecipeLayoutCard), ), - ), + ListTile( + onTap: () { + context.read().changeLayoutTo('list'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.settingRecipeLayoutList), + ) + ], ), - Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 12, right: 12), - child: Column( - children: [ - ListTile( - onTap: () { - context.read().changeLayoutTo('card'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.settingRecipeLayoutCard), - ), - ListTile( - onTap: () { - context.read().changeLayoutTo('list'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.settingRecipeLayoutList), - ) - ], - ), - ) - ], - ), - ) + ) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/settings_theme_bottom_sheet_component.dart b/lib/components/bottom_sheets/settings_theme_bottom_sheet_component.dart index 2eb39b4..4f833fb 100644 --- a/lib/components/bottom_sheets/settings_theme_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/settings_theme_bottom_sheet_component.dart @@ -5,63 +5,41 @@ import 'package:untare/cubits/settings_cubit.dart'; Future settingsThemeBottomSheet(BuildContext context) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - AppLocalizations.of(context)!.settingsThemeMode, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 + builder: (btsContext) => Wrap( + children: [ + Container( + alignment: Alignment.center, + padding: const EdgeInsets.only(left: 12, right: 12), + child: Column( + children: [ + ListTile( + onTap: () { + context.read().changeThemeTo('dark'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.settingsDarkMode), ), - ), + ListTile( + onTap: () { + context.read().changeThemeTo('light'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.settingsLightMode), + ), + ListTile( + onTap: () { + context.read().changeThemeTo('system'); + Navigator.pop(btsContext); + }, + title: Text(AppLocalizations.of(context)!.settingsSystemMode), + ) + ], ), - Container( - alignment: Alignment.center, - padding: const EdgeInsets.only(left: 12, right: 12), - child: Column( - children: [ - ListTile( - onTap: () { - context.read().changeThemeTo('dark'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.settingsDarkMode), - ), - ListTile( - onTap: () { - context.read().changeThemeTo('light'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.settingsLightMode), - ), - ListTile( - onTap: () { - context.read().changeThemeTo('system'); - Navigator.pop(btsContext); - }, - title: Text(AppLocalizations.of(context)!.settingsSystemMode), - ) - ], - ), - ) - ], - ), - ) + ) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/shopping_list_more_bottom_sheet_component.dart b/lib/components/bottom_sheets/shopping_list_more_bottom_sheet_component.dart index baf620c..7c66ff5 100644 --- a/lib/components/bottom_sheets/shopping_list_more_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/shopping_list_more_bottom_sheet_component.dart @@ -1,40 +1,16 @@ import 'package:flutter/material.dart'; import 'package:untare/components/widgets/bottom_sheets/shopping_list_more_component.dart'; -import 'package:flutter_gen/gen_l10n/app_locales.dart'; Future shoppingListMoreBottomSheet(BuildContext context) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (btsContext) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - spacing: 15, - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - AppLocalizations.of(context)!.shoppingListTitle, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 - ), - ), - ), - buildShoppingListMore(context, btsContext) - ], - ), - ) + builder: (btsContext) => Wrap( + spacing: 15, + children: [ + buildShoppingListMore(context, btsContext) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/bottom_sheets/sort_bottom_sheet_component.dart b/lib/components/bottom_sheets/sort_bottom_sheet_component.dart index 42491b9..2595285 100644 --- a/lib/components/bottom_sheets/sort_bottom_sheet_component.dart +++ b/lib/components/bottom_sheets/sort_bottom_sheet_component.dart @@ -4,36 +4,28 @@ import 'package:flutter_gen/gen_l10n/app_locales.dart'; Future sortBottomSheet(BuildContext context, Function(String, bool) sortButtonPressed, Map sortMap) { return showModalBottomSheet( - backgroundColor: Colors.transparent, + showDragHandle: true, useRootNavigator: true, context: context, - builder: (context) => Container( - decoration: BoxDecoration( - color: Theme.of(context).scaffoldBackgroundColor, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - margin: const EdgeInsets.all(12), - child: Wrap( - spacing: 15, - children: [ - Container( - height: 44, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300] : Colors.grey[700] - ), - child: Text( - AppLocalizations.of(context)!.sortBy, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18 - ), + builder: (context) => Wrap( + spacing: 15, + children: [ + Container( + height: 44, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), + ), + child: Text( + AppLocalizations.of(context)!.sortBy, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18 ), ), - buildSort(context, sortButtonPressed, sortMap) - ], - ), - ) + ), + buildSort(context, sortButtonPressed, sortMap) + ], + ), ); } \ No newline at end of file diff --git a/lib/components/dialogs/add_shopping_list_entry_dialog.dart b/lib/components/dialogs/add_shopping_list_entry_dialog.dart index a504c1a..62531aa 100644 --- a/lib/components/dialogs/add_shopping_list_entry_dialog.dart +++ b/lib/components/dialogs/add_shopping_list_entry_dialog.dart @@ -44,7 +44,6 @@ Future addShoppingListEntryDialog(BuildContext context) { }); }, initialValue: simpleMode, - activeColor: Theme.of(context).primaryColor, decoration: const InputDecoration( border: InputBorder.none ), @@ -72,8 +71,7 @@ Future addShoppingListEntryDialog(BuildContext context) { ) ), const SizedBox(height: 15), - MaterialButton( - color: Theme.of(context).primaryColor, + ElevatedButton( child: Text(AppLocalizations.of(context)!.add), onPressed: () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/delete_meal_type_dialog.dart b/lib/components/dialogs/delete_meal_type_dialog.dart index ee50eb6..d4419b6 100644 --- a/lib/components/dialogs/delete_meal_type_dialog.dart +++ b/lib/components/dialogs/delete_meal_type_dialog.dart @@ -50,8 +50,7 @@ Future deleteMealTypeDialog(BuildContext context) async { const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/delete_recipe_dialog.dart b/lib/components/dialogs/delete_recipe_dialog.dart index 7c108e2..35b305c 100644 --- a/lib/components/dialogs/delete_recipe_dialog.dart +++ b/lib/components/dialogs/delete_recipe_dialog.dart @@ -24,16 +24,15 @@ Future deleteRecipeDialog(BuildContext context, Recipe recipe) async { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - MaterialButton( - color: Colors.redAccent, + ElevatedButton( + style: ElevatedButton.styleFrom(backgroundColor: Colors.redAccent, foregroundColor: Colors.white), onPressed: () { recipeBloc.add(DeleteRecipe(recipe: recipe)); Navigator.pop(dContext); }, child: Text(AppLocalizations.of(context)!.remove) ), - MaterialButton( - color: Theme.of(context).primaryColor, + ElevatedButton( onPressed: () { Navigator.pop(dContext); }, diff --git a/lib/components/dialogs/delete_supermarket_category_dialog.dart b/lib/components/dialogs/delete_supermarket_category_dialog.dart index 3d379ea..b4a02fb 100644 --- a/lib/components/dialogs/delete_supermarket_category_dialog.dart +++ b/lib/components/dialogs/delete_supermarket_category_dialog.dart @@ -49,8 +49,7 @@ Future deleteSupermarketCategoryDialog(BuildContext context) async { const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/edit_food_dialog.dart b/lib/components/dialogs/edit_food_dialog.dart index b5e78c7..ad6cd0c 100644 --- a/lib/components/dialogs/edit_food_dialog.dart +++ b/lib/components/dialogs/edit_food_dialog.dart @@ -50,8 +50,7 @@ Future editFoodDialog(BuildContext context, Food food) { const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); if (formBuilderKey.currentState!.validate()) { diff --git a/lib/components/dialogs/edit_meal_type_dialog.dart b/lib/components/dialogs/edit_meal_type_dialog.dart index aa96aa9..47d9b16 100644 --- a/lib/components/dialogs/edit_meal_type_dialog.dart +++ b/lib/components/dialogs/edit_meal_type_dialog.dart @@ -76,8 +76,7 @@ Future editMealTypeDialog(BuildContext context) async { const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: isVisible ? () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/edit_share_dialog.dart b/lib/components/dialogs/edit_share_dialog.dart index fba7b35..fbf819d 100644 --- a/lib/components/dialogs/edit_share_dialog.dart +++ b/lib/components/dialogs/edit_share_dialog.dart @@ -48,7 +48,7 @@ Future editShareDialog(BuildContext context, UserSetting userSetting, String ref ), FormBuilderFilterChip ( name: 'share', - checkmarkColor: Theme.of(context).primaryColor, + checkmarkColor: Theme.of(context).colorScheme.primary, initialValue: (referer == 'shopping') ? userSetting.shoppingShare.map((user) => user.id).toList() : userSetting.planShare.map((user) => user.id).toList(), decoration: InputDecoration( labelText: AppLocalizations.of(context)!.shareWith, @@ -60,8 +60,7 @@ Future editShareDialog(BuildContext context, UserSetting userSetting, String ref const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/edit_shopping_list_entry_dialog.dart b/lib/components/dialogs/edit_shopping_list_entry_dialog.dart index 2d5c746..b07d40f 100644 --- a/lib/components/dialogs/edit_shopping_list_entry_dialog.dart +++ b/lib/components/dialogs/edit_shopping_list_entry_dialog.dart @@ -51,8 +51,7 @@ Future editShoppingListEntryDialog(BuildContext context, ShoppingListEntry shopp const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); if (formBuilderKey.currentState!.validate()) { diff --git a/lib/components/dialogs/edit_shopping_list_recent_days_dialog.dart b/lib/components/dialogs/edit_shopping_list_recent_days_dialog.dart index 08c322b..e003df5 100644 --- a/lib/components/dialogs/edit_shopping_list_recent_days_dialog.dart +++ b/lib/components/dialogs/edit_shopping_list_recent_days_dialog.dart @@ -45,8 +45,7 @@ Future editShoppingListRecentDaysDialog(BuildContext context, UserSetting userSe const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/edit_shopping_list_refresh_dialog.dart b/lib/components/dialogs/edit_shopping_list_refresh_dialog.dart index fb1212e..dd8ed07 100644 --- a/lib/components/dialogs/edit_shopping_list_refresh_dialog.dart +++ b/lib/components/dialogs/edit_shopping_list_refresh_dialog.dart @@ -45,8 +45,7 @@ Future editShoppingListRefreshDialog(BuildContext context, UserSetting userSetti const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/edit_supermarket_category_dialog.dart b/lib/components/dialogs/edit_supermarket_category_dialog.dart index f8950a5..4e62cf9 100644 --- a/lib/components/dialogs/edit_supermarket_category_dialog.dart +++ b/lib/components/dialogs/edit_supermarket_category_dialog.dart @@ -76,8 +76,7 @@ Future editSupermarketCategoryDialog(BuildContext context) async { const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: isVisible ? () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/edit_unit_dialog.dart b/lib/components/dialogs/edit_unit_dialog.dart index 7913e9d..2833fbb 100644 --- a/lib/components/dialogs/edit_unit_dialog.dart +++ b/lib/components/dialogs/edit_unit_dialog.dart @@ -50,8 +50,7 @@ Future editUnitDialog(BuildContext context, Unit unit) { const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); if (formBuilderKey.currentState!.validate()) { diff --git a/lib/components/dialogs/import_recipe_website_dialog.dart b/lib/components/dialogs/import_recipe_website_dialog.dart index e051215..a1d42da 100644 --- a/lib/components/dialogs/import_recipe_website_dialog.dart +++ b/lib/components/dialogs/import_recipe_website_dialog.dart @@ -48,15 +48,13 @@ Future importRecipeWebsiteDialog(BuildContext context) { }); }, initialValue: splitInstructions, - activeColor: Theme.of(context).primaryColor, decoration: const InputDecoration( border: InputBorder.none ), ), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); diff --git a/lib/components/dialogs/upsert_meal_plan_entry_dialog.dart b/lib/components/dialogs/upsert_meal_plan_entry_dialog.dart index ffa1390..880bff1 100644 --- a/lib/components/dialogs/upsert_meal_plan_entry_dialog.dart +++ b/lib/components/dialogs/upsert_meal_plan_entry_dialog.dart @@ -124,7 +124,7 @@ Future upsertMealPlanEntryDialog(BuildContext context, {MealPlanEntry? mealPlan, const SizedBox(height: 15), FormBuilderFilterChip ( name: 'share', - checkmarkColor: Theme.of(context).primaryColor, + checkmarkColor: Theme.of(context).colorScheme.primary, initialValue: sharedUsers.map((user) => user.id).toList(), decoration: InputDecoration( labelText: AppLocalizations.of(context)!.shareWith, @@ -136,8 +136,7 @@ Future upsertMealPlanEntryDialog(BuildContext context, {MealPlanEntry? mealPlan, const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formBuilderKey.currentState!.save(); if (formBuilderKey.currentState!.validate()) { diff --git a/lib/components/dialogs/upsert_recipe_ingredient_dialog.dart b/lib/components/dialogs/upsert_recipe_ingredient_dialog.dart index b2784df..3002d7e 100644 --- a/lib/components/dialogs/upsert_recipe_ingredient_dialog.dart +++ b/lib/components/dialogs/upsert_recipe_ingredient_dialog.dart @@ -48,8 +48,7 @@ Future upsertRecipeIngredientDialog(BuildContext context, int stepIndex, int ing const SizedBox(height: 10), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( child: Text((ingredient != null) ? AppLocalizations.of(context)!.edit : AppLocalizations.of(context)!.add), onPressed: () { diff --git a/lib/components/dialogs/upsert_recipe_step_time_dialog.dart b/lib/components/dialogs/upsert_recipe_step_time_dialog.dart index 2a12ff7..ea7df7f 100644 --- a/lib/components/dialogs/upsert_recipe_step_time_dialog.dart +++ b/lib/components/dialogs/upsert_recipe_step_time_dialog.dart @@ -36,8 +36,7 @@ Future upsertRecipeStepTimeDialog(BuildContext context, int stepIndex, Function( const SizedBox(height: 15), Container( alignment: Alignment.bottomRight, - child: MaterialButton( - color: Theme.of(context).primaryColor, + child: ElevatedButton( onPressed: () { formKey.currentState!.setInternalFieldValue('stepIndex', stepIndex); formKey.currentState!.save(); diff --git a/lib/components/loading_component.dart b/lib/components/loading_component.dart index 9ebad48..82e0b64 100644 --- a/lib/components/loading_component.dart +++ b/lib/components/loading_component.dart @@ -9,7 +9,7 @@ Widget buildLoading() { child: Center( child: CircularProgressIndicator( strokeWidth: 2, - color: Theme.of(context).primaryColor + color: Theme.of(context).colorScheme.primary ), ) ); diff --git a/lib/components/recipes/recipe_grid_component.dart b/lib/components/recipes/recipe_grid_component.dart index f883a75..932aa3d 100644 --- a/lib/components/recipes/recipe_grid_component.dart +++ b/lib/components/recipes/recipe_grid_component.dart @@ -11,7 +11,7 @@ import 'package:untare/pages/recipe_detail_page.dart'; Widget recipeGridComponent(Recipe recipe, BuildContext context, {String? referer, MealPlanEntry? mealPlan, bool? disabled}) { BoxDecoration recipeTimeDecoration = BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.white.withOpacity(0.8) : Colors.grey[800]!.withOpacity(0.8), + color: Theme.of(context).colorScheme.tertiaryContainer, borderRadius: BorderRadius.circular(30) ); @@ -28,7 +28,7 @@ Widget recipeGridComponent(Recipe recipe, BuildContext context, {String? referer } if (mealPlan != null) { widgets.add( - Flexible(child: Text(mealPlan.mealType.name, style: const TextStyle(fontSize: 11))) + Flexible(child: Text(mealPlan.mealType.name, style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onTertiaryContainer))) ); } @@ -88,7 +88,7 @@ Widget recipeGridComponent(Recipe recipe, BuildContext context, {String? referer padding: const EdgeInsets.fromLTRB(5, 3, 5, 3), margin: const EdgeInsets.all(5), decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.white.withOpacity(0.8) : Colors.grey[800]!.withOpacity(0.8), + color: Theme.of(context).colorScheme.tertiaryContainer, borderRadius: BorderRadius.circular(30) ), child: Row( diff --git a/lib/components/recipes/recipe_image_component.dart b/lib/components/recipes/recipe_image_component.dart index 71cc1d8..8f2b727 100644 --- a/lib/components/recipes/recipe_image_component.dart +++ b/lib/components/recipes/recipe_image_component.dart @@ -16,7 +16,7 @@ Widget buildRecipeImage(Recipe recipe, BorderRadius borderRadius, double height, height: height, width: double.maxFinite, decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[100]! : Colors.grey[700], + color: Theme.of(context).colorScheme.secondary, borderRadius: borderRadius, boxShadow: [ if (boxShadow != null) boxShadow @@ -29,13 +29,13 @@ Widget buildRecipeImage(Recipe recipe, BorderRadius borderRadius, double height, ), placeholder: (context, url) => Shimmer.fromColors( enabled: true, - baseColor: (Theme.of(context).brightness.name == 'light') ? Colors.grey[100]! : Colors.grey[700]!, - highlightColor: (Theme.of(context).brightness.name == 'light') ? Colors.grey[200]! : Colors.grey[600]!, + baseColor: Theme.of(context).colorScheme.secondary, + highlightColor: Theme.of(context).colorScheme.onSecondary, child: Container( height: height, width: double.maxFinite, decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[100] : Colors.grey[700], + color: Theme.of(context).colorScheme.secondary, borderRadius: borderRadius, ), ), @@ -45,13 +45,13 @@ Widget buildRecipeImage(Recipe recipe, BorderRadius borderRadius, double height, height: height, width: double.maxFinite, decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.black12 : Colors.grey[700], + color: Theme.of(context).colorScheme.secondary, borderRadius: borderRadius, ), child: Center( child: Icon( Icons.restaurant_menu_outlined, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black38 : Colors.grey[400], + color: Theme.of(context).colorScheme.onSecondary, ), ), ); @@ -65,14 +65,14 @@ Widget buildRecipeImage(Recipe recipe, BorderRadius borderRadius, double height, height: height, width: double.maxFinite, decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.black12 : Colors.grey[700], + color: Theme.of(context).colorScheme.secondary, borderRadius: borderRadius, ), child: Container( alignment: Alignment.center, child: Icon( Icons.restaurant_menu_outlined, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black38 : Colors.grey[400], + color: Theme.of(context).colorScheme.onSecondary, ), ), ); diff --git a/lib/components/recipes/recipe_list_component.dart b/lib/components/recipes/recipe_list_component.dart index 641b283..0297c91 100644 --- a/lib/components/recipes/recipe_list_component.dart +++ b/lib/components/recipes/recipe_list_component.dart @@ -50,7 +50,7 @@ Widget recipeListComponent(Recipe recipe, BuildContext context, {String? referer rating(recipe, context), if (mealPlan != null) Flexible( - child: Text(mealPlan.mealType.name, style: TextStyle(color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[600] : Colors.grey, fontSize: 12)) + child: Text(mealPlan.mealType.name, style: TextStyle(color: Theme.of(context).colorScheme.secondary.withOpacity(0.8), fontSize: 12)) ) ], ) : null, @@ -65,12 +65,12 @@ Widget lastCooked(Recipe recipe, BuildContext context) { Icon( Icons.restaurant_outlined, size: 12, - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[600] : Colors.grey + color: Theme.of(context).colorScheme.secondary.withOpacity(0.8) ), const SizedBox(width: 2), Text( DateFormat('dd.MM.yy').format(DateTime.parse(recipe.lastCooked!).toLocal()), - style: TextStyle(color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[600] : Colors.grey, fontSize: 12) + style: TextStyle(color: Theme.of(context).colorScheme.secondary.withOpacity(0.8), fontSize: 12) ), const SizedBox(width: 8) ], @@ -87,7 +87,7 @@ Widget rating (Recipe recipe, BuildContext context) { recipe.rating.toString(), style: TextStyle( fontSize: 12, - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[600] : Colors.grey + color: Theme.of(context).colorScheme.secondary.withOpacity(0.8) ) ), const SizedBox(width: 2), diff --git a/lib/components/recipes/recipes_list_component.dart b/lib/components/recipes/recipes_list_component.dart index b42d6d9..615f4b1 100644 --- a/lib/components/recipes/recipes_list_component.dart +++ b/lib/components/recipes/recipes_list_component.dart @@ -12,7 +12,7 @@ Widget buildRecipesList(List recipesWidgetList) { padding: const EdgeInsets.only(left: 10, right: 10), child: Divider( thickness: 0.5, - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), ), ), ], diff --git a/lib/components/widgets/recipe_detail_tabbar_widget.dart b/lib/components/widgets/recipe_detail_tabbar_widget.dart index f464cf4..d813076 100644 --- a/lib/components/widgets/recipe_detail_tabbar_widget.dart +++ b/lib/components/widgets/recipe_detail_tabbar_widget.dart @@ -88,9 +88,8 @@ class RecipeDetailTabBarWidgetState extends State { onPressed: () => { decrement() }, - icon: Icon( + icon: const Icon( Icons.remove_circle_outline, - color: Theme.of(context).primaryColor, ), ), Text(newServings.toString()), @@ -98,9 +97,8 @@ class RecipeDetailTabBarWidgetState extends State { onPressed: () => { increment() }, - icon: Icon( + icon: const Icon( Icons.add_circle_outline_outlined, - color: Theme.of(context).primaryColor, ) ) ], @@ -154,9 +152,9 @@ class RecipeDetailTabBarWidgetState extends State { ), title: Text( recipe.steps[i].stepRecipeData!.name, - style: TextStyle(color: Theme.of(context).primaryColor, fontWeight: FontWeight.w600), + style: const TextStyle(fontWeight: FontWeight.w600), ), - trailing: Icon(Icons.arrow_forward_outlined, color: Theme.of(context).primaryColor), + trailing: const Icon(Icons.arrow_forward_outlined), ), ) ); @@ -234,31 +232,26 @@ class RecipeDetailTabBarWidgetState extends State { alignment: Alignment.center, decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(color: Theme.of(context).primaryColor, width: 2), + border: Border.all(color: Theme.of(context).colorScheme.secondary, width: 2), ), - child:Text((stepNumber).toString(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Theme.of(context).primaryColor)), + child: Text((stepNumber).toString(), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), ) ), if (stepName != null && stepName != '') Text( '$stepName ', - style: TextStyle( + style: const TextStyle( fontStyle: FontStyle.italic, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, fontSize: 15.5 ) ), if (stepTime != null && stepTime != 0) Row( children: [ - Icon(Icons.timer_outlined, size: 15.5, color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!), + Icon(Icons.timer_outlined, size: 15.5, color: Theme.of(context).colorScheme.secondary), Text( ' $stepTime min', - style: TextStyle( - fontStyle: FontStyle.italic, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, - fontSize: 15.5 - ) + style: const TextStyle(fontStyle: FontStyle.italic, fontSize: 15.5) ) ], ) @@ -266,7 +259,7 @@ class RecipeDetailTabBarWidgetState extends State { ), IconButton( icon: const Icon(Icons.check), - color: (collapsed) ? Theme.of(context).primaryColor : ((Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!), + color: (collapsed) ? Theme.of(context).colorScheme.secondary.withOpacity(0.5) : Theme.of(context).colorScheme.secondary, onPressed: () { setState(() { collapsed = !collapsed; @@ -280,7 +273,7 @@ class RecipeDetailTabBarWidgetState extends State { decoration: BoxDecoration( border: Border( left: BorderSide( - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.secondary, width: 1 ) ) @@ -335,7 +328,7 @@ class RecipeDetailTabBarWidgetState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) @@ -356,7 +349,7 @@ class RecipeDetailTabBarWidgetState extends State { ), child: Text( food, - style: TextStyle(color: Theme.of(context).primaryColor, fontWeight: FontWeight.w600), + style: const TextStyle(fontWeight: FontWeight.w600), ), ), if (recipe == null) @@ -364,7 +357,7 @@ class RecipeDetailTabBarWidgetState extends State { Text( note, style: TextStyle( - color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), fontStyle: FontStyle.italic, fontSize: 15 ) @@ -384,7 +377,7 @@ class RecipeDetailTabBarWidgetState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) @@ -427,7 +420,7 @@ class RecipeDetailTabBarWidgetState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) diff --git a/lib/components/widgets/recipe_shopping_list_stateful_widget.dart b/lib/components/widgets/recipe_shopping_list_stateful_widget.dart index 5c8b3f0..b7de3c3 100644 --- a/lib/components/widgets/recipe_shopping_list_stateful_widget.dart +++ b/lib/components/widgets/recipe_shopping_list_stateful_widget.dart @@ -146,9 +146,8 @@ class RecipeShoppingListWidgetState extends State { onPressed: () => { decrement() }, - icon: Icon( + icon: const Icon( Icons.remove_circle_outline, - color: Theme.of(context).primaryColor, ), ), Text(newServings.toString()), @@ -156,9 +155,8 @@ class RecipeShoppingListWidgetState extends State { onPressed: () => { increment() }, - icon: Icon( + icon: const Icon( Icons.add_circle_outline_outlined, - color: Theme.of(context).primaryColor, ) ) ], @@ -185,17 +183,7 @@ class RecipeShoppingListWidgetState extends State { ), child: Container( padding: const EdgeInsets.fromLTRB(20, 30, 20, 20), - decoration: BoxDecoration( - border: Border( - top: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, - width: 1 - ) - ) - ), - child: MaterialButton( - color: Theme.of(context).primaryColor, - minWidth: double.maxFinite, + child: ElevatedButton( child: Text(AppLocalizations.of(context)!.add), onPressed: () { recipeBloc.add(AddIngredientsToShoppingList( @@ -259,7 +247,7 @@ class RecipeShoppingListWidgetState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) @@ -270,12 +258,8 @@ class RecipeShoppingListWidgetState extends State { visualDensity: const VisualDensity(horizontal: 0, vertical: -3), contentPadding: const EdgeInsets.fromLTRB(0, 0, 0, 0), leading: Transform.scale( - scale: 1.2, - child: Checkbox( - activeColor: Theme.of(context).primaryColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(3) - ), + scale: 1.2, + child: Checkbox( onChanged: (bool? value) { setState(() { checkBoxValue = value; @@ -330,7 +314,7 @@ class RecipeShoppingListWidgetState extends State { icon: Icon( Icons.home_outlined, size: 21, - color: (ingredient.food != null && ingredient.food!.onHand!) ? Theme.of(context).primaryColor : null, + color: (ingredient.food != null && ingredient.food!.onHand!) ? Theme.of(context).colorScheme.secondary.withOpacity(0.5) : Theme.of(context).colorScheme.secondary, ) ), ], diff --git a/lib/components/widgets/recipe_upsert_steps_stateful_widget.dart b/lib/components/widgets/recipe_upsert_steps_stateful_widget.dart index 1b0ec08..93613ad 100644 --- a/lib/components/widgets/recipe_upsert_steps_stateful_widget.dart +++ b/lib/components/widgets/recipe_upsert_steps_stateful_widget.dart @@ -146,7 +146,7 @@ class RecipeUpsertStepsWidgetState extends State { alignment: Alignment.center, decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(color: Theme.of(context).primaryColor, width: 2), + border: Border.all(color: Theme.of(context).colorScheme.primary, width: 2), ), child: IconButton( padding: const EdgeInsets.all(0), @@ -154,7 +154,7 @@ class RecipeUpsertStepsWidgetState extends State { visualDensity: const VisualDensity(horizontal: -4, vertical: -4), icon: Icon( Icons.add, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, ), onPressed: () => _addStep(), ), @@ -203,9 +203,9 @@ class RecipeUpsertStepsWidgetState extends State { alignment: Alignment.center, decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(color: Theme.of(context).primaryColor, width: 2), + border: Border.all(color: Theme.of(context).colorScheme.primary, width: 2), ), - child: Text((stepIndex+1).toString(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Theme.of(context).primaryColor)), + child: Text((stepIndex+1).toString(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Theme.of(context).colorScheme.primary)), ) ), Container( @@ -213,7 +213,7 @@ class RecipeUpsertStepsWidgetState extends State { decoration: BoxDecoration( border: Border( left: BorderSide( - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, width: 1 ) ) @@ -226,7 +226,7 @@ class RecipeUpsertStepsWidgetState extends State { splashRadius: 20, icon: Icon( Icons.add, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, ), onPressed: () { upsertRecipeIngredientDialog(context, stepIndex, ingredients.length, _upsertIngredient); @@ -243,7 +243,7 @@ class RecipeUpsertStepsWidgetState extends State { decoration: BoxDecoration( border: Border( left: BorderSide( - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, width: 1 ) ) @@ -294,7 +294,7 @@ class RecipeUpsertStepsWidgetState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) @@ -310,7 +310,7 @@ class RecipeUpsertStepsWidgetState extends State { Text( note, style: TextStyle( - color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.8), fontStyle: FontStyle.italic, fontSize: 15 ) diff --git a/lib/cubits/settings_cubit.dart b/lib/cubits/settings_cubit.dart index c60e5c4..0e93743 100644 --- a/lib/cubits/settings_cubit.dart +++ b/lib/cubits/settings_cubit.dart @@ -16,6 +16,12 @@ class SettingsCubit extends Cubit { SettingsCubit({required this.apiUser, required this.cacheUserService}) : super(AppSetting(layout: 'card', defaultPage: 'recipes', materialHexColor: 0xffceb27c)); + void changeDynamicColorTo(bool dynamicColor) { + AppSetting newState = state.copyWith(dynamicColor: dynamicColor); + emit(newState); + box.put('settings', newState); + } + void changeLayoutTo(String? layout) { if (['list', 'card'].contains(layout)) { AppSetting newState = state.copyWith(layout: layout); diff --git a/lib/extensions/theme_extension.dart b/lib/extensions/theme_extension.dart index a6fe5e1..62adb9d 100644 --- a/lib/extensions/theme_extension.dart +++ b/lib/extensions/theme_extension.dart @@ -1,122 +1,19 @@ import 'package:flutter/material.dart'; class AppTheme { - static ThemeData get lightTheme { + static ThemeData fromColor(Color color, Brightness brightness) { return ThemeData( - brightness: Brightness.light, + brightness: brightness, fontFamily: 'Montserrat', - iconTheme: const IconThemeData(color: Colors.black87), - inputDecorationTheme: InputDecorationTheme( - prefixIconColor: Colors.grey[600], - suffixIconColor: Colors.grey[600], - border: const OutlineInputBorder(), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.grey[800]!, - ) - ), - labelStyle: const TextStyle( - color: Colors.black26, - ), - isDense: true, - contentPadding: const EdgeInsets.all(10), - disabledBorder: const OutlineInputBorder( - borderSide: BorderSide( - color: Colors.black12, - ) - ) - ), - appBarTheme: const AppBarTheme( - titleTextStyle: TextStyle( - color: Colors.black87 - ), - toolbarTextStyle: TextStyle( - color: Colors.black87 - ), - iconTheme: IconThemeData( - color: Colors.black87, - ), - ), - textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom( - foregroundColor: Colors.black87 - ) - ), - buttonTheme: const ButtonThemeData( - textTheme: ButtonTextTheme.primary - ), - primaryTextTheme: TextTheme( - bodyMedium: const TextStyle( - color: Colors.black87 - ), - bodySmall: TextStyle( - color: Colors.grey[600] - ), - labelMedium: TextStyle( - color: Colors.grey[300] - ), - ), - snackBarTheme: const SnackBarThemeData( - behavior: SnackBarBehavior.floating - ), - checkboxTheme: CheckboxThemeData( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(3) - ) - ) + colorScheme: ColorScheme.fromSeed(seedColor: color, brightness: brightness), ); } - static ThemeData get darkTheme { + static ThemeData fromScheme(ColorScheme colorScheme) { return ThemeData( - brightness: Brightness.dark, + brightness: colorScheme.brightness, fontFamily: 'Montserrat', - iconTheme: IconThemeData(color: Colors.grey[50]), - inputDecorationTheme: InputDecorationTheme( - prefixIconColor: Colors.grey[400], - suffixIconColor: Colors.grey[400], - border: const OutlineInputBorder(), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.grey[300]!, - ) - ), - labelStyle: TextStyle( - color: Colors.grey[600], - ), - isDense: true, - contentPadding: const EdgeInsets.all(10), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.grey[700]!, - ) - ) - ), - textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom( - foregroundColor: Colors.white - ) - ), - buttonTheme: const ButtonThemeData( - textTheme: ButtonTextTheme.primary - ), - primaryTextTheme: TextTheme( - bodySmall: TextStyle( - color: Colors.grey[300] - ), - labelMedium: TextStyle( - color: Colors.grey[600] - ) - ), - snackBarTheme: SnackBarThemeData( - behavior: SnackBarBehavior.floating, - backgroundColor: Colors.grey[300] - ), - checkboxTheme: CheckboxThemeData( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(3) - ) - ) + colorScheme: colorScheme, ); } -} \ No newline at end of file +} diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 7b9e758..02dbe9e 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -120,6 +120,7 @@ "settingsRecentDays": "Recent days", "settingsRecentDaysDescription": "Displays the last %s days of the shopping list", "settingsLogout": "Logout", + "dynamicColor": "Dynamic color", "accentColor": "Accent color", "pickColor": "Pick a color", diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index cfebbcd..7e78e55 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -229,6 +229,7 @@ "@settingsRecentDaysDescription": {}, "settingsLogout": "Déconnexion", "@settingsLogout": {}, + "dynamicColor": "Couleurs dynamiques", "accentColor": "Palette de couleur", "@accentColor": {}, "pickColor": "Choisir une couleur", diff --git a/lib/main.dart b/lib/main.dart index e2ffde4..237400b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,5 @@ +import 'package:dynamic_color/dynamic_color.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -160,7 +162,8 @@ class Tare extends StatelessWidget { themeMode = ThemeMode.system; } - return MaterialApp( + return DynamicColorBuilder(builder: (lightColorScheme, darkColorScheme) { + return MaterialApp( localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, @@ -178,13 +181,14 @@ class Tare extends StatelessWidget { ], debugShowCheckedModeBanner: false, title: 'UnTaRe App', - theme: AppTheme.lightTheme.copyWith(primaryColor: Color(settingsCubit.state.materialHexColor), useMaterial3: false), - darkTheme: AppTheme.darkTheme.copyWith(primaryColor: Color(settingsCubit.state.materialHexColor), useMaterial3: false), + theme: settingsCubit.state.dynamicColor && lightColorScheme != null ? AppTheme.fromScheme(lightColorScheme) : AppTheme.fromColor(Color(settingsCubit.state.materialHexColor), Brightness.light), + darkTheme: settingsCubit.state.dynamicColor && darkColorScheme != null ? AppTheme.fromScheme(darkColorScheme) : AppTheme.fromColor(Color(settingsCubit.state.materialHexColor), Brightness.dark), themeMode: themeMode, home: (state is AuthenticationAuthenticated) ? const TarePage() : const StartingPage() - ); + ); + }); }, ) ); @@ -342,36 +346,15 @@ class TarePageState extends State with SingleTickerProviderStateMixin index: _selectedScreenIndex, children: _pages ), - bottomNavigationBar: Container( - decoration: BoxDecoration( - boxShadow:[ - BoxShadow( - color: Colors.black12.withOpacity(0.4), //color of shadow - spreadRadius: 0.5, //spread radius - blurRadius: 1, // blur radius - offset: const Offset(0, 0) - ), - ], - ), - child: SizeTransition( - sizeFactor: _animationController, - axisAlignment: -1.0, - child: BottomNavigationBar( - type: BottomNavigationBarType.fixed, - currentIndex: _selectedScreenIndex, - selectedItemColor: Theme.of(context).primaryColor, - unselectedItemColor: Colors.grey, - showSelectedLabels: true, - showUnselectedLabels: false, - onTap: _selectScreen, - items: [ - BottomNavigationBarItem(icon: const Icon(Icons.restaurant_menu_outlined), label: AppLocalizations.of(context)!.recipesTitle), - BottomNavigationBarItem(icon: const Icon(Icons.calendar_today_outlined), label: AppLocalizations.of(context)!.mealPlanTitle), - BottomNavigationBarItem(icon: const Icon(Icons.shopping_cart_outlined), label: AppLocalizations.of(context)!.shoppingListTitle), - BottomNavigationBarItem(icon: const Icon(Icons.settings), label: AppLocalizations.of(context)!.settingsTitle), - ], - ) - ), + bottomNavigationBar: NavigationBar( + selectedIndex: _selectedScreenIndex, + onDestinationSelected: _selectScreen, + destinations: [ + NavigationDestination(icon: const Icon(Icons.restaurant_menu_outlined), label: AppLocalizations.of(context)!.recipesTitle), + NavigationDestination(icon: const Icon(Icons.calendar_today_outlined), label: AppLocalizations.of(context)!.mealPlanTitle), + NavigationDestination(icon: const Icon(Icons.shopping_cart_outlined), label: AppLocalizations.of(context)!.shoppingListTitle), + NavigationDestination(icon: const Icon(Icons.settings), label: AppLocalizations.of(context)!.settingsTitle), + ], ) ) ); diff --git a/lib/models/app_setting.dart b/lib/models/app_setting.dart index 2b16e55..f419e20 100644 --- a/lib/models/app_setting.dart +++ b/lib/models/app_setting.dart @@ -16,13 +16,16 @@ class AppSetting { final int materialHexColor; @HiveField(4) final UserSetting? userServerSetting; + @HiveField(5) + final bool dynamicColor; AppSetting({ required this.layout, this.theme, required this.defaultPage, required this.materialHexColor, - this.userServerSetting + this.userServerSetting, + this.dynamicColor = true }); AppSetting copyWith({ @@ -30,14 +33,16 @@ class AppSetting { String? theme, String? defaultPage, int? materialHexColor, - UserSetting? userServerSetting + UserSetting? userServerSetting, + bool? dynamicColor }) { return AppSetting( layout: layout ?? this.layout, theme: theme ?? this.theme, defaultPage: defaultPage ?? this.defaultPage, materialHexColor: materialHexColor ?? this.materialHexColor, - userServerSetting: userServerSetting ?? this.userServerSetting + userServerSetting: userServerSetting ?? this.userServerSetting, + dynamicColor: dynamicColor ?? this.dynamicColor ); } } \ No newline at end of file diff --git a/lib/pages/foods_page.dart b/lib/pages/foods_page.dart index 894b90c..405c5f4 100644 --- a/lib/pages/foods_page.dart +++ b/lib/pages/foods_page.dart @@ -48,7 +48,6 @@ class FoodsPageState extends State { return Scaffold( appBar: AppBar( title: Text(AppLocalizations.of(context)!.foods), - backgroundColor: Theme.of(context).scaffoldBackgroundColor, elevation: 1.5, ), body: BlocProvider( @@ -151,7 +150,7 @@ class FoodsPageState extends State { ), ), separatorBuilder: (context, index) => Divider( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), height: 4, ), itemCount: foods.length diff --git a/lib/pages/meal_plan_page.dart b/lib/pages/meal_plan_page.dart index 2c6b529..55b24dc 100644 --- a/lib/pages/meal_plan_page.dart +++ b/lib/pages/meal_plan_page.dart @@ -166,12 +166,11 @@ class MealPlanPageState extends State with WidgetsBindingObserver }, icon: Icon( Icons.more_vert_outlined, - color: Theme.of(context).primaryTextTheme.bodyMedium!.color, + color: Theme.of(context).textTheme.bodyMedium!.color, ) ) ], elevation: (scrolled) ? 1.5 : 0, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, pinned: true, forceElevated: true, bottom: PreferredSize( @@ -198,7 +197,7 @@ class MealPlanPageState extends State with WidgetsBindingObserver textAlign: TextAlign.center, style: TextStyle( fontSize: 18, - color: Theme.of(context).primaryTextTheme.bodyMedium!.color, + color: Theme.of(context).textTheme.bodyMedium!.color, ), ), ), @@ -308,7 +307,7 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: Theme.of(context).primaryTextTheme.labelMedium!.color!, + color: Theme.of(context).textTheme.labelMedium!.color!, width: 0.8 ) ) @@ -323,13 +322,13 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da DateFormat('EEEE', Platform.localeName).format(day), style: TextStyle( fontWeight: (dailyMealPlanList.isNotEmpty) ? FontWeight.bold : FontWeight.normal, - color: (dailyMealPlanList.isNotEmpty) ? Theme.of(context).primaryTextTheme.bodyMedium!.color : Theme.of(context).primaryTextTheme.bodySmall!.color + color: (dailyMealPlanList.isNotEmpty) ? Theme.of(context).textTheme.bodyMedium!.color : Theme.of(context).textTheme.bodySmall!.color ) ), const SizedBox(width: 8), (isToday) - ? Text(AppLocalizations.of(context)!.mealPlanToday.toLowerCase(), style: TextStyle(color: Theme.of(context).primaryColor)) - : Text(DateFormat('d. MMM', Platform.localeName).format(day), style: TextStyle(color: Theme.of(context).primaryTextTheme.bodySmall!.color)) + ? Text(AppLocalizations.of(context)!.mealPlanToday.toLowerCase(), style: TextStyle(color: Theme.of(context).colorScheme.primary)) + : Text(DateFormat('d. MMM', Platform.localeName).format(day), style: TextStyle(color: Theme.of(context).textTheme.bodySmall!.color)) ], ), trailing: IconButton( @@ -353,10 +352,10 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da Container( padding: const EdgeInsets.fromLTRB(10, 0, 12, 0), decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.white : Colors.grey[800], + color: Theme.of(context).colorScheme.surfaceContainer, border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[100]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.surfaceContainerHigh, width: 1 ) ) @@ -385,10 +384,10 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da child: Container( padding: const EdgeInsets.fromLTRB(10, 0, 12, 0), decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.white : Colors.grey[800], + color: Theme.of(context).colorScheme.surfaceContainer, border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[100]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.surfaceContainerHigh, width: 1 ) ) @@ -405,13 +404,13 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da height: 100, width: double.maxFinite, decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.black12 : Colors.grey[700], + color: Theme.of(context).colorScheme.secondary, borderRadius: const BorderRadius.all(Radius.circular(10)), ), child: Center( child: Icon( Icons.restaurant_menu_outlined, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black38 : Colors.grey[400], + color: Theme.of(context).colorScheme.onSecondary, ), ), ), @@ -420,7 +419,7 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da subtitle: Row( children: [ Flexible( - child: Text(mealPlan.mealType.name, style: TextStyle(color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[600] : Colors.grey, fontSize: 12)) + child: Text(mealPlan.mealType.name, style: TextStyle(color: Theme.of(context).colorScheme.secondary.withOpacity(0.8), fontSize: 12)) ) ], ), @@ -449,13 +448,13 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da height: 140, width: double.maxFinite, decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.black12 : Colors.grey[700], + color: Theme.of(context).colorScheme.secondary, borderRadius: const BorderRadius.vertical(top: Radius.circular(10)), ), child: Center( child: Icon( Icons.restaurant_menu_outlined, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black38 : Colors.grey[400], + color: Theme.of(context).colorScheme.onSecondary, ), ), ), @@ -468,14 +467,14 @@ Widget buildDayLayout(BuildContext context, List mealPlanList, Da padding: const EdgeInsets.fromLTRB(5, 3, 5, 3), margin: const EdgeInsets.all(5), decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.white.withOpacity(0.8) : Colors.grey[800]!.withOpacity(0.8), + color: Theme.of(context).colorScheme.tertiaryContainer, borderRadius: BorderRadius.circular(30) ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, - children: [Flexible(child: Text(mealPlan.mealType.name, style: const TextStyle(fontSize: 11)))], + children: [Flexible(child: Text(mealPlan.mealType.name, style: TextStyle(color: Theme.of(context).colorScheme.onTertiaryContainer, fontSize: 11)))], ), ), ) diff --git a/lib/pages/recipe_detail_page.dart b/lib/pages/recipe_detail_page.dart index 6fcd9a6..0f29c09 100644 --- a/lib/pages/recipe_detail_page.dart +++ b/lib/pages/recipe_detail_page.dart @@ -187,7 +187,6 @@ class RecipeDetailPageState extends State with WidgetsBindingO ) ], elevation: (scrolled) ? 1.5 : 0, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, pinned: true, ); }); @@ -239,9 +238,9 @@ class RecipeDetailPageState extends State with WidgetsBindingO const SizedBox(height: 3), Text( AppLocalizations.of(context)!.lastCooked, - style: const TextStyle( + style: TextStyle( fontSize: 10, - color: Colors.grey + color: Theme.of(context).colorScheme.secondary.withOpacity(0.8) ), ) ], @@ -266,9 +265,9 @@ class RecipeDetailPageState extends State with WidgetsBindingO const SizedBox(height: 3), Text( AppLocalizations.of(context)!.rating, - style: const TextStyle( + style: TextStyle( fontSize: 10, - color: Colors.grey + color: Theme.of(context).colorScheme.secondary.withOpacity(0.8) ), ) ], @@ -292,9 +291,9 @@ class RecipeDetailPageState extends State with WidgetsBindingO const SizedBox(height: 3), Text( AppLocalizations.of(context)!.prepTime, - style: const TextStyle( + style: TextStyle( fontSize: 10, - color: Colors.grey + color: Theme.of(context).colorScheme.secondary.withOpacity(0.8) ), ) ], @@ -320,9 +319,9 @@ class RecipeDetailPageState extends State with WidgetsBindingO const SizedBox(height: 3), Text( AppLocalizations.of(context)!.waitingTime, - style: const TextStyle( + style: TextStyle( fontSize: 10, - color: Colors.grey + color: Theme.of(context).colorScheme.secondary.withOpacity(0.8) ), ) ], @@ -336,9 +335,6 @@ class RecipeDetailPageState extends State with WidgetsBindingO SliverPersistentHeader( delegate: _SliverAppBarDelegate( TabBar( - indicatorColor: Theme.of(context).primaryColor, - unselectedLabelColor: Colors.grey, - labelColor: (Theme.of(context).brightness.name == 'dark') ? Colors.white : Colors.black, tabs: [ Tab(text: AppLocalizations.of(context)!.ingredients), Tab(text: AppLocalizations.of(context)!.directions), @@ -398,10 +394,10 @@ Widget? getKeywordWidget(BuildContext context, Keyword keyword) { padding: const EdgeInsets.fromLTRB(5, 3, 5, 3), margin: const EdgeInsets.fromLTRB(5, 5, 0, 5), decoration: BoxDecoration( - color: (Theme.of(context).brightness.name == 'light') ? Colors.white.withOpacity(0.8) : Colors.grey[800]!.withOpacity(0.8), + color: Theme.of(context).colorScheme.tertiaryContainer, borderRadius: BorderRadius.circular(30) ), - child: Text(text, style: const TextStyle(fontSize: 11)) + child: Text(text, style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onTertiaryContainer)) ); } diff --git a/lib/pages/recipe_upsert_page.dart b/lib/pages/recipe_upsert_page.dart index 989831a..9a6ac99 100644 --- a/lib/pages/recipe_upsert_page.dart +++ b/lib/pages/recipe_upsert_page.dart @@ -599,7 +599,7 @@ class RecipeUpsertPageState extends State { alignment: Alignment.center, decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(color: Theme.of(context).primaryColor, width: 2), + border: Border.all(color: Theme.of(context).colorScheme.primary, width: 2), ), child: IconButton( padding: const EdgeInsets.all(0), @@ -607,7 +607,7 @@ class RecipeUpsertPageState extends State { visualDensity: const VisualDensity(horizontal: -4, vertical: -4), icon: Icon( Icons.add, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, ), onPressed: () { FocusManager.instance.primaryFocus?.unfocus(); @@ -665,9 +665,9 @@ class RecipeUpsertPageState extends State { alignment: Alignment.center, decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(color: Theme.of(context).primaryColor, width: 2), + border: Border.all(color: Theme.of(context).colorScheme.primary, width: 2), ), - child: Text((stepIndex+1).toString(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Theme.of(context).primaryColor)), + child: Text((stepIndex+1).toString(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Theme.of(context).colorScheme.primary)), ) ), if (step.name != null && step.name != '') @@ -675,19 +675,19 @@ class RecipeUpsertPageState extends State { '${step.name} ', style: TextStyle( fontStyle: FontStyle.italic, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), fontSize: 15.5 ) ), if (step.time != null && step.time != 0) Row( children: [ - Icon(Icons.timer_outlined, size: 15.5, color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!), + Icon(Icons.timer_outlined, size: 15.5, color: Theme.of(context).colorScheme.secondary.withOpacity(0.5)), Text( ' ${step.time} min', style: TextStyle( fontStyle: FontStyle.italic, - color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), fontSize: 15.5 ) ) @@ -757,7 +757,7 @@ class RecipeUpsertPageState extends State { decoration: BoxDecoration( border: Border( left: BorderSide( - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, width: 1 ) ) @@ -770,7 +770,7 @@ class RecipeUpsertPageState extends State { splashRadius: 20, icon: Icon( Icons.add, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, ), onPressed: () { FocusManager.instance.primaryFocus?.unfocus(); @@ -788,7 +788,7 @@ class RecipeUpsertPageState extends State { decoration: BoxDecoration( border: Border( left: BorderSide( - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, width: 1 ) ) @@ -840,7 +840,7 @@ class RecipeUpsertPageState extends State { decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) @@ -851,7 +851,7 @@ class RecipeUpsertPageState extends State { title: RichText( overflow: TextOverflow.ellipsis, text: TextSpan( - style: TextStyle(fontSize: 15, color: Theme.of(context).primaryTextTheme.bodyMedium!.color), + style: TextStyle(fontSize: 15, color: Theme.of(context).textTheme.bodyMedium!.color), children: [ TextSpan(text: amount, style: const TextStyle(fontWeight: FontWeight.bold)), TextSpan(text: unit, style: const TextStyle(fontWeight: FontWeight.bold)), @@ -859,7 +859,7 @@ class RecipeUpsertPageState extends State { TextSpan( text: note, style: TextStyle( - color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), fontStyle: FontStyle.italic ) ) diff --git a/lib/pages/recipes_page.dart b/lib/pages/recipes_page.dart index f86ba5d..708c404 100644 --- a/lib/pages/recipes_page.dart +++ b/lib/pages/recipes_page.dart @@ -250,49 +250,22 @@ Widget sliverAppBarWidget(BuildContext context, bool innerBoxIsScrolled, TextEdi ), ), ), - backgroundColor: Theme.of(context).scaffoldBackgroundColor, pinned: true, stretch: true, forceElevated: innerBoxIsScrolled, elevation: 1.5, bottom: PreferredSize( - preferredSize: const Size(double.maxFinite, 42), + preferredSize: const Size(double.maxFinite, 50), child: Container( - height: 42, - padding: const EdgeInsets.fromLTRB(40, 0, 30, 10), - child: Row( - children: [ - Flexible( - child: TextField( - controller: searchTextController, - cursorColor: Theme.of(context).primaryColor, - decoration: InputDecoration( - hintText: AppLocalizations.of(context)!.search, - contentPadding: const EdgeInsets.only(top: 10), - prefixIcon: const Icon(Icons.search_outlined), - suffixIcon: showSearchClear ? IconButton( - splashRadius: 1, - padding: const EdgeInsets.fromLTRB(8, 7, 8, 8), - icon: const Icon(Icons.clear_outlined), - onPressed: () { - searchTextController.clear(); - }, - ) : null, - fillColor: (Theme.of(context).brightness.name == 'light') ? Colors.grey[200] : Colors.grey[700], - focusedBorder: const OutlineInputBorder( - borderSide: BorderSide(color: Colors.transparent, width: 0.0), - borderRadius: BorderRadius.all(Radius.circular(30.0)), - ), - filled: true, - enabledBorder: const OutlineInputBorder( - borderSide: BorderSide(color: Colors.transparent, width: 0.0), - borderRadius: BorderRadius.all(Radius.circular(30.0)), - ), - ), - ), - ), - IconButton( - padding: const EdgeInsets.fromLTRB(8, 4, 8, 8), + height: 50, + padding: const EdgeInsets.fromLTRB(20, 0, 20, 10), + child: SearchBar( + backgroundColor: WidgetStateProperty.all(Theme.of(context).colorScheme.surfaceContainer), + controller: searchTextController, + elevation: WidgetStateProperty.all(0), + leading: Icon(Icons.search_rounded, color: Theme.of(context).colorScheme.secondary), + trailing: [ + IconButton( tooltip: AppLocalizations.of(context)!.sort, splashRadius: 20, onPressed: () { @@ -304,7 +277,7 @@ Widget sliverAppBarWidget(BuildContext context, bool innerBoxIsScrolled, TextEdi ) ) ], - ) + ), ), ), actions: [ diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index f8e6ed8..c9ac870 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -58,7 +58,6 @@ class SettingsPageState extends State { ), ), elevation: 1.5, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, pinned: true, ) ]; @@ -97,7 +96,16 @@ class SettingsPageState extends State { title: Text(AppLocalizations.of(context)!.settingsThemeMode), value: Text((setting.theme != 'system') ? ((setting.theme == 'light') ? AppLocalizations.of(context)!.settingsLightMode : AppLocalizations.of(context)!.settingsDarkMode) : AppLocalizations.of(context)!.settingsSystemMode), ), + SettingsTile.switchTile( + leading: const Icon(Icons.style_outlined), + onToggle: (bool value) { + settingsCubit.changeDynamicColorTo(value); + }, + initialValue: setting.dynamicColor, + title: Text(AppLocalizations.of(context)!.dynamicColor), + ), SettingsTile.navigation( + enabled: !setting.dynamicColor, onPressed: (context) { Color pickedColor = Color(setting.materialHexColor); showDialog(context: context, builder: (BuildContext dContext) { @@ -148,7 +156,7 @@ class SettingsPageState extends State { }, leading: const Icon(Icons.color_lens_outlined), title: Text(AppLocalizations.of(context)!.accentColor), - trailing: Icon(Icons.circle, color: Color(setting.materialHexColor)) + trailing: Icon(Icons.circle, color: Color(setting.materialHexColor).withOpacity(setting.dynamicColor ? 0.5 : 1.0)) ) ] ), @@ -180,7 +188,6 @@ class SettingsPageState extends State { onToggle: (bool value) { }, - activeSwitchColor: Theme.of(context).primaryColor, initialValue: setting.userServerSetting!.mealPlanAutoAddShopping, title: Text('Auto add meal plan'), description: Text('Automatically add meal plan ingredients to shopping list'), @@ -227,7 +234,6 @@ class SettingsPageState extends State { newUserSetting = setting.userServerSetting!.copyWith(useFractions: value); settingsCubit.updateServerSetting(newUserSetting); }, - activeSwitchColor: Theme.of(context).primaryColor, initialValue: useFraction, title: Text(AppLocalizations.of(context)!.useFractions), ), @@ -271,13 +277,13 @@ class SettingsPageState extends State { ], physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()), lightTheme: SettingsThemeData( - tileHighlightColor: Theme.of(context).primaryColor, - titleTextColor: Theme.of(context).primaryColor, + tileHighlightColor: Theme.of(context).colorScheme.primary, + titleTextColor: Theme.of(context).colorScheme.primary, settingsListBackground: Theme.of(context).scaffoldBackgroundColor ), darkTheme: SettingsThemeData( - tileHighlightColor: Theme.of(context).primaryColor, - titleTextColor: Theme.of(context).primaryColor, + tileHighlightColor: Theme.of(context).colorScheme.primary, + titleTextColor: Theme.of(context).colorScheme.primary, settingsListBackground: Theme.of(context).scaffoldBackgroundColor ), ); diff --git a/lib/pages/shopping_list_page.dart b/lib/pages/shopping_list_page.dart index ebe0565..6a75568 100644 --- a/lib/pages/shopping_list_page.dart +++ b/lib/pages/shopping_list_page.dart @@ -155,7 +155,6 @@ class ShoppingListPageState extends State with TickerProviderS ) ], elevation: (scrolled) ? 1.5 : 0, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, pinned: true, forceElevated: true, ); @@ -269,7 +268,7 @@ class ShoppingListPageState extends State with TickerProviderS groupSeparatorBuilder: (String groupByValue) { return Padding( padding: const EdgeInsets.fromLTRB(15, 25, 15, 5), - child: Text(groupByValue.toUpperCase(), style: const TextStyle(color: Colors.grey, fontWeight: FontWeight.bold)), + child: Text(groupByValue.toUpperCase(), style: TextStyle(color: Theme.of(context).colorScheme.secondary, fontWeight: FontWeight.bold)), ); }, itemComparator: (item1, item2) { @@ -311,7 +310,7 @@ class ShoppingListPageState extends State with TickerProviderS scale: 1.2, child: Checkbox( value: checkBoxValue, - activeColor: Theme.of(context).primaryColor, + activeColor: Theme.of(context).colorScheme.secondary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(3) ), @@ -333,7 +332,7 @@ class ShoppingListPageState extends State with TickerProviderS title: Text( groupedList.first.food!.name, style: (checkBoxValue) - ? TextStyle(color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, fontWeight: FontWeight.bold, decoration: TextDecoration.lineThrough) + ? const TextStyle(fontWeight: FontWeight.bold, decoration: TextDecoration.lineThrough) : const TextStyle(fontWeight: FontWeight.bold) ), leading: const Icon(Icons.keyboard_arrow_up), @@ -345,7 +344,7 @@ class ShoppingListPageState extends State with TickerProviderS decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) @@ -358,7 +357,7 @@ class ShoppingListPageState extends State with TickerProviderS scale: 1.2, child: Checkbox( value: checkBoxValue, - activeColor: Theme.of(context).primaryColor, + activeColor: Theme.of(context).colorScheme.secondary, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(3) ), @@ -380,7 +379,7 @@ class ShoppingListPageState extends State with TickerProviderS title: Text( groupedList.first.food!.name, style: (checkBoxValue) - ? TextStyle(color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, fontWeight: FontWeight.bold, decoration: TextDecoration.lineThrough) + ? const TextStyle(fontWeight: FontWeight.bold, decoration: TextDecoration.lineThrough) : const TextStyle(fontWeight: FontWeight.bold) ), leading: const Icon(Icons.keyboard_arrow_down), @@ -460,7 +459,7 @@ class ShoppingListPageState extends State with TickerProviderS decoration: BoxDecoration( border: Border( bottom: BorderSide( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), width: 0.8 ) ) @@ -475,24 +474,24 @@ class ShoppingListPageState extends State with TickerProviderS RichText( text: TextSpan( children: [ - TextSpan(text: amount, style: TextStyle(color: Theme.of(context).primaryTextTheme.bodyMedium!.color, fontWeight: FontWeight.bold)), - TextSpan(text: unit, style: TextStyle(color: Theme.of(context).primaryTextTheme.bodyMedium!.color, fontWeight: FontWeight.bold)), - TextSpan(text: food, style: TextStyle(color: Theme.of(context).primaryTextTheme.bodyMedium!.color, fontWeight: (shoppingListEntry.food != null && shoppingListEntry.food!.recipe != null) ? FontWeight.bold : FontWeight.w400)), + TextSpan(text: amount, style: TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color, fontWeight: FontWeight.bold)), + TextSpan(text: unit, style: TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color, fontWeight: FontWeight.bold)), + TextSpan(text: food, style: TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color, fontWeight: (shoppingListEntry.food != null && shoppingListEntry.food!.recipe != null) ? FontWeight.bold : FontWeight.w400)), ], style: (checkBoxValue) - ? TextStyle(color: (Theme.of(context).brightness.name == 'light') ? Colors.black45 : Colors.grey[600]!, decoration: TextDecoration.lineThrough) + ? const TextStyle(decoration: TextDecoration.lineThrough) : null ) ) ] ), subtitle: (shoppingListEntry.recipeMealPlan != null) - ? Padding(padding: const EdgeInsets.only(top: 4), child: Text(shoppingListEntry.recipeMealPlan!.name, style: TextStyle(color: Colors.grey[600]!))) + ? Padding(padding: const EdgeInsets.only(top: 4), child: Text(shoppingListEntry.recipeMealPlan!.name)) : null, trailing: Transform.scale( scale: 1.2, child: Checkbox( - activeColor: Theme.of(context).primaryColor, + activeColor: Theme.of(context).colorScheme.secondary, value: checkBoxValue, onChanged: (bool? value) { setState(() { diff --git a/lib/pages/spaces_page.dart b/lib/pages/spaces_page.dart index 6df202d..32872b8 100644 --- a/lib/pages/spaces_page.dart +++ b/lib/pages/spaces_page.dart @@ -32,7 +32,6 @@ class SpacesPageState extends State { return Scaffold( appBar: AppBar( title: Text(AppLocalizations.of(context)!.spaces), - backgroundColor: Theme.of(context).scaffoldBackgroundColor, elevation: 1.5, ), body: ListView.separated( @@ -41,7 +40,7 @@ class SpacesPageState extends State { onChanged: (bool? changed) { }, - activeColor: Theme.of(context).primaryColor, + activeColor: Theme.of(context).colorScheme.secondary, title: Wrap(children: [Text(spaces[index].name)]), subtitle: Wrap(direction: Axis.horizontal,children: [ Icon(Icons.restaurant_menu_outlined, size: 15, color: Theme.of(context).inputDecorationTheme.prefixIconColor), @@ -58,7 +57,7 @@ class SpacesPageState extends State { ],), ), separatorBuilder: (context, index) => Divider( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), ), itemCount: context.watch().state.length ), diff --git a/lib/pages/starting_page.dart b/lib/pages/starting_page.dart index 8998142..808047c 100644 --- a/lib/pages/starting_page.dart +++ b/lib/pages/starting_page.dart @@ -49,7 +49,7 @@ class StartingPage extends StatelessWidget { return Center( child: CircularProgressIndicator( strokeWidth: 2, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, ), ); }, @@ -116,7 +116,7 @@ class __SignInFormState extends State<_SignInForm> { return Center( child: CircularProgressIndicator( strokeWidth: 2, - color: Theme.of(context).primaryColor, + color: Theme.of(context).colorScheme.primary, ), ); } @@ -167,24 +167,17 @@ class __SignInFormState extends State<_SignInForm> { ])), )), const SizedBox(width: 10), - SizedBox( - width: 80, - child: MaterialButton( - color: Theme.of(context).primaryColor, - minWidth: double.maxFinite, - padding: const EdgeInsets.fromLTRB( - 8, 4.5, 8, 4.5), + ElevatedButton( child: Text( AppLocalizations.of(context)! .officialServer, style: const TextStyle(fontSize: 13), - textAlign: TextAlign.center), + ), onPressed: () { _urlController.text = 'https://app.tandoor.dev'; }, ), - ) ], ), const SizedBox(height: 15), @@ -226,10 +219,7 @@ class __SignInFormState extends State<_SignInForm> { ), ), const SizedBox(height: 15), - MaterialButton( - color: Theme.of(context).primaryColor, - minWidth: double.maxFinite, - padding: const EdgeInsets.fromLTRB(8, 5, 8, 5), + ElevatedButton( onPressed: onLoginButtonPressed, child: const Text('LOGIN'), ), diff --git a/lib/pages/units_page.dart b/lib/pages/units_page.dart index a893316..be94e17 100644 --- a/lib/pages/units_page.dart +++ b/lib/pages/units_page.dart @@ -46,7 +46,6 @@ class UnitsPageState extends State { return Scaffold( appBar: AppBar( title: Text(AppLocalizations.of(context)!.units), - backgroundColor: Theme.of(context).scaffoldBackgroundColor, elevation: 1.5, ), body: BlocProvider( @@ -145,7 +144,7 @@ class UnitsPageState extends State { ), ), separatorBuilder: (context, index) => Divider( - color: (Theme.of(context).brightness.name == 'light') ? Colors.grey[300]! : Colors.grey[700]!, + color: Theme.of(context).colorScheme.secondary.withOpacity(0.5), height: 4, ), itemCount: units.length diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 7299b5c..36af2d7 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,10 +6,14 @@ #include "generated_plugin_registrant.h" +#include #include #include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) dynamic_color_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); + dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); file_selector_plugin_register_with_registrar(file_selector_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 786ff5c..f308ccc 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + dynamic_color file_selector_linux url_launcher_linux ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index ebc5fd9..46df04e 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,7 @@ import FlutterMacOS import Foundation +import dynamic_color import file_selector_macos import path_provider_foundation import share_plus @@ -13,6 +14,7 @@ import url_launcher_macos import wakelock_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 89ff56e..0f47ab5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -265,6 +265,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.0.6" + dynamic_color: + dependency: "direct main" + description: + name: dynamic_color + sha256: eae98052fa6e2826bdac3dd2e921c6ce2903be15c6b7f8b6d8a5d49b5086298d + url: "https://pub.dev" + source: hosted + version: "1.7.0" equatable: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 8acd89e..1c5054f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,6 +60,7 @@ dependencies: flutter_markdown: ^0.7.3 url_launcher: ^6.2.2 receive_sharing_intent: ^1.7.0 + dynamic_color: ^1.7.0 dependency_overrides: flutter_chips_input: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 5e62361..9fa615d 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,11 +6,14 @@ #include "generated_plugin_registrant.h" +#include #include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + DynamicColorPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); FileSelectorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorWindows")); SharePlusWindowsPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 281df51..ea66676 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + dynamic_color file_selector_windows share_plus url_launcher_windows