forked from eatvio/eatvio_app
diet creation scrren is done
This commit is contained in:
34
lib/core/widgets/animated_option_button.dart
Normal file
34
lib/core/widgets/animated_option_button.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AnimatedOptionButton extends StatelessWidget {
|
||||
const AnimatedOptionButton({required this.text, required this.isSelected, required this.onTap});
|
||||
final String text;
|
||||
final bool isSelected;
|
||||
final void Function() onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
color: isSelected ? appTheme.blueA400 : appTheme.whiteA700,
|
||||
),
|
||||
child: Center(
|
||||
child: AnimatedDefaultTextStyle(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
style: TextStyles.textMSemibold.copyWith(
|
||||
color: isSelected ? appTheme.whiteA700 : appTheme.black,
|
||||
),
|
||||
child: Text(text),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,13 @@ class CustomDropDownButton<T> extends StatelessWidget {
|
||||
required this.onChanged,
|
||||
this.value,
|
||||
this.hint,
|
||||
this.hasError = false,
|
||||
});
|
||||
final T? value;
|
||||
final List<DropdownMenuItem<T>> items;
|
||||
final void Function(T?)? onChanged;
|
||||
final Widget? hint;
|
||||
final bool hasError;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButtonFormField(
|
||||
@@ -28,7 +30,15 @@ class CustomDropDownButton<T> extends StatelessWidget {
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
borderSide: hasError ? BorderSide(color: appTheme.red, width: 1) : BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: hasError ? BorderSide(color: appTheme.red, width: 1) : BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: hasError ? BorderSide(color: appTheme.red, width: 1) : BorderSide.none,
|
||||
),
|
||||
fillColor: appTheme.lightGray0,
|
||||
filled: true,
|
||||
|
||||
@@ -39,6 +39,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
this.textAlignVertical,
|
||||
this.counter = const SizedBox.shrink(),
|
||||
super.key,
|
||||
this.hasError = false,
|
||||
});
|
||||
final Widget? counter;
|
||||
final Alignment? alignment;
|
||||
@@ -74,12 +75,12 @@ class CustomTextFormField extends StatelessWidget {
|
||||
final int? maxLength;
|
||||
final bool expands;
|
||||
final TextAlignVertical? textAlignVertical;
|
||||
final bool hasError;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: TextFormField(
|
||||
|
||||
child: TextFormField(
|
||||
textAlignVertical: textAlignVertical,
|
||||
expands: expands,
|
||||
minLines: minLines,
|
||||
@@ -123,17 +124,17 @@ class CustomTextFormField extends StatelessWidget {
|
||||
border: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderSide: BorderSide.none,
|
||||
borderSide: hasError ? BorderSide(color: appTheme.red, width: 1) : BorderSide.none,
|
||||
),
|
||||
enabledBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderSide: BorderSide.none,
|
||||
borderSide: hasError ? BorderSide(color: appTheme.red, width: 1) : BorderSide.none,
|
||||
),
|
||||
focusedBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderSide: BorderSide.none,
|
||||
borderSide: hasError ? BorderSide(color: appTheme.red, width: 1) : BorderSide.none,
|
||||
),
|
||||
),
|
||||
keyboardType: keyboardType,
|
||||
|
||||
@@ -3,19 +3,29 @@ import 'package:eatvio_app/core/utils/localization_utils.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/info_bouble.dart';
|
||||
import 'package:eatvio_app/features/diets/presentation/widgets/type_badges.dart';
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
class DietInfoRow extends StatelessWidget {
|
||||
const DietInfoRow({super.key, required this.diet, this.itemsBackgroundColor, this.disableDescriptionOfTypes = false});
|
||||
class InfoRow extends StatelessWidget {
|
||||
const InfoRow({
|
||||
super.key,
|
||||
this.diet,
|
||||
this.itemsBackgroundColor,
|
||||
this.disableDescriptionOfTypes = false,
|
||||
this.plan,
|
||||
});
|
||||
final Color? itemsBackgroundColor;
|
||||
final Diet diet;
|
||||
final Diet? diet;
|
||||
final PlanModel? plan;
|
||||
|
||||
final bool disableDescriptionOfTypes;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
scrollDirection: Axis.horizontal,
|
||||
@@ -31,7 +41,7 @@ class DietInfoRow extends StatelessWidget {
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
diet.duration.toString() + ' ' + getDayForm(diet.duration, s),
|
||||
diet == null ? '${plan?.duration} ${getDayForm(plan?.duration ?? 7, s)}' : '${plan?.duration} ${getDayForm(plan?.duration ?? 7, s)}',
|
||||
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
@@ -53,12 +63,17 @@ class DietInfoRow extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
InfoBouble(
|
||||
backgroundColor: itemsBackgroundColor,
|
||||
children: [
|
||||
TypeBadges(type: diet.type, disableDescriptionOfTypes: disableDescriptionOfTypes),
|
||||
],
|
||||
),
|
||||
if (plan?.type.hasAtLeastOneType() == true || diet?.type.hasAtLeastOneType() == true)
|
||||
InfoBouble(
|
||||
backgroundColor: itemsBackgroundColor,
|
||||
children: [
|
||||
TypeBadges(
|
||||
type: diet?.type,
|
||||
planType: plan?.type,
|
||||
disableDescriptionOfTypes: disableDescriptionOfTypes,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -2,31 +2,41 @@ import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MainBackgroundBouble extends StatelessWidget {
|
||||
const MainBackgroundBouble(
|
||||
{super.key, required this.child, this.width, this.padding, this.enableShadow = false,});
|
||||
const MainBackgroundBouble({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.width,
|
||||
this.padding,
|
||||
this.enableShadow = false,
|
||||
this.hasError = false,
|
||||
});
|
||||
final double? width;
|
||||
final Widget child;
|
||||
final bool enableShadow;
|
||||
final bool hasError;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: enableShadow
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Color(0x00000000).withOpacity(0.2),
|
||||
spreadRadius: 0,
|
||||
blurRadius: 32,
|
||||
offset: Offset(0, 0),
|
||||
),
|
||||
]
|
||||
: null,),
|
||||
border: hasError ? Border.all(color: appTheme.red, width: 1) : null,
|
||||
boxShadow: enableShadow
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Color(0x00000000).withOpacity(0.2),
|
||||
spreadRadius: 0,
|
||||
blurRadius: 32,
|
||||
offset: Offset(0, 0),
|
||||
),
|
||||
]
|
||||
: null,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.whiteA700,
|
||||
border: hasError ? Border.all(color: appTheme.red, width: 1) : null,
|
||||
),
|
||||
width: width ?? MediaQuery.sizeOf(context).width,
|
||||
padding: padding,
|
||||
|
||||
Reference in New Issue
Block a user