forked from eatvio/eatvio_app
create diet screen
This commit is contained in:
41
lib/core/widgets/custom_drop_down_button.dart
Normal file
41
lib/core/widgets/custom_drop_down_button.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
class CustomDropDownButton<T> extends StatelessWidget {
|
||||
const CustomDropDownButton({
|
||||
super.key,
|
||||
required this.items,
|
||||
required this.onChanged,
|
||||
this.value,
|
||||
this.hint,
|
||||
});
|
||||
final T? value;
|
||||
final List<DropdownMenuItem<T>> items;
|
||||
final void Function(T?)? onChanged;
|
||||
final Widget? hint;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButtonFormField(
|
||||
hint: hint,
|
||||
icon: SvgPicture.asset(
|
||||
'assets/icons/arrow_down2.svg',
|
||||
width: 12,
|
||||
height: 8,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
dropdownColor: appTheme.lightGray0,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
fillColor: appTheme.lightGray0,
|
||||
filled: true,
|
||||
),
|
||||
value: value,
|
||||
items: items,
|
||||
onChanged: onChanged,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
this.obscureText = false,
|
||||
this.textInputAction,
|
||||
this.textInputType,
|
||||
this.maxLines,
|
||||
this.maxLines = 1,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
@@ -35,6 +35,8 @@ class CustomTextFormField extends StatelessWidget {
|
||||
this.onEditingComplete,
|
||||
this.minLines = 1,
|
||||
this.maxLength,
|
||||
this.expands = false,
|
||||
this.textAlignVertical,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@@ -49,7 +51,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
final TextInputAction? textInputAction;
|
||||
final TextInputType? textInputType;
|
||||
final int? maxLines;
|
||||
final int minLines;
|
||||
final int? minLines;
|
||||
final String? hintText;
|
||||
final TextStyle? hintStyle;
|
||||
final Widget? prefix;
|
||||
@@ -69,12 +71,15 @@ class CustomTextFormField extends StatelessWidget {
|
||||
final void Function(String?)? onSaved;
|
||||
final void Function(String)? onChanged;
|
||||
final int? maxLength;
|
||||
|
||||
final bool expands;
|
||||
final TextAlignVertical? textAlignVertical;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: TextFormField(
|
||||
textAlignVertical: textAlignVertical,
|
||||
expands: expands,
|
||||
minLines: minLines,
|
||||
maxLength: maxLength,
|
||||
onChanged: onChanged,
|
||||
@@ -88,7 +93,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
),
|
||||
obscureText: obscureText!,
|
||||
textInputAction: textInputAction,
|
||||
maxLines: maxLines ?? 1,
|
||||
maxLines: maxLines,
|
||||
initialValue: initialValue,
|
||||
cursorColor: appTheme.blueA400,
|
||||
decoration: InputDecoration(
|
||||
|
||||
38
lib/core/widgets/main_background_bouble.dart
Normal file
38
lib/core/widgets/main_background_bouble.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
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,});
|
||||
final double? width;
|
||||
final Widget child;
|
||||
final bool enableShadow;
|
||||
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,),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.whiteA700,
|
||||
),
|
||||
width: width ?? MediaQuery.sizeOf(context).width,
|
||||
padding: padding,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user