forked from eatvio/eatvio_app
New screen names
This commit is contained in:
38
lib/widgets/app_bar/appbar_leading_image.dart
Normal file
38
lib/widgets/app_bar/appbar_leading_image.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AppbarLeadingImage extends StatelessWidget {
|
||||
AppbarLeadingImage({
|
||||
Key? key,
|
||||
this.imagePath,
|
||||
this.margin,
|
||||
this.onTap,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
String? imagePath;
|
||||
|
||||
EdgeInsetsGeometry? margin;
|
||||
|
||||
Function? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
onTap!.call();
|
||||
},
|
||||
child: Padding(
|
||||
padding: margin ?? EdgeInsets.zero,
|
||||
child: CustomImageView(
|
||||
imagePath: imagePath,
|
||||
height: 26.v,
|
||||
width: 13.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
38
lib/widgets/app_bar/appbar_title_image.dart
Normal file
38
lib/widgets/app_bar/appbar_title_image.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AppbarTitleImage extends StatelessWidget {
|
||||
AppbarTitleImage({
|
||||
Key? key,
|
||||
this.imagePath,
|
||||
this.margin,
|
||||
this.onTap,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
String? imagePath;
|
||||
|
||||
EdgeInsetsGeometry? margin;
|
||||
|
||||
Function? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
onTap!.call();
|
||||
},
|
||||
child: Padding(
|
||||
padding: margin ?? EdgeInsets.zero,
|
||||
child: CustomImageView(
|
||||
imagePath: imagePath,
|
||||
height: 26.v,
|
||||
width: 13.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
51
lib/widgets/app_bar/custom_app_bar.dart
Normal file
51
lib/widgets/app_bar/custom_app_bar.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
CustomAppBar({
|
||||
Key? key,
|
||||
this.height,
|
||||
this.leadingWidth,
|
||||
this.leading,
|
||||
this.title,
|
||||
this.centerTitle,
|
||||
this.actions,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
final double? height;
|
||||
|
||||
final double? leadingWidth;
|
||||
|
||||
final Widget? leading;
|
||||
|
||||
final Widget? title;
|
||||
|
||||
final bool? centerTitle;
|
||||
|
||||
final List<Widget>? actions;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
elevation: 0,
|
||||
toolbarHeight: height ?? 56.v,
|
||||
automaticallyImplyLeading: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
leadingWidth: leadingWidth ?? 0,
|
||||
leading: leading,
|
||||
title: title,
|
||||
titleSpacing: 0,
|
||||
centerTitle: centerTitle ?? false,
|
||||
actions: actions,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size(
|
||||
mediaQueryData.size.width,
|
||||
height ?? 56.v,
|
||||
);
|
||||
}
|
||||
42
lib/widgets/base_button.dart
Normal file
42
lib/widgets/base_button.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BaseButton extends StatelessWidget {
|
||||
BaseButton({
|
||||
Key? key,
|
||||
required this.text,
|
||||
this.onPressed,
|
||||
this.buttonStyle,
|
||||
this.buttonTextStyle,
|
||||
this.isDisabled,
|
||||
this.height,
|
||||
this.width,
|
||||
this.margin,
|
||||
this.alignment,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
final String text;
|
||||
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
final ButtonStyle? buttonStyle;
|
||||
|
||||
final TextStyle? buttonTextStyle;
|
||||
|
||||
final bool? isDisabled;
|
||||
|
||||
final double? height;
|
||||
|
||||
final double? width;
|
||||
|
||||
final EdgeInsets? margin;
|
||||
|
||||
final Alignment? alignment;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
143
lib/widgets/custom_drop_down.dart
Normal file
143
lib/widgets/custom_drop_down.dart
Normal file
@@ -0,0 +1,143 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomDropDown extends StatelessWidget {
|
||||
CustomDropDown({
|
||||
Key? key,
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.focusNode,
|
||||
this.icon,
|
||||
this.autofocus = true,
|
||||
this.textStyle,
|
||||
this.items,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.onChanged,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
final Alignment? alignment;
|
||||
|
||||
final double? width;
|
||||
|
||||
final FocusNode? focusNode;
|
||||
|
||||
final Widget? icon;
|
||||
|
||||
final bool? autofocus;
|
||||
|
||||
final TextStyle? textStyle;
|
||||
|
||||
final List<SelectionPopupModel>? items;
|
||||
|
||||
final String? hintText;
|
||||
|
||||
final TextStyle? hintStyle;
|
||||
|
||||
final Widget? prefix;
|
||||
|
||||
final BoxConstraints? prefixConstraints;
|
||||
|
||||
final Widget? suffix;
|
||||
|
||||
final BoxConstraints? suffixConstraints;
|
||||
|
||||
final EdgeInsets? contentPadding;
|
||||
|
||||
final InputBorder? borderDecoration;
|
||||
|
||||
final Color? fillColor;
|
||||
|
||||
final bool? filled;
|
||||
|
||||
final FormFieldValidator<SelectionPopupModel>? validator;
|
||||
|
||||
final Function(SelectionPopupModel)? onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: dropDownWidget,
|
||||
)
|
||||
: dropDownWidget;
|
||||
}
|
||||
|
||||
Widget get dropDownWidget => SizedBox(
|
||||
width: width ?? double.maxFinite,
|
||||
child: DropdownButtonFormField<SelectionPopupModel>(
|
||||
focusNode: focusNode ?? FocusNode(),
|
||||
icon: icon,
|
||||
autofocus: autofocus!,
|
||||
style: textStyle ?? theme.textTheme.titleMedium,
|
||||
items: items?.map((SelectionPopupModel item) {
|
||||
return DropdownMenuItem<SelectionPopupModel>(
|
||||
value: item,
|
||||
child: Text(
|
||||
item.title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: hintStyle ?? theme.textTheme.titleMedium,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
decoration: decoration,
|
||||
validator: validator,
|
||||
onChanged: (value) {
|
||||
onChanged!(value!);
|
||||
},
|
||||
),
|
||||
);
|
||||
InputDecoration get decoration => InputDecoration(
|
||||
hintText: hintText ?? "",
|
||||
hintStyle: hintStyle ?? theme.textTheme.titleMedium,
|
||||
prefixIcon: prefix,
|
||||
prefixIconConstraints: prefixConstraints,
|
||||
suffixIcon: suffix,
|
||||
suffixIconConstraints: suffixConstraints,
|
||||
isDense: true,
|
||||
contentPadding: contentPadding ??
|
||||
EdgeInsets.only(
|
||||
left: 6.h,
|
||||
top: 6.v,
|
||||
bottom: 6.v,
|
||||
),
|
||||
fillColor: fillColor ?? theme.colorScheme.onPrimary,
|
||||
filled: filled,
|
||||
border: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
borderSide: BorderSide(
|
||||
color: appTheme.blueA400,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
enabledBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
borderSide: BorderSide(
|
||||
color: appTheme.blueA400,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
borderSide: BorderSide(
|
||||
color: appTheme.blueA400,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
161
lib/widgets/custom_image_view.dart
Normal file
161
lib/widgets/custom_image_view.dart
Normal file
@@ -0,0 +1,161 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class CustomImageView extends StatelessWidget {
|
||||
///[imagePath] is required parameter for showing image
|
||||
String? imagePath;
|
||||
|
||||
double? height;
|
||||
double? width;
|
||||
Color? color;
|
||||
BoxFit? fit;
|
||||
final String placeHolder;
|
||||
Alignment? alignment;
|
||||
VoidCallback? onTap;
|
||||
EdgeInsetsGeometry? margin;
|
||||
BorderRadius? radius;
|
||||
BoxBorder? border;
|
||||
|
||||
///a [CustomImageView] it can be used for showing any type of images
|
||||
/// it will shows the placeholder image if image is not found on network image
|
||||
CustomImageView({
|
||||
this.imagePath,
|
||||
this.height,
|
||||
this.width,
|
||||
this.color,
|
||||
this.fit,
|
||||
this.alignment,
|
||||
this.onTap,
|
||||
this.radius,
|
||||
this.margin,
|
||||
this.border,
|
||||
this.placeHolder = 'assets/images/image_not_found.png',
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment!,
|
||||
child: _buildWidget(),
|
||||
)
|
||||
: _buildWidget();
|
||||
}
|
||||
|
||||
Widget _buildWidget() {
|
||||
return Padding(
|
||||
padding: margin ?? EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: _buildCircleImage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///build the image with border radius
|
||||
_buildCircleImage() {
|
||||
if (radius != null) {
|
||||
return ClipRRect(
|
||||
borderRadius: radius ?? BorderRadius.zero,
|
||||
child: _buildImageWithBorder(),
|
||||
);
|
||||
} else {
|
||||
return _buildImageWithBorder();
|
||||
}
|
||||
}
|
||||
|
||||
///build the image with border and border radius style
|
||||
_buildImageWithBorder() {
|
||||
if (border != null) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: border,
|
||||
borderRadius: radius,
|
||||
),
|
||||
child: _buildImageView(),
|
||||
);
|
||||
} else {
|
||||
return _buildImageView();
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildImageView() {
|
||||
if (imagePath != null) {
|
||||
switch (imagePath!.imageType) {
|
||||
case ImageType.svg:
|
||||
return Container(
|
||||
height: height,
|
||||
width: width,
|
||||
child: SvgPicture.asset(
|
||||
imagePath!,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: fit ?? BoxFit.contain,
|
||||
color: color,
|
||||
),
|
||||
);
|
||||
case ImageType.file:
|
||||
return Image.file(
|
||||
File(imagePath!),
|
||||
height: height,
|
||||
width: width,
|
||||
fit: fit ?? BoxFit.cover,
|
||||
color: color,
|
||||
);
|
||||
case ImageType.network:
|
||||
return CachedNetworkImage(
|
||||
height: height,
|
||||
width: width,
|
||||
fit: fit,
|
||||
imageUrl: imagePath!,
|
||||
color: color,
|
||||
placeholder: (context, url) => Container(
|
||||
height: 30,
|
||||
width: 30,
|
||||
child: LinearProgressIndicator(
|
||||
color: Colors.grey.shade200,
|
||||
backgroundColor: Colors.grey.shade100,
|
||||
),
|
||||
),
|
||||
errorWidget: (context, url, error) => Image.asset(
|
||||
placeHolder,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: fit ?? BoxFit.cover,
|
||||
),
|
||||
);
|
||||
case ImageType.png:
|
||||
default:
|
||||
return Image.asset(
|
||||
imagePath!,
|
||||
height: height,
|
||||
width: width,
|
||||
fit: fit ?? BoxFit.cover,
|
||||
color: color,
|
||||
);
|
||||
}
|
||||
}
|
||||
return SizedBox();
|
||||
}
|
||||
}
|
||||
|
||||
extension ImageTypeExtension on String {
|
||||
ImageType get imageType {
|
||||
if (this.startsWith('http') || this.startsWith('https')) {
|
||||
return ImageType.network;
|
||||
} else if (this.endsWith('.svg')) {
|
||||
return ImageType.svg;
|
||||
} else if (this.startsWith('file://')) {
|
||||
return ImageType.file;
|
||||
} else {
|
||||
return ImageType.png;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum ImageType { svg, png, network, file, unknown }
|
||||
73
lib/widgets/custom_outlined_button.dart
Normal file
73
lib/widgets/custom_outlined_button.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/base_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomOutlinedButton extends BaseButton {
|
||||
CustomOutlinedButton({
|
||||
Key? key,
|
||||
this.decoration,
|
||||
this.leftIcon,
|
||||
this.rightIcon,
|
||||
this.label,
|
||||
VoidCallback? onPressed,
|
||||
ButtonStyle? buttonStyle,
|
||||
TextStyle? buttonTextStyle,
|
||||
bool? isDisabled,
|
||||
Alignment? alignment,
|
||||
double? height,
|
||||
double? width,
|
||||
EdgeInsets? margin,
|
||||
required String text,
|
||||
}) : super(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
buttonStyle: buttonStyle,
|
||||
isDisabled: isDisabled,
|
||||
buttonTextStyle: buttonTextStyle,
|
||||
height: height,
|
||||
alignment: alignment,
|
||||
width: width,
|
||||
margin: margin,
|
||||
);
|
||||
|
||||
final BoxDecoration? decoration;
|
||||
|
||||
final Widget? leftIcon;
|
||||
|
||||
final Widget? rightIcon;
|
||||
|
||||
final Widget? label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: buildOutlinedButtonWidget,
|
||||
)
|
||||
: buildOutlinedButtonWidget;
|
||||
}
|
||||
|
||||
Widget get buildOutlinedButtonWidget => Container(
|
||||
height: this.height ?? 30.v,
|
||||
width: this.width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
style: buttonStyle,
|
||||
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
leftIcon ?? const SizedBox.shrink(),
|
||||
Text(
|
||||
text,
|
||||
style: buttonTextStyle ?? theme.textTheme.titleSmall,
|
||||
),
|
||||
rightIcon ?? const SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
135
lib/widgets/custom_text_form_field.dart
Normal file
135
lib/widgets/custom_text_form_field.dart
Normal file
@@ -0,0 +1,135 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomTextFormField extends StatelessWidget {
|
||||
CustomTextFormField({
|
||||
Key? key,
|
||||
this.alignment,
|
||||
this.width,
|
||||
this.controller,
|
||||
this.focusNode,
|
||||
this.autofocus = true,
|
||||
this.textStyle,
|
||||
this.obscureText = false,
|
||||
this.textInputAction = TextInputAction.next,
|
||||
this.textInputType = TextInputType.text,
|
||||
this.maxLines,
|
||||
this.hintText,
|
||||
this.hintStyle,
|
||||
this.prefix,
|
||||
this.prefixConstraints,
|
||||
this.suffix,
|
||||
this.suffixConstraints,
|
||||
this.contentPadding,
|
||||
this.borderDecoration,
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
}) : super(
|
||||
key: key,
|
||||
);
|
||||
|
||||
final Alignment? alignment;
|
||||
|
||||
final double? width;
|
||||
|
||||
final TextEditingController? controller;
|
||||
|
||||
final FocusNode? focusNode;
|
||||
|
||||
final bool? autofocus;
|
||||
|
||||
final TextStyle? textStyle;
|
||||
|
||||
final bool? obscureText;
|
||||
|
||||
final TextInputAction? textInputAction;
|
||||
|
||||
final TextInputType? textInputType;
|
||||
|
||||
final int? maxLines;
|
||||
|
||||
final String? hintText;
|
||||
|
||||
final TextStyle? hintStyle;
|
||||
|
||||
final Widget? prefix;
|
||||
|
||||
final BoxConstraints? prefixConstraints;
|
||||
|
||||
final Widget? suffix;
|
||||
|
||||
final BoxConstraints? suffixConstraints;
|
||||
|
||||
final EdgeInsets? contentPadding;
|
||||
|
||||
final InputBorder? borderDecoration;
|
||||
|
||||
final Color? fillColor;
|
||||
|
||||
final bool? filled;
|
||||
|
||||
final FormFieldValidator<String>? validator;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: textFormFieldWidget,
|
||||
)
|
||||
: textFormFieldWidget;
|
||||
}
|
||||
|
||||
Widget get textFormFieldWidget => SizedBox(
|
||||
width: width ?? double.maxFinite,
|
||||
child: TextFormField(
|
||||
controller: controller,
|
||||
focusNode: focusNode ?? FocusNode(),
|
||||
autofocus: autofocus!,
|
||||
style: textStyle ?? theme.textTheme.titleMedium,
|
||||
obscureText: obscureText!,
|
||||
textInputAction: textInputAction,
|
||||
keyboardType: textInputType,
|
||||
maxLines: maxLines ?? 1,
|
||||
decoration: decoration,
|
||||
validator: validator,
|
||||
),
|
||||
);
|
||||
InputDecoration get decoration => InputDecoration(
|
||||
hintText: hintText ?? "",
|
||||
hintStyle: hintStyle ?? theme.textTheme.bodyLarge,
|
||||
prefixIcon: prefix,
|
||||
prefixIconConstraints: prefixConstraints,
|
||||
suffixIcon: suffix,
|
||||
suffixIconConstraints: suffixConstraints,
|
||||
isDense: true,
|
||||
contentPadding: contentPadding ?? EdgeInsets.all(6.h),
|
||||
fillColor: fillColor ?? theme.colorScheme.onPrimary,
|
||||
filled: filled,
|
||||
border: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
borderSide: BorderSide(
|
||||
color: appTheme.blueA400,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
enabledBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
borderSide: BorderSide(
|
||||
color: appTheme.blueA400,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: borderDecoration ??
|
||||
OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.h),
|
||||
borderSide: BorderSide(
|
||||
color: appTheme.blueA400,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user