aboutsummaryrefslogtreecommitdiff
path: root/lib/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'lib/widgets')
-rw-r--r--lib/widgets/custom_drawer_widget.dart30
-rw-r--r--lib/widgets/custom_markdown_style.dart26
-rw-r--r--lib/widgets/error_widgets.dart6
-rw-r--r--lib/widgets/page_route_transitions.dart20
-rw-r--r--lib/widgets/recipe_card_widget.dart16
-rw-r--r--lib/widgets/recipe_search_delegate.dart12
-rw-r--r--lib/widgets/toastbar_widget.dart4
-rw-r--r--lib/widgets/utility_icon_row_widget.dart18
8 files changed, 66 insertions, 66 deletions
diff --git a/lib/widgets/custom_drawer_widget.dart b/lib/widgets/custom_drawer_widget.dart
index 3fd8c2e..671ff70 100644
--- a/lib/widgets/custom_drawer_widget.dart
+++ b/lib/widgets/custom_drawer_widget.dart
@@ -14,21 +14,21 @@ import 'package:kulinar_app/widgets/page_route_transitions.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class CustomDrawer extends StatefulWidget {
- CustomDrawer({Key? key, required this.initalIndex}) : super(key: key);
+ const CustomDrawer({Key? key, required this.initialIndex}) : super(key: key);
- final int initalIndex;
+ final int initialIndex;
@override
- _CustomDrawerState createState() => _CustomDrawerState();
+ CustomDrawerState createState() => CustomDrawerState();
}
-class _CustomDrawerState extends State<CustomDrawer> {
+class CustomDrawerState extends State<CustomDrawer> {
int? _index;
@override
void initState() {
super.initState();
- _index = widget.initalIndex;
+ _index = widget.initialIndex;
}
@override
@@ -46,28 +46,28 @@ class _CustomDrawerState extends State<CustomDrawer> {
children: [
_buildDrawerHeader(),
_buildDrawerItem(0, Icons.receipt_rounded, AppLocalizations.of(context)!.category1, () {
- _navigateTo(MainView(), 0);
+ _navigateTo(const MainView(), 0);
}),
_buildDrawerItem(1, Icons.favorite_rounded, AppLocalizations.of(context)!.category4, () {
- _navigateTo(FavoritesView(), 1);
+ _navigateTo(const FavoritesView(), 1);
}),
_buildDrawerItem(2, Icons.calendar_today_rounded, AppLocalizations.of(context)!.category5, () {
- _navigateTo(WeekView(), 2);
+ _navigateTo(const WeekView(), 2);
}),
_buildDrawerItem(3, Icons.how_to_vote_rounded, AppLocalizations.of(context)!.category6, () {
- _navigateTo(VoteView(), 3);
+ _navigateTo(const VoteView(), 3);
}),
_buildDrawerItem(4, Icons.shopping_cart_rounded, AppLocalizations.of(context)!.category7, () {
- _navigateTo(ShoplistView(), 4);
+ _navigateTo(const ShoplistView(), 4);
}),
],
),
),
_buildDrawerItem(5, Icons.settings_rounded, AppLocalizations.of(context)!.category8, () {
- _navigateTo(SettingsView(), 5);
+ _navigateTo(const SettingsView(), 5);
}),
_buildDrawerItem(6, Icons.info_rounded, AppLocalizations.of(context)!.category9, () {
- _navigateTo(InfoView(), 6);
+ _navigateTo(const InfoView(), 6);
}),
],
),
@@ -75,16 +75,17 @@ class _CustomDrawerState extends State<CustomDrawer> {
}
Widget _buildDrawerHeader() {
- return SizedBox(
+ return const SizedBox(
width: double.infinity,
child: DrawerHeader(
margin: EdgeInsets.zero,
+ decoration: BoxDecoration(color: cPrimaryColor),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
- padding: const EdgeInsets.only(bottom: 12.0),
+ padding: EdgeInsets.only(bottom: 12.0),
child: Icon(
Icons.restaurant_menu_rounded,
color: cIconColor,
@@ -93,7 +94,6 @@ class _CustomDrawerState extends State<CustomDrawer> {
),
],
),
- decoration: BoxDecoration(color: cPrimaryColor),
),
);
}
diff --git a/lib/widgets/custom_markdown_style.dart b/lib/widgets/custom_markdown_style.dart
index 8a1c421..41173f5 100644
--- a/lib/widgets/custom_markdown_style.dart
+++ b/lib/widgets/custom_markdown_style.dart
@@ -5,23 +5,23 @@ import 'package:kulinar_app/constants.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
class CustomMarkdownStyle extends MarkdownStyleSheet {
- MarkdownStyleSheet({
- tableBody: cRecipeDescriptionStyle,
- a: cRecipeDescriptionStyle,
- p: cRecipeDescriptionStyle,
- h1: cRecipeSubtitleStyle,
- h2: cRecipeSubtitleStyle,
- h3: cRecipeSubtitleStyle,
- h4: cRecipeSubtitleStyle,
- h5: cRecipeSubtitleStyle,
- h6: cRecipeSubtitleStyle,
+ markdownStyleSheet({
+ tableBody = cRecipeDescriptionStyle,
+ a = cRecipeDescriptionStyle,
+ p = cRecipeDescriptionStyle,
+ h1 = cRecipeSubtitleStyle,
+ h2 = cRecipeSubtitleStyle,
+ h3 = cRecipeSubtitleStyle,
+ h4 = cRecipeSubtitleStyle,
+ h5 = cRecipeSubtitleStyle,
+ h6 = cRecipeSubtitleStyle,
/* TODO: remove code and quote block
blockquoteDecoration: BoxDecoration(color: Color.fromARGB(255, 255, 13, 13)),
code: cDetailsTextStyle,
*/
- listIndent: 15.0,
- listBullet: cRecipeDescriptionStyle,
- listBulletPadding: const EdgeInsets.only(right: 10.0),
+ listIndent = 15.0,
+ listBullet = cRecipeDescriptionStyle,
+ listBulletPadding = const EdgeInsets.only(right: 10.0),
// horizontalRuleDecoration: BoxDecoration(border: Border.all(color: Colors.grey, width: 0.5)),
}) {}
}
diff --git a/lib/widgets/error_widgets.dart b/lib/widgets/error_widgets.dart
index 52ac0bb..e17e409 100644
--- a/lib/widgets/error_widgets.dart
+++ b/lib/widgets/error_widgets.dart
@@ -14,7 +14,7 @@ class NoContentError extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
- Icon(
+ const Icon(
Icons.sentiment_dissatisfied_rounded,
size: 100,
),
@@ -42,7 +42,7 @@ class NetworkContentError extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
- Icon(
+ const Icon(
Icons.signal_wifi_off_rounded,
size: 100,
),
@@ -81,7 +81,7 @@ class UnknownError extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
- Icon(
+ const Icon(
Icons.warning_amber_rounded,
size: 100,
),
diff --git a/lib/widgets/page_route_transitions.dart b/lib/widgets/page_route_transitions.dart
index 8491555..a4dc061 100644
--- a/lib/widgets/page_route_transitions.dart
+++ b/lib/widgets/page_route_transitions.dart
@@ -5,13 +5,13 @@ class SlideFromLeftRoute extends PageRouteBuilder {
SlideFromLeftRoute({required this.child})
: super(
- transitionDuration: Duration(milliseconds: 300),
+ transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext _, Animation<double> __, Animation<double> ___) => child,
transitionsBuilder: (BuildContext _, Animation<double> animation, Animation<double> __, Widget child) => SlideTransition(
position: Tween<Offset>(
- begin: Offset(-1, 0),
+ begin: const Offset(-1, 0),
end: Offset.zero,
- ).animate(CurvedAnimation(parent: animation, curve: Interval(0.00, 1.00, curve: Curves.ease))),
+ ).animate(CurvedAnimation(parent: animation, curve: const Interval(0.00, 1.00, curve: Curves.ease))),
child: child,
),
);
@@ -22,13 +22,13 @@ class SlideFromRightRoute extends PageRouteBuilder {
SlideFromRightRoute({required this.child})
: super(
- transitionDuration: Duration(milliseconds: 300),
+ transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext _, Animation<double> __, Animation<double> ___) => child,
transitionsBuilder: (BuildContext _, Animation<double> animation, Animation<double> __, Widget child) => SlideTransition(
position: Tween<Offset>(
- begin: Offset(1, 0),
+ begin: const Offset(1, 0),
end: Offset.zero,
- ).animate(CurvedAnimation(parent: animation, curve: Interval(0.00, 1.00, curve: Curves.ease))),
+ ).animate(CurvedAnimation(parent: animation, curve: const Interval(0.00, 1.00, curve: Curves.ease))),
child: child,
),
);
@@ -39,13 +39,13 @@ class SlideFromBottomRoute extends PageRouteBuilder {
SlideFromBottomRoute({required this.child})
: super(
- transitionDuration: Duration(milliseconds: 300),
+ transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext _, Animation<double> __, Animation<double> ___) => child,
transitionsBuilder: (BuildContext _, Animation<double> animation, Animation<double> __, Widget child) => SlideTransition(
position: Tween<Offset>(
- begin: Offset(0, 1),
+ begin: const Offset(0, 1),
end: Offset.zero,
- ).animate(CurvedAnimation(parent: animation, curve: Interval(0.00, 1.00, curve: Curves.ease))),
+ ).animate(CurvedAnimation(parent: animation, curve: const Interval(0.00, 1.00, curve: Curves.ease))),
child: child,
),
);
@@ -56,7 +56,7 @@ class FadeRoute extends PageRouteBuilder {
FadeRoute({required this.child})
: super(
- transitionDuration: Duration(milliseconds: 300),
+ transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (BuildContext _, Animation<double> animation, Animation<double> __) => FadeTransition(
opacity: animation,
child: child,
diff --git a/lib/widgets/recipe_card_widget.dart b/lib/widgets/recipe_card_widget.dart
index 4828b9a..a3db5f7 100644
--- a/lib/widgets/recipe_card_widget.dart
+++ b/lib/widgets/recipe_card_widget.dart
@@ -19,10 +19,10 @@ class RecipeCard extends StatefulWidget {
final Function? showToastCallback;
@override
- _RecipeCardState createState() => _RecipeCardState();
+ RecipeCardState createState() => RecipeCardState();
}
-class _RecipeCardState extends State<RecipeCard> {
+class RecipeCardState extends State<RecipeCard> {
@override
void dispose() {
super.dispose();
@@ -68,7 +68,7 @@ class _RecipeCardState extends State<RecipeCard> {
widget.redrawCallback!();
} catch (e) {
- print(e);
+ debugPrint("$e");
}
}
@@ -97,7 +97,7 @@ class _RecipeCardState extends State<RecipeCard> {
}
class _RecipeInfo extends StatefulWidget {
- _RecipeInfo({Key? key, required this.recipe}) : super(key: key);
+ const _RecipeInfo({Key? key, required this.recipe}) : super(key: key);
final Recipe recipe;
@@ -112,7 +112,7 @@ class _RecipeInfoState extends State<_RecipeInfo> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildRecipeInfo(),
- _buildFavortiteIcon(),
+ _buildFavoriteIcon(),
],
);
}
@@ -123,7 +123,7 @@ class _RecipeInfoState extends State<_RecipeInfo> {
if (rating == 0) return _result;
for (int i = 0; i < 5; i++) {
- _result.add(rating >= 1 ? Icon(Icons.star_rounded) : Icon(Icons.star_border_rounded));
+ _result.add(rating >= 1 ? const Icon(Icons.star_rounded) : const Icon(Icons.star_border_rounded));
rating--;
}
@@ -163,9 +163,9 @@ class _RecipeInfoState extends State<_RecipeInfo> {
);
}
- Widget _buildFavortiteIcon() {
+ Widget _buildFavoriteIcon() {
return IconButton(
- icon: widget.recipe.favorite ? Icon(Icons.favorite_rounded, color: Colors.red) : Icon(Icons.favorite_border_rounded),
+ icon: widget.recipe.favorite ? const Icon(Icons.favorite_rounded, color: Colors.red) : const Icon(Icons.favorite_border_rounded),
onPressed: () {
widget.recipe.toggleFavorite();
RecipeData.save();
diff --git a/lib/widgets/recipe_search_delegate.dart b/lib/widgets/recipe_search_delegate.dart
index 1cb02e7..cd58b29 100644
--- a/lib/widgets/recipe_search_delegate.dart
+++ b/lib/widgets/recipe_search_delegate.dart
@@ -10,7 +10,7 @@ class RecipeSearch extends SearchDelegate {
List<Widget> buildActions(BuildContext context) {
return [
IconButton(
- icon: Icon(Icons.clear),
+ icon: const Icon(Icons.clear),
onPressed: () {
query = "";
},
@@ -21,7 +21,7 @@ class RecipeSearch extends SearchDelegate {
@override
Widget buildLeading(BuildContext context) {
return IconButton(
- icon: Icon(Icons.arrow_back, color: cIconColor),
+ icon: const Icon(Icons.arrow_back, color: cIconColor),
onPressed: () {
close(context, null);
},
@@ -51,7 +51,7 @@ class RecipeSearch extends SearchDelegate {
@override
ThemeData appBarTheme(BuildContext context) {
return Theme.of(context).copyWith(
- textTheme: TextTheme(
+ textTheme: const TextTheme(
headline6: cSearchTextStyle,
),
);
@@ -63,7 +63,7 @@ class FavoriteRecipeSearch extends SearchDelegate {
List<Widget> buildActions(BuildContext context) {
return [
IconButton(
- icon: Icon(Icons.clear),
+ icon: const Icon(Icons.clear),
onPressed: () {
query = "";
},
@@ -74,7 +74,7 @@ class FavoriteRecipeSearch extends SearchDelegate {
@override
Widget buildLeading(BuildContext context) {
return IconButton(
- icon: Icon(Icons.arrow_back, color: cIconColor),
+ icon: const Icon(Icons.arrow_back, color: cIconColor),
onPressed: () {
close(context, null);
},
@@ -104,7 +104,7 @@ class FavoriteRecipeSearch extends SearchDelegate {
@override
ThemeData appBarTheme(BuildContext context) {
return Theme.of(context).copyWith(
- textTheme: TextTheme(
+ textTheme: const TextTheme(
headline6: cSearchTextStyle,
),
);
diff --git a/lib/widgets/toastbar_widget.dart b/lib/widgets/toastbar_widget.dart
index 760ce2e..35068df 100644
--- a/lib/widgets/toastbar_widget.dart
+++ b/lib/widgets/toastbar_widget.dart
@@ -13,11 +13,11 @@ class ToastBar {
: null,
backgroundColor: error == true ? Colors.red : Colors.grey[900],
behavior: SnackBarBehavior.floating,
- duration: Duration(seconds: 5),
+ duration: const Duration(seconds: 5),
elevation: 5.0,
content: Text(
content,
- style: TextStyle(color: Colors.white),
+ style: const TextStyle(color: Colors.white),
overflow: TextOverflow.ellipsis,
),
);
diff --git a/lib/widgets/utility_icon_row_widget.dart b/lib/widgets/utility_icon_row_widget.dart
index 158110a..224823f 100644
--- a/lib/widgets/utility_icon_row_widget.dart
+++ b/lib/widgets/utility_icon_row_widget.dart
@@ -28,10 +28,10 @@ class UtilityIconRow extends StatefulWidget {
final Function cacheUnsavedRecipeCallback;
@override
- _UtilityIconRowState createState() => _UtilityIconRowState();
+ UtilityIconRowState createState() => UtilityIconRowState();
}
-class _UtilityIconRowState extends State<UtilityIconRow> {
+class UtilityIconRowState extends State<UtilityIconRow> {
bool _isInputSourceCamera = SettingsData.settings["photoSource"] == "0" ? true : false;
@override
@@ -69,11 +69,11 @@ class _UtilityIconRowState extends State<UtilityIconRow> {
bool _recipeHasImage = widget.unsavedRecipe.image == null;
if (_isInputSourceCamera) {
- _pickImageIcon = Icon(Icons.add_a_photo_rounded);
- _removeImageIcon = Icon(Icons.no_photography_rounded);
+ _pickImageIcon = const Icon(Icons.add_a_photo_rounded);
+ _removeImageIcon = const Icon(Icons.no_photography_rounded);
} else {
- _pickImageIcon = Icon(Icons.add_photo_alternate_rounded);
- _removeImageIcon = Icon(Icons.image_not_supported_rounded);
+ _pickImageIcon = const Icon(Icons.add_photo_alternate_rounded);
+ _removeImageIcon = const Icon(Icons.image_not_supported_rounded);
}
void _onPress() {
@@ -107,7 +107,7 @@ class _UtilityIconRowState extends State<UtilityIconRow> {
),
IconButton(
iconSize: 28.0,
- icon: Icon(Icons.star_border_rounded),
+ icon: const Icon(Icons.star_border_rounded),
onPressed: !widget.remote ? _onPress : null,
),
],
@@ -115,11 +115,11 @@ class _UtilityIconRowState extends State<UtilityIconRow> {
}
Widget _buildIconFavorite() {
- Icon icon = Icon(Icons.favorite_border_rounded);
+ Icon icon = const Icon(Icons.favorite_border_rounded);
Color color = Colors.black;
if (widget.unsavedRecipe.favorite) {
- icon = Icon(Icons.favorite_rounded);
+ icon = const Icon(Icons.favorite_rounded);
color = Colors.red;
}