forked from eatvio/eatvio_app
my plans and my diets
This commit is contained in:
30
lib/core/widgets/add_item_button.dart
Normal file
30
lib/core/widgets/add_item_button.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class AddItemButton extends StatelessWidget {
|
||||
const AddItemButton({super.key, this.onTap});
|
||||
final Function()? onTap;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap ??
|
||||
() {
|
||||
GoRouter.of(context).pushNamed('blogPostCreateScreen');
|
||||
},
|
||||
borderRadius: BorderRadius.circular(64),
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add_rounded,
|
||||
color: appTheme.gray100,
|
||||
),
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@ 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});
|
||||
const AnimatedOptionButton({required this.text, required this.isSelected, required this.onTap, this.textStyle});
|
||||
final String text;
|
||||
final bool isSelected;
|
||||
final void Function() onTap;
|
||||
|
||||
final TextStyle? textStyle;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
@@ -22,9 +22,12 @@ class AnimatedOptionButton extends StatelessWidget {
|
||||
child: Center(
|
||||
child: AnimatedDefaultTextStyle(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
style: TextStyles.textMSemibold.copyWith(
|
||||
color: isSelected ? appTheme.whiteA700 : appTheme.black,
|
||||
),
|
||||
style: textStyle?.copyWith(
|
||||
color: isSelected ? appTheme.whiteA700 : appTheme.black,
|
||||
) ??
|
||||
TextStyles.textMSemibold.copyWith(
|
||||
color: isSelected ? appTheme.whiteA700 : appTheme.black,
|
||||
),
|
||||
child: Text(text),
|
||||
),
|
||||
),
|
||||
|
||||
45
lib/core/widgets/bottom_sheet_with_blur.dart
Normal file
45
lib/core/widgets/bottom_sheet_with_blur.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Future<void> showBottomSheetWithBlur({
|
||||
required BuildContext context,
|
||||
required Widget child,
|
||||
double height = 200,
|
||||
bool hasBlur = true,
|
||||
bool enableDrag = true,
|
||||
}) {
|
||||
return showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
barrierColor: appTheme.transparentBlack,
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
useSafeArea: true,
|
||||
enableDrag: enableDrag,
|
||||
builder: (context) => GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: hasBlur ? 24 : 0,
|
||||
sigmaY: hasBlur ? 24 : 0,
|
||||
tileMode: TileMode.mirror,
|
||||
),
|
||||
child: SizedBox(
|
||||
child: Container(
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
color: appTheme.whiteA700,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class CustomOutlinedButton extends BaseButton {
|
||||
width: this.width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
child: OutlinedButton(
|
||||
style: buttonStyle!,
|
||||
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
|
||||
child: Row(
|
||||
|
||||
59
lib/core/widgets/custom_search_bar.dart
Normal file
59
lib/core/widgets/custom_search_bar.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomSearchBar extends StatelessWidget {
|
||||
const CustomSearchBar({super.key, required this.searchController, required this.onChanged, this.backgroundColor, this.borderRadius, this.enableIcon = true, this.width});
|
||||
final Color? backgroundColor;
|
||||
final double? width;
|
||||
final double? borderRadius;
|
||||
final TextEditingController searchController;
|
||||
final void Function(String) onChanged;
|
||||
final bool enableIcon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 40,
|
||||
width: width ?? MediaQuery.of(context).size.width - 84,
|
||||
child: TextFormField(
|
||||
controller: searchController,
|
||||
autofocus: false,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
),
|
||||
onChanged: onChanged,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Поиск',
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 12,
|
||||
color: appTheme.gray600,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
prefixIcon: enableIcon
|
||||
? Icon(
|
||||
Icons.search,
|
||||
color: appTheme.gray600,
|
||||
size: 16,
|
||||
)
|
||||
: null,
|
||||
isDense: false,
|
||||
contentPadding: enableIcon ? EdgeInsets.all(8) : EdgeInsets.only(top: 8, left: 16, right: 8, bottom: 8),
|
||||
fillColor: backgroundColor ?? appTheme.gray100,
|
||||
filled: true,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? 16),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? 16),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? 16),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user