forked from eatvio/eatvio_app
fixed layout of diets feed and added text styles
This commit is contained in:
44
lib/core/widgets/bookmark_button.dart
Normal file
44
lib/core/widgets/bookmark_button.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BookmarkButton extends StatelessWidget {
|
||||
const BookmarkButton({
|
||||
super.key,
|
||||
required this.onTap,
|
||||
required this.color,
|
||||
required this.isFavorite,
|
||||
required this.width,
|
||||
required this.height,
|
||||
required this.size,
|
||||
this.shape,
|
||||
this.borderRadius,
|
||||
});
|
||||
final void Function() onTap;
|
||||
final Color color;
|
||||
final BoxShape? shape;
|
||||
final bool isFavorite;
|
||||
final BorderRadiusGeometry? borderRadius;
|
||||
final double width;
|
||||
final double height;
|
||||
final double size;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: width,
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
shape: shape ?? BoxShape.rectangle,
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
child: Icon(
|
||||
isFavorite ? Icons.bookmark : Icons.bookmark_border_rounded,
|
||||
color: appTheme.black,
|
||||
size: size,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
66
lib/core/widgets/diet_info_row.dart
Normal file
66
lib/core/widgets/diet_info_row.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
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/generated/l10n.dart';
|
||||
import 'package:eatvio_app/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/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});
|
||||
final Color? itemsBackgroundColor;
|
||||
final Diet diet;
|
||||
final bool disableDescriptionOfTypes;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
InfoBouble(
|
||||
backgroundColor: itemsBackgroundColor,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/icons/time2.svg',
|
||||
width: 13.3,
|
||||
height: 13.3,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
diet.duration.toString() + ' ' + getDayForm(diet.duration, s),
|
||||
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
InfoBouble(
|
||||
backgroundColor: itemsBackgroundColor,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/icons/people.svg',
|
||||
width: 13.3,
|
||||
height: 13.3,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
'80 человек прошли',
|
||||
style: TextStyles.textXSSemibold.copyWith(color: appTheme.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
InfoBouble(
|
||||
backgroundColor: itemsBackgroundColor,
|
||||
children: [
|
||||
TypeBadges(type: diet.type, disableDescriptionOfTypes: disableDescriptionOfTypes),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
51
lib/core/widgets/feed_icon_button.dart
Normal file
51
lib/core/widgets/feed_icon_button.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:eatvio_app/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
class FeedIconButton extends StatelessWidget {
|
||||
const FeedIconButton({super.key, this.icon, this.svgIcon, this.text, this.onTap, this.iconColor, this.backgroundColor, this.textColor});
|
||||
final IconData? icon;
|
||||
final SvgPicture? svgIcon;
|
||||
final String? text;
|
||||
final Function()? onTap;
|
||||
final Color? iconColor;
|
||||
final Color? backgroundColor;
|
||||
final Color? textColor;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap ?? () {},
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? appTheme.gray100,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
height: 32,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (svgIcon != null) svgIcon!,
|
||||
if (icon != null)
|
||||
Icon(
|
||||
icon,
|
||||
size: 16,
|
||||
color: iconColor ?? appTheme.gray600,
|
||||
),
|
||||
if (text != null) ...[
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
text!,
|
||||
style: TextStyles.textSMedium.copyWith(
|
||||
color: textColor ?? appTheme.gray600,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user