New screen names

This commit is contained in:
2023-12-18 14:47:54 +03:00
parent 402f1ff5a4
commit 2a89da4ea7
181 changed files with 6105 additions and 0 deletions

20
lib/core/app_export.dart Normal file
View File

@@ -0,0 +1,20 @@
export 'package:connectivity_plus/connectivity_plus.dart';
export 'package:flutter_bloc/flutter_bloc.dart';
export 'package:eatvio_app/core/constants/constants.dart';
export 'package:eatvio_app/core/errors/exceptions.dart';
export 'package:eatvio_app/core/network/network_info.dart';
export 'package:eatvio_app/core/utils/image_constant.dart';
export 'package:eatvio_app/core/utils/logger.dart';
export 'package:eatvio_app/core/utils/navigator_service.dart';
export 'package:eatvio_app/core/utils/pref_utils.dart';
export 'package:eatvio_app/core/utils/size_utils.dart';
export 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
export 'package:eatvio_app/localization/app_localization.dart';
export 'package:eatvio_app/routes/app_routes.dart';
export 'package:eatvio_app/theme/app_decoration.dart';
export 'package:eatvio_app/theme/custom_text_style.dart';
export 'package:eatvio_app/theme/theme_helper.dart';
export 'package:eatvio_app/widgets/custom_image_view.dart';
export '../theme/bloc/theme_bloc.dart';
export '../theme/custom_button_style.dart';
export 'package:eatvio_app/core/utils/date_time_utils.dart';

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:eatvio_app/main.dart';
class ServerException implements Exception {}
class CacheException implements Exception {}
class NetworkException implements Exception {}
///can be used for throwing [NoInternetException]
class NoInternetException implements Exception {
late String _message;
NoInternetException([String message = 'NoInternetException Occurred']) {
if (globalMessengerKey.currentState != null) {
globalMessengerKey.currentState!
.showSnackBar(SnackBar(content: Text(message)));
}
this._message = message;
}
@override
String toString() {
return _message;
}
}

View File

@@ -0,0 +1,8 @@
abstract class Failure {}
// General failures
class ServerFailure extends Failure {}
class CacheFailure extends Failure {}
class NetworkFailure extends Failure {}

View File

@@ -0,0 +1,47 @@
import 'package:connectivity_plus/connectivity_plus.dart';
// For checking internet connectivity
abstract class NetworkInfoI {
Future<bool> isConnected();
Future<ConnectivityResult> get connectivityResult;
Stream<ConnectivityResult> get onConnectivityChanged;
}
class NetworkInfo implements NetworkInfoI {
Connectivity connectivity;
static final NetworkInfo _networkInfo = NetworkInfo._internal(Connectivity());
factory NetworkInfo() {
return _networkInfo;
}
NetworkInfo._internal(this.connectivity) {
connectivity = this.connectivity;
}
///checks internet is connected or not
///returns [true] if internet is connected
///else it will return [false]
@override
Future<bool> isConnected() async {
final result = await connectivity.checkConnectivity();
if (result != ConnectivityResult.none) {
return true;
}
return false;
}
// to check type of internet connectivity
@override
Future<ConnectivityResult> get connectivityResult async {
return connectivity.checkConnectivity();
}
//check the type on internet connection on changed of internet connection
@override
Stream<ConnectivityResult> get onConnectivityChanged =>
connectivity.onConnectivityChanged;
}

View File

@@ -0,0 +1,17 @@
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
const String dateTimeFormatPattern = 'dd/MM/yyyy';
extension DateTimeExtension on DateTime {
/// Return a string representing [date] formatted according to our locale
String format([
String pattern = dateTimeFormatPattern,
String? locale,
]) {
if (locale != null && locale.isNotEmpty) {
initializeDateFormatting(locale);
}
return DateFormat(pattern, locale).format(this);
}
}

View File

@@ -0,0 +1,16 @@
class ImageConstant {
// Image folder path
static String imagePath = 'assets/images';
// splash_screen images
static String img2456927096976 = '$imagePath/img_2456927096976.svg';
// Common images
static String imgArrowLeft = '$imagePath/img_arrow_left.svg';
static String imgLogoEatvio = '$imagePath/img_logo_eatvio.svg';
static String imgFavorite = '$imagePath/img_favorite.svg';
static String imageNotFound = 'assets/images/image_not_found.png';
}

View File

@@ -0,0 +1,15 @@
class Logger {
static LogMode _logMode = LogMode.debug;
static void init(LogMode mode) {
Logger._logMode = mode;
}
static void log(dynamic data, {StackTrace? stackTrace}) {
if (_logMode == LogMode.debug) {
print("Error: $data$stackTrace");
}
}
}
enum LogMode { debug, live }

View File

@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
class NavigatorService {
static GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
static Future<dynamic> pushNamed(String routeName,
{dynamic arguments}) async {
return navigatorKey.currentState
?.pushNamed(routeName, arguments: arguments);
}
static void goBack() {
return navigatorKey.currentState?.pop();
}
static Future<dynamic> pushNamedAndRemoveUntil(String routeName,
{bool routePredicate = false, dynamic arguments}) async {
return navigatorKey.currentState?.pushNamedAndRemoveUntil(
routeName, (route) => routePredicate,
arguments: arguments);
}
static Future<dynamic> popAndPushNamed(String routeName,
{dynamic arguments}) async {
return navigatorKey.currentState
?.popAndPushNamed(routeName, arguments: arguments);
}
}

View File

@@ -0,0 +1,38 @@
//ignore: unused_import
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/scheduler.dart';
import 'package:shared_preferences/shared_preferences.dart';
class PrefUtils {
static SharedPreferences? _sharedPreferences;
PrefUtils() {
// init();
SharedPreferences.getInstance().then((value) {
_sharedPreferences = value;
});
}
Future<void> init() async {
_sharedPreferences ??= await SharedPreferences.getInstance();
print('SharedPreference Initialized');
}
///will clear all the data stored in preference
void clearPreferencesData() async {
_sharedPreferences!.clear();
}
Future<void> setThemeData(String value) {
return _sharedPreferences!.setString('themeData', value);
}
String getThemeData() {
try {
return _sharedPreferences!.getString('themeData')!;
} catch (e) {
return 'primary';
}
}
}

View File

@@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:eatvio_app/core/app_export.dart';
class ProgressDialogUtils {
static bool isProgressVisible = false;
///common method for showing progress dialog
static void showProgressDialog(
{BuildContext? context, isCancellable = false}) async {
if (!isProgressVisible &&
NavigatorService.navigatorKey.currentState?.overlay?.context != null) {
showDialog(
barrierDismissible: isCancellable,
context: NavigatorService.navigatorKey.currentState!.overlay!.context,
builder: (BuildContext context) {
return Center(
child: CircularProgressIndicator.adaptive(
strokeWidth: 4,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.white,
),
),
);
});
isProgressVisible = true;
}
}
///common method for hiding progress dialog
static void hideProgressDialog() {
if (isProgressVisible)
Navigator.pop(
NavigatorService.navigatorKey.currentState!.overlay!.context);
isProgressVisible = false;
}
}

View File

@@ -0,0 +1,52 @@
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
// This functions are responsible to make UI responsive across all the mobile devices.
MediaQueryData mediaQueryData = MediaQueryData.fromWindow(ui.window);
// These are the Viewport values of your Figma Design.
// These are used in the code as a reference to create your UI Responsively.
const num FIGMA_DESIGN_WIDTH = 375;
const num FIGMA_DESIGN_HEIGHT = 812;
const num FIGMA_DESIGN_STATUS_BAR = 0;
///This extension is used to set padding/margin (for the top and bottom side) & height of the screen or widget according to the Viewport height.
extension ResponsiveExtension on num {
///This method is used to get device viewport width.
get _width {
return mediaQueryData.size.width;
}
///This method is used to get device viewport height.
get _height {
num statusBar = mediaQueryData.viewPadding.top;
num bottomBar = mediaQueryData.viewPadding.bottom;
num screenHeight = mediaQueryData.size.height - statusBar - bottomBar;
return screenHeight;
}
///This method is used to set padding/margin (for the left and Right side) & width of the screen or widget according to the Viewport width.
double get h => ((this * _width) / FIGMA_DESIGN_WIDTH);
///This method is used to set padding/margin (for the top and bottom side) & height of the screen or widget according to the Viewport height.
double get v =>
(this * _height) / (FIGMA_DESIGN_HEIGHT - FIGMA_DESIGN_STATUS_BAR);
///This method is used to set smallest px in image height and width
double get adaptSize {
var height = v;
var width = h;
return height < width ? height.toDoubleValue() : width.toDoubleValue();
}
///This method is used to set text font size according to Viewport
double get fSize => adaptSize;
}
extension FormatExtension on double {
/// Return a [double] value with formatted according to provided fractionDigits
double toDoubleValue({int fractionDigits = 2}) {
return double.parse(this.toStringAsFixed(fractionDigits));
}
}

View File

@@ -0,0 +1,3 @@
import 'package:eatvio_app/core/app_export.dart';
class ApiClient {}

View File

@@ -0,0 +1,15 @@
///SelectionPopupModel is common model
///used for setting data into dropdowns
class SelectionPopupModel {
int? id;
String title;
dynamic value;
bool isSelected;
SelectionPopupModel({
this.id,
required this.title,
this.value,
this.isSelected = false,
});
}

View File

@@ -0,0 +1,43 @@
import 'en_us/en_us_translations.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/cupertino.dart';
import '../core/app_export.dart';
class AppLocalization {
AppLocalization(this.locale);
Locale locale;
static final Map<String, Map<String, String>> _localizedValues = {'en': enUs};
static AppLocalization of() {
return Localizations.of<AppLocalization>(
NavigatorService.navigatorKey.currentContext!, AppLocalization)!;
}
static List<String> languages() => _localizedValues.keys.toList();
String getString(String text) =>
_localizedValues[locale.languageCode]![text] ?? text;
}
class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalization> {
const AppLocalizationDelegate();
@override
bool isSupported(Locale locale) =>
AppLocalization.languages().contains(locale.languageCode);
//Returning a SynchronousFuture here because an async "load" operation
//cause an async "load" operation
@override
Future<AppLocalization> load(Locale locale) {
return SynchronousFuture<AppLocalization>(AppLocalization(locale));
}
@override
bool shouldReload(AppLocalizationDelegate old) => false;
}
extension LocalizationExtension on String {
String get tr => AppLocalization.of().getString(this);
}

View File

@@ -0,0 +1,59 @@
final Map<String, String> enUs = {
// date_of_birth Screen
"lbl": "Дата Рождения", "lbl_01_01_2000": "01.01.2000",
// city_of_living Screen
"lbl4": "Страна", "lbl5": "Россия", "lbl6": "Город", "lbl7": "Москва",
"msg": "Место проживания",
// body_circumferences Screen
"lbl10": "Обхват бедр", "lbl8": "Обхват груди", "lbl9": "Обхват талии",
"msg2": "Первичные замеры",
// weight Screen
"lbl11": "Замер Веса", "lbl12": "Ваш вес:", "lbl_70": "70",
// allergies Screen
"msg3": "Наличие аллергии",
// medicine_intake Screen
"msg6": "Принимаете ли вы лекарства или бады?",
// gender Screen
"lbl13": "Ваш пол?",
// blood_pressure Screen
"lbl14": "Нет",
"msg10": "Есть ли у вас склонность к гипертании?",
"msg7": "Ваше артериальное давление?",
"msg8": "Средние показатели давления:",
"msg9": "Есть ли у вас склонность к гипо?",
// favorite_sports Screen
"msg11": "Ваши спортивные увлечения?",
// favorite_foods Screen
"lbl15": "Люблю продукты:",
"msg12": "Ваши любимые/нелюбимые продукты питания?",
"msg13": "Нелюбимые продукты:",
// schedule Screen
"lbl16": "Ваш режим дня?",
"msg14":
"Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:",
// additional_information Screen
"msg15": "Дополнительная информация:",
"msg16": "Введите любую дополнительную информацию на своё усмотрение:",
// language_select Screen
"lbl_english": "English", "msg17": "Предпочетаемый язык общения?",
// Common String
"lbl2": "Продолжить", "lbl3": "Пропустить", "lbl_60": "60", "lbl_90": "90",
"msg4": "Заполните информацию:", "msg5": "Введите информацию...",
// Network Error String
"msg_network_err": "Network Error",
"msg_something_went_wrong": "Something Went Wrong!",
};

54
lib/main.dart Normal file
View File

@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'core/app_export.dart';
var globalMessengerKey = GlobalKey<ScaffoldMessengerState>();
void main() {
WidgetsFlutterBinding.ensureInitialized();
Future.wait([
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]),
PrefUtils().init()
]).then((value) {
runApp(MyApp());
});
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => ThemeBloc(
ThemeState(
themeType: PrefUtils().getThemeData(),
),
),
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return MaterialApp(
theme: theme,
title: 'eatvio_app',
navigatorKey: NavigatorService.navigatorKey,
debugShowCheckedModeBanner: false,
localizationsDelegates: [
AppLocalizationDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
Locale(
'en',
'',
),
],
initialRoute: AppRoutes.initialRoute,
routes: AppRoutes.routes,
);
},
),
);
}
}

View File

@@ -0,0 +1,122 @@
import 'bloc/additional_information_bloc.dart';
import 'models/additional_information_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class AdditionalInformationScreen extends StatelessWidget {
const AdditionalInformationScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<AdditionalInformationBloc>(
create: (context) => AdditionalInformationBloc(
AdditionalInformationState(
additionalInformationModelObj: AdditionalInformationModel()))
..add(AdditionalInformationInitialEvent()),
child: AdditionalInformationScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
_buildProgressIndicator(context),
SizedBox(height: 20.v),
SizedBox(
width: 192.h,
child: Text("msg15".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall)),
SizedBox(height: 73.v),
_buildNinetyThree(context),
Spacer(),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicator(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
decoration: AppDecoration.outlinePrimary
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Container(
height: 8.v,
width: 332.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(4.h),
border:
Border.all(color: theme.colorScheme.primary, width: 1.h))));
}
/// Section Widget
Widget _buildNinetyThree(BuildContext context) {
return SizedBox(
height: 257.v,
width: 343.h,
child: Stack(alignment: Alignment.center, children: [
Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.only(left: 10.h, top: 69.v),
child: Text("msg5".tr, style: theme.textTheme.bodyLarge))),
Align(
alignment: Alignment.center,
child: Column(mainAxisSize: MainAxisSize.min, children: [
Container(
width: 294.h,
margin: EdgeInsets.only(left: 24.h, right: 23.h),
child: Text("msg16".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: CustomTextStyles.titleMediumSegoeUI)),
SizedBox(height: 10.v),
BlocSelector<AdditionalInformationBloc,
AdditionalInformationState, TextEditingController?>(
selector: (state) => state.editTextController,
builder: (context, editTextController) {
return CustomTextFormField(
controller: editTextController,
textInputAction: TextInputAction.done);
})
]))
]));
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,22 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/additional_information_screen/models/additional_information_model.dart';
part 'additional_information_event.dart';
part 'additional_information_state.dart';
/// A bloc that manages the state of a AdditionalInformation according to the event that is dispatched to it.
class AdditionalInformationBloc
extends Bloc<AdditionalInformationEvent, AdditionalInformationState> {
AdditionalInformationBloc(AdditionalInformationState initialState)
: super(initialState) {
on<AdditionalInformationInitialEvent>(_onInitialize);
}
_onInitialize(
AdditionalInformationInitialEvent event,
Emitter<AdditionalInformationState> emit,
) async {
emit(state.copyWith(editTextController: TextEditingController()));
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'additional_information_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///AdditionalInformation widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class AdditionalInformationEvent extends Equatable {}
/// Event that is dispatched when the AdditionalInformation widget is first created.
class AdditionalInformationInitialEvent extends AdditionalInformationEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,31 @@
// ignore_for_file: must_be_immutable
part of 'additional_information_bloc.dart';
/// Represents the state of AdditionalInformation in the application.
class AdditionalInformationState extends Equatable {
AdditionalInformationState({
this.editTextController,
this.additionalInformationModelObj,
});
TextEditingController? editTextController;
AdditionalInformationModel? additionalInformationModelObj;
@override
List<Object?> get props => [
editTextController,
additionalInformationModelObj,
];
AdditionalInformationState copyWith({
TextEditingController? editTextController,
AdditionalInformationModel? additionalInformationModelObj,
}) {
return AdditionalInformationState(
editTextController: editTextController ?? this.editTextController,
additionalInformationModelObj:
additionalInformationModelObj ?? this.additionalInformationModelObj,
);
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [additional_information_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class AdditionalInformationModel extends Equatable {
AdditionalInformationModel() {}
AdditionalInformationModel copyWith() {
return AdditionalInformationModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,95 @@
import 'bloc/allergies_bloc.dart';
import 'models/allergies_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class AllergiesScreen extends StatelessWidget {
const AllergiesScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<AllergiesBloc>(
create: (context) =>
AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel()))
..add(AllergiesInitialEvent()),
child: AllergiesScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.41,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
SizedBox(height: 22.v),
Text("msg3".tr, style: CustomTextStyles.headlineSmallMulish),
Spacer(flex: 36),
_buildNinetyThree(context),
Spacer(flex: 63),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildNinetyThree(BuildContext context) {
return Column(children: [
Text("msg4".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<AllergiesBloc, AllergiesState, TextEditingController?>(
selector: (state) => state.enterInformationController,
builder: (context, enterInformationController) {
return CustomTextFormField(
controller: enterInformationController,
hintText: "msg5".tr,
textInputAction: TextInputAction.done,
maxLines: 8);
})
]);
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,20 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/allergies_screen/models/allergies_model.dart';
part 'allergies_event.dart';
part 'allergies_state.dart';
/// A bloc that manages the state of a Allergies according to the event that is dispatched to it.
class AllergiesBloc extends Bloc<AllergiesEvent, AllergiesState> {
AllergiesBloc(AllergiesState initialState) : super(initialState) {
on<AllergiesInitialEvent>(_onInitialize);
}
_onInitialize(
AllergiesInitialEvent event,
Emitter<AllergiesState> emit,
) async {
emit(state.copyWith(enterInformationController: TextEditingController()));
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'allergies_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Allergies widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class AllergiesEvent extends Equatable {}
/// Event that is dispatched when the Allergies widget is first created.
class AllergiesInitialEvent extends AllergiesEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,31 @@
// ignore_for_file: must_be_immutable
part of 'allergies_bloc.dart';
/// Represents the state of Allergies in the application.
class AllergiesState extends Equatable {
AllergiesState({
this.enterInformationController,
this.allergiesModelObj,
});
TextEditingController? enterInformationController;
AllergiesModel? allergiesModelObj;
@override
List<Object?> get props => [
enterInformationController,
allergiesModelObj,
];
AllergiesState copyWith({
TextEditingController? enterInformationController,
AllergiesModel? allergiesModelObj,
}) {
return AllergiesState(
enterInformationController:
enterInformationController ?? this.enterInformationController,
allergiesModelObj: allergiesModelObj ?? this.allergiesModelObj,
);
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [allergies_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class AllergiesModel extends Equatable {
AllergiesModel() {}
AllergiesModel copyWith() {
return AllergiesModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,246 @@
import 'bloc/app_navigation_bloc.dart';
import 'models/app_navigation_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
class AppNavigationScreen extends StatelessWidget {
const AppNavigationScreen({Key? key})
: super(
key: key,
);
static Widget builder(BuildContext context) {
return BlocProvider<AppNavigationBloc>(
create: (context) => AppNavigationBloc(AppNavigationState(
appNavigationModelObj: AppNavigationModel(),
))
..add(AppNavigationInitialEvent()),
child: AppNavigationScreen(),
);
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<AppNavigationBloc, AppNavigationState>(
builder: (context, state) {
return SafeArea(
child: Scaffold(
backgroundColor: Color(0XFFFFFFFF),
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
_buildAppNavigation(context),
Expanded(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
_buildScreenTitle(
context,
screenTitle: "date_of_birth".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.dateOfBirthScreen),
),
_buildScreenTitle(
context,
screenTitle: "city_of_living".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.cityOfLivingScreen),
),
_buildScreenTitle(
context,
screenTitle: "body_circumferences".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.bodyCircumferencesScreen),
),
_buildScreenTitle(
context,
screenTitle: "weight".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.weightScreen),
),
_buildScreenTitle(
context,
screenTitle: "allergies".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.allergiesScreen),
),
_buildScreenTitle(
context,
screenTitle: "medicine_intake".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.medicineIntakeScreen),
),
_buildScreenTitle(
context,
screenTitle: "splash_screen".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.splashScreen),
),
_buildScreenTitle(
context,
screenTitle: "gender".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.genderScreen),
),
_buildScreenTitle(
context,
screenTitle: "blood_pressure".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.bloodPressureScreen),
),
_buildScreenTitle(
context,
screenTitle: "favorite_sports".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.favoriteSportsScreen),
),
_buildScreenTitle(
context,
screenTitle: "favorite_foods".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.favoriteFoodsScreen),
),
_buildScreenTitle(
context,
screenTitle: "schedule".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.scheduleScreen),
),
_buildScreenTitle(
context,
screenTitle: "additional_information".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.additionalInformationScreen),
),
_buildScreenTitle(
context,
screenTitle: "language_select".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.languageSelectScreen),
),
],
),
),
),
),
],
),
),
),
);
},
);
}
/// Section Widget
Widget _buildAppNavigation(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
"App Navigation".tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Text(
"Check your app's UI from the below demo screens of your app."
.tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF888888),
fontSize: 16.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF000000),
),
],
),
);
}
/// Common widget
Widget _buildScreenTitle(
BuildContext context, {
required String screenTitle,
Function? onTapScreenTitle,
}) {
return GestureDetector(
onTap: () {
onTapScreenTitle!.call();
},
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
screenTitle,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF888888),
),
],
),
),
);
}
/// Common click event
void onTapScreenTitle(String routeName) {
NavigatorService.pushNamed(routeName);
}
}

View File

@@ -0,0 +1,18 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/app_navigation_screen/models/app_navigation_model.dart';
part 'app_navigation_event.dart';
part 'app_navigation_state.dart';
/// A bloc that manages the state of a AppNavigation according to the event that is dispatched to it.
class AppNavigationBloc extends Bloc<AppNavigationEvent, AppNavigationState> {
AppNavigationBloc(AppNavigationState initialState) : super(initialState) {
on<AppNavigationInitialEvent>(_onInitialize);
}
_onInitialize(
AppNavigationInitialEvent event,
Emitter<AppNavigationState> emit,
) async {}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'app_navigation_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///AppNavigation widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class AppNavigationEvent extends Equatable {}
/// Event that is dispatched when the AppNavigation widget is first created.
class AppNavigationInitialEvent extends AppNavigationEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,21 @@
// ignore_for_file: must_be_immutable
part of 'app_navigation_bloc.dart';
/// Represents the state of AppNavigation in the application.
class AppNavigationState extends Equatable {
AppNavigationState({this.appNavigationModelObj});
AppNavigationModel? appNavigationModelObj;
@override
List<Object?> get props => [
appNavigationModelObj,
];
AppNavigationState copyWith({AppNavigationModel? appNavigationModelObj}) {
return AppNavigationState(
appNavigationModelObj:
appNavigationModelObj ?? this.appNavigationModelObj,
);
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [app_navigation_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class AppNavigationModel extends Equatable {
AppNavigationModel() {}
AppNavigationModel copyWith() {
return AppNavigationModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,41 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/blood_pressure_screen/models/blood_pressure_model.dart';
part 'blood_pressure_event.dart';
part 'blood_pressure_state.dart';
/// A bloc that manages the state of a BloodPressure according to the event that is dispatched to it.
class BloodPressureBloc extends Bloc<BloodPressureEvent, BloodPressureState> {
BloodPressureBloc(BloodPressureState initialState) : super(initialState) {
on<BloodPressureInitialEvent>(_onInitialize);
on<ChangeDropDownEvent>(_changeDropDown);
}
_changeDropDown(
ChangeDropDownEvent event,
Emitter<BloodPressureState> emit,
) {
emit(state.copyWith(selectedDropDownValue: event.value));
}
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(id: 1, title: "Item One", isSelected: true),
SelectionPopupModel(id: 2, title: "Item Two"),
SelectionPopupModel(id: 3, title: "Item Three")
];
}
_onInitialize(
BloodPressureInitialEvent event,
Emitter<BloodPressureState> emit,
) async {
emit(state.copyWith(
valueController: TextEditingController(),
valueController1: TextEditingController()));
emit(state.copyWith(
bloodPressureModelObj: state.bloodPressureModelObj
?.copyWith(dropdownItemList: fillDropdownItemList())));
}
}

View File

@@ -0,0 +1,28 @@
// ignore_for_file: must_be_immutable
part of 'blood_pressure_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///BloodPressure widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class BloodPressureEvent extends Equatable {}
/// Event that is dispatched when the BloodPressure widget is first created.
class BloodPressureInitialEvent extends BloodPressureEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeDropDownEvent extends BloodPressureEvent {
ChangeDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -0,0 +1,44 @@
// ignore_for_file: must_be_immutable
part of 'blood_pressure_bloc.dart';
/// Represents the state of BloodPressure in the application.
class BloodPressureState extends Equatable {
BloodPressureState({
this.valueController,
this.valueController1,
this.selectedDropDownValue,
this.bloodPressureModelObj,
});
TextEditingController? valueController;
TextEditingController? valueController1;
SelectionPopupModel? selectedDropDownValue;
BloodPressureModel? bloodPressureModelObj;
@override
List<Object?> get props => [
valueController,
valueController1,
selectedDropDownValue,
bloodPressureModelObj,
];
BloodPressureState copyWith({
TextEditingController? valueController,
TextEditingController? valueController1,
SelectionPopupModel? selectedDropDownValue,
BloodPressureModel? bloodPressureModelObj,
}) {
return BloodPressureState(
valueController: valueController ?? this.valueController,
valueController1: valueController1 ?? this.valueController1,
selectedDropDownValue:
selectedDropDownValue ?? this.selectedDropDownValue,
bloodPressureModelObj:
bloodPressureModelObj ?? this.bloodPressureModelObj,
);
}
}

View File

@@ -0,0 +1,152 @@
import 'bloc/blood_pressure_bloc.dart';
import 'models/blood_pressure_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class BloodPressureScreen extends StatelessWidget {
const BloodPressureScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<BloodPressureBloc>(
create: (context) => BloodPressureBloc(
BloodPressureState(bloodPressureModelObj: BloodPressureModel()))
..add(BloodPressureInitialEvent()),
child: BloodPressureScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary,
width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.63,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400))))),
SizedBox(height: 21.v),
SizedBox(
width: 224.h,
child: Text("msg7".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall)),
SizedBox(height: 77.v),
_buildThirtyThree(context),
SizedBox(height: 22.v),
Text("msg9".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: BlocSelector<BloodPressureBloc, BloodPressureState,
TextEditingController?>(
selector: (state) => state.valueController1,
builder: (context, valueController1) {
return CustomTextFormField(
controller: valueController1,
hintText: "lbl_60".tr,
textInputAction: TextInputAction.done);
})),
SizedBox(height: 22.v),
Text("msg10".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.h),
child: BlocSelector<BloodPressureBloc, BloodPressureState,
BloodPressureModel?>(
selector: (state) => state.bloodPressureModelObj,
builder: (context, bloodPressureModelObj) {
return CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(
30.h, 11.v, 13.h, 11.v),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(1.h)),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize)),
hintText: "lbl14".tr,
items:
bloodPressureModelObj?.dropdownItemList ??
[],
onChanged: (value) {
context
.read<BloodPressureBloc>()
.add(ChangeDropDownEvent(value: value));
});
})),
Spacer(),
CustomOutlinedButton(
text: "lbl2".tr.toUpperCase(),
margin: EdgeInsets.symmetric(horizontal: 4.h)),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildThirtyThree(BuildContext context) {
return Container(
margin: EdgeInsets.only(right: 1.h),
padding: EdgeInsets.symmetric(horizontal: 3.h),
child: Column(children: [
Text("msg8".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocSelector<BloodPressureBloc, BloodPressureState,
TextEditingController?>(
selector: (state) => state.valueController,
builder: (context, valueController) {
return CustomTextFormField(
controller: valueController, hintText: "lbl_90".tr);
})
]));
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,21 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
/// This class defines the variables used in the [blood_pressure_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class BloodPressureModel extends Equatable {
BloodPressureModel({this.dropdownItemList = const []}) {}
List<SelectionPopupModel> dropdownItemList;
BloodPressureModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
return BloodPressureModel(
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
);
}
@override
List<Object?> get props => [dropdownItemList];
}

View File

@@ -0,0 +1,25 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/body_circumferences_screen/models/body_circumferences_model.dart';
part 'body_circumferences_event.dart';
part 'body_circumferences_state.dart';
/// A bloc that manages the state of a BodyCircumferences according to the event that is dispatched to it.
class BodyCircumferencesBloc
extends Bloc<BodyCircumferencesEvent, BodyCircumferencesState> {
BodyCircumferencesBloc(BodyCircumferencesState initialState)
: super(initialState) {
on<BodyCircumferencesInitialEvent>(_onInitialize);
}
_onInitialize(
BodyCircumferencesInitialEvent event,
Emitter<BodyCircumferencesState> emit,
) async {
emit(state.copyWith(
valueController: TextEditingController(),
valueController1: TextEditingController(),
valueController2: TextEditingController()));
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'body_circumferences_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///BodyCircumferences widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class BodyCircumferencesEvent extends Equatable {}
/// Event that is dispatched when the BodyCircumferences widget is first created.
class BodyCircumferencesInitialEvent extends BodyCircumferencesEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,43 @@
// ignore_for_file: must_be_immutable
part of 'body_circumferences_bloc.dart';
/// Represents the state of BodyCircumferences in the application.
class BodyCircumferencesState extends Equatable {
BodyCircumferencesState({
this.valueController,
this.valueController1,
this.valueController2,
this.bodyCircumferencesModelObj,
});
TextEditingController? valueController;
TextEditingController? valueController1;
TextEditingController? valueController2;
BodyCircumferencesModel? bodyCircumferencesModelObj;
@override
List<Object?> get props => [
valueController,
valueController1,
valueController2,
bodyCircumferencesModelObj,
];
BodyCircumferencesState copyWith({
TextEditingController? valueController,
TextEditingController? valueController1,
TextEditingController? valueController2,
BodyCircumferencesModel? bodyCircumferencesModelObj,
}) {
return BodyCircumferencesState(
valueController: valueController ?? this.valueController,
valueController1: valueController1 ?? this.valueController1,
valueController2: valueController2 ?? this.valueController2,
bodyCircumferencesModelObj:
bodyCircumferencesModelObj ?? this.bodyCircumferencesModelObj,
);
}
}

View File

@@ -0,0 +1,116 @@
import 'bloc/body_circumferences_bloc.dart';
import 'models/body_circumferences_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class BodyCircumferencesScreen extends StatelessWidget {
const BodyCircumferencesScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<BodyCircumferencesBloc>(
create: (context) => BodyCircumferencesBloc(BodyCircumferencesState(
bodyCircumferencesModelObj: BodyCircumferencesModel()))
..add(BodyCircumferencesInitialEvent()),
child: BodyCircumferencesScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.29,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
SizedBox(height: 39.v),
Text("msg2".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 93.v),
_buildTwentySeven(context),
SizedBox(height: 19.v),
Text("lbl9".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
TextEditingController?>(
selector: (state) => state.valueController1,
builder: (context, valueController1) {
return CustomTextFormField(
controller: valueController1,
hintText: "lbl_60".tr);
}),
SizedBox(height: 21.v),
Text("lbl10".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
TextEditingController?>(
selector: (state) => state.valueController2,
builder: (context, valueController2) {
return CustomTextFormField(
controller: valueController2,
hintText: "lbl_90".tr,
textInputAction: TextInputAction.done);
}),
Spacer(),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildTwentySeven(BuildContext context) {
return Column(children: [
Text("lbl8".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<BodyCircumferencesBloc, BodyCircumferencesState,
TextEditingController?>(
selector: (state) => state.valueController,
builder: (context, valueController) {
return CustomTextFormField(
controller: valueController, hintText: "lbl_90".tr);
})
]);
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [body_circumferences_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class BodyCircumferencesModel extends Equatable {
BodyCircumferencesModel() {}
BodyCircumferencesModel copyWith() {
return BodyCircumferencesModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,55 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/city_of_living_screen/models/city_of_living_model.dart';
part 'city_of_living_event.dart';
part 'city_of_living_state.dart';
/// A bloc that manages the state of a CityOfLiving according to the event that is dispatched to it.
class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
CityOfLivingBloc(CityOfLivingState initialState) : super(initialState) {
on<CityOfLivingInitialEvent>(_onInitialize);
on<ChangeDropDownEvent>(_changeDropDown);
on<ChangeDropDown1Event>(_changeDropDown1);
}
_onInitialize(
CityOfLivingInitialEvent event,
Emitter<CityOfLivingState> emit,
) async {
emit(state.copyWith(
cityOfLivingModelObj: state.cityOfLivingModelObj?.copyWith(
dropdownItemList: fillDropdownItemList(),
dropdownItemList1: fillDropdownItemList1())));
}
_changeDropDown(
ChangeDropDownEvent event,
Emitter<CityOfLivingState> emit,
) {
emit(state.copyWith(selectedDropDownValue: event.value));
}
_changeDropDown1(
ChangeDropDown1Event event,
Emitter<CityOfLivingState> emit,
) {
emit(state.copyWith(selectedDropDownValue1: event.value));
}
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(id: 1, title: "Item One", isSelected: true),
SelectionPopupModel(id: 2, title: "Item Two"),
SelectionPopupModel(id: 3, title: "Item Three")
];
}
List<SelectionPopupModel> fillDropdownItemList1() {
return [
SelectionPopupModel(id: 1, title: "Item One", isSelected: true),
SelectionPopupModel(id: 2, title: "Item Two"),
SelectionPopupModel(id: 3, title: "Item Three")
];
}
}

View File

@@ -0,0 +1,40 @@
// ignore_for_file: must_be_immutable
part of 'city_of_living_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///CityOfLiving widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class CityOfLivingEvent extends Equatable {}
/// Event that is dispatched when the CityOfLiving widget is first created.
class CityOfLivingInitialEvent extends CityOfLivingEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeDropDownEvent extends CityOfLivingEvent {
ChangeDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}
///event for dropdown selection
class ChangeDropDown1Event extends CityOfLivingEvent {
ChangeDropDown1Event({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -0,0 +1,38 @@
// ignore_for_file: must_be_immutable
part of 'city_of_living_bloc.dart';
/// Represents the state of CityOfLiving in the application.
class CityOfLivingState extends Equatable {
CityOfLivingState({
this.selectedDropDownValue,
this.selectedDropDownValue1,
this.cityOfLivingModelObj,
});
SelectionPopupModel? selectedDropDownValue;
SelectionPopupModel? selectedDropDownValue1;
CityOfLivingModel? cityOfLivingModelObj;
@override
List<Object?> get props => [
selectedDropDownValue,
selectedDropDownValue1,
cityOfLivingModelObj,
];
CityOfLivingState copyWith({
SelectionPopupModel? selectedDropDownValue,
SelectionPopupModel? selectedDropDownValue1,
CityOfLivingModel? cityOfLivingModelObj,
}) {
return CityOfLivingState(
selectedDropDownValue:
selectedDropDownValue ?? this.selectedDropDownValue,
selectedDropDownValue1:
selectedDropDownValue1 ?? this.selectedDropDownValue1,
cityOfLivingModelObj: cityOfLivingModelObj ?? this.cityOfLivingModelObj,
);
}
}

View File

@@ -0,0 +1,126 @@
import 'bloc/city_of_living_bloc.dart';
import 'models/city_of_living_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
class CityOfLivingScreen extends StatelessWidget {
const CityOfLivingScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<CityOfLivingBloc>(
create: (context) => CityOfLivingBloc(
CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel()))
..add(CityOfLivingInitialEvent()),
child: CityOfLivingScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.23,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
SizedBox(height: 39.v),
Text("msg".tr, style: theme.textTheme.headlineSmall),
Spacer(flex: 34),
Text("lbl4".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocSelector<CityOfLivingBloc, CityOfLivingState,
CityOfLivingModel?>(
selector: (state) => state.cityOfLivingModelObj,
builder: (context, cityOfLivingModelObj) {
return CustomDropDown(
icon: Container(
margin:
EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(1.h)),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize)),
hintText: "lbl5".tr,
items: cityOfLivingModelObj?.dropdownItemList ?? [],
onChanged: (value) {
context
.read<CityOfLivingBloc>()
.add(ChangeDropDownEvent(value: value));
});
}),
SizedBox(height: 22.v),
Text("lbl6".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 2.v),
BlocSelector<CityOfLivingBloc, CityOfLivingState,
CityOfLivingModel?>(
selector: (state) => state.cityOfLivingModelObj,
builder: (context, cityOfLivingModelObj) {
return CustomDropDown(
icon: Container(
margin:
EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(1.h)),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize)),
hintText: "lbl7".tr,
items:
cityOfLivingModelObj?.dropdownItemList1 ?? [],
onChanged: (value) {
context
.read<CityOfLivingBloc>()
.add(ChangeDropDown1Event(value: value));
});
}),
Spacer(flex: 65),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,30 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
/// This class defines the variables used in the [city_of_living_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class CityOfLivingModel extends Equatable {
CityOfLivingModel({
this.dropdownItemList = const [],
this.dropdownItemList1 = const [],
}) {}
List<SelectionPopupModel> dropdownItemList;
List<SelectionPopupModel> dropdownItemList1;
CityOfLivingModel copyWith({
List<SelectionPopupModel>? dropdownItemList,
List<SelectionPopupModel>? dropdownItemList1,
}) {
return CityOfLivingModel(
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
dropdownItemList1: dropdownItemList1 ?? this.dropdownItemList1,
);
}
@override
List<Object?> get props => [dropdownItemList, dropdownItemList1];
}

View File

@@ -0,0 +1,18 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/date_of_birth_screen/models/date_of_birth_model.dart';
part 'date_of_birth_event.dart';
part 'date_of_birth_state.dart';
/// A bloc that manages the state of a DateOfBirth according to the event that is dispatched to it.
class DateOfBirthBloc extends Bloc<DateOfBirthEvent, DateOfBirthState> {
DateOfBirthBloc(DateOfBirthState initialState) : super(initialState) {
on<DateOfBirthInitialEvent>(_onInitialize);
}
_onInitialize(
DateOfBirthInitialEvent event,
Emitter<DateOfBirthState> emit,
) async {}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'date_of_birth_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///DateOfBirth widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class DateOfBirthEvent extends Equatable {}
/// Event that is dispatched when the DateOfBirth widget is first created.
class DateOfBirthInitialEvent extends DateOfBirthEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,20 @@
// ignore_for_file: must_be_immutable
part of 'date_of_birth_bloc.dart';
/// Represents the state of DateOfBirth in the application.
class DateOfBirthState extends Equatable {
DateOfBirthState({this.dateOfBirthModelObj});
DateOfBirthModel? dateOfBirthModelObj;
@override
List<Object?> get props => [
dateOfBirthModelObj,
];
DateOfBirthState copyWith({DateOfBirthModel? dateOfBirthModelObj}) {
return DateOfBirthState(
dateOfBirthModelObj: dateOfBirthModelObj ?? this.dateOfBirthModelObj,
);
}
}

View File

@@ -0,0 +1,114 @@
import 'bloc/date_of_birth_bloc.dart';
import 'models/date_of_birth_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
class DateOfBirthScreen extends StatelessWidget {
const DateOfBirthScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<DateOfBirthBloc>(
create: (context) => DateOfBirthBloc(
DateOfBirthState(dateOfBirthModelObj: DateOfBirthModel()))
..add(DateOfBirthInitialEvent()),
child: DateOfBirthScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<DateOfBirthBloc, DateOfBirthState>(
builder: (context, state) {
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding:
EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
_buildProgressIndicator(context),
SizedBox(height: 38.v),
Text("lbl".tr, style: theme.textTheme.headlineSmall),
Spacer(flex: 39),
_buildDateInput(context),
Spacer(flex: 60),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: 8.h),
child: Text("lbl3".tr,
style: theme.textTheme.bodyLarge)))
]))));
});
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicator(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
decoration: AppDecoration.outlinePrimary
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Container(
height: 8.v,
width: 60.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(4.h),
border:
Border.all(color: theme.colorScheme.primary, width: 1.h))));
}
/// Section Widget
Widget _buildDateInput(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 1.v),
decoration: AppDecoration.outlineBlueA
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize,
radius: BorderRadius.circular(1.h)),
SizedBox(height: 6.v),
Align(
alignment: Alignment.center,
child: Text("lbl_01_01_2000".tr,
style: theme.textTheme.titleMedium)),
SizedBox(height: 4.v)
]));
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [date_of_birth_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class DateOfBirthModel extends Equatable {
DateOfBirthModel() {}
DateOfBirthModel copyWith() {
return DateOfBirthModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,22 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/favorite_foods_screen/models/favorite_foods_model.dart';
part 'favorite_foods_event.dart';
part 'favorite_foods_state.dart';
/// A bloc that manages the state of a FavoriteFoods according to the event that is dispatched to it.
class FavoriteFoodsBloc extends Bloc<FavoriteFoodsEvent, FavoriteFoodsState> {
FavoriteFoodsBloc(FavoriteFoodsState initialState) : super(initialState) {
on<FavoriteFoodsInitialEvent>(_onInitialize);
}
_onInitialize(
FavoriteFoodsInitialEvent event,
Emitter<FavoriteFoodsState> emit,
) async {
emit(state.copyWith(
enterinformationController: TextEditingController(),
enterinformationController1: TextEditingController()));
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'favorite_foods_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///FavoriteFoods widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class FavoriteFoodsEvent extends Equatable {}
/// Event that is dispatched when the FavoriteFoods widget is first created.
class FavoriteFoodsInitialEvent extends FavoriteFoodsEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,39 @@
// ignore_for_file: must_be_immutable
part of 'favorite_foods_bloc.dart';
/// Represents the state of FavoriteFoods in the application.
class FavoriteFoodsState extends Equatable {
FavoriteFoodsState({
this.enterinformationController,
this.enterinformationController1,
this.favoriteFoodsModelObj,
});
TextEditingController? enterinformationController;
TextEditingController? enterinformationController1;
FavoriteFoodsModel? favoriteFoodsModelObj;
@override
List<Object?> get props => [
enterinformationController,
enterinformationController1,
favoriteFoodsModelObj,
];
FavoriteFoodsState copyWith({
TextEditingController? enterinformationController,
TextEditingController? enterinformationController1,
FavoriteFoodsModel? favoriteFoodsModelObj,
}) {
return FavoriteFoodsState(
enterinformationController:
enterinformationController ?? this.enterinformationController,
enterinformationController1:
enterinformationController1 ?? this.enterinformationController1,
favoriteFoodsModelObj:
favoriteFoodsModelObj ?? this.favoriteFoodsModelObj,
);
}
}

View File

@@ -0,0 +1,125 @@
import 'bloc/favorite_foods_bloc.dart';
import 'models/favorite_foods_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class FavoriteFoodsScreen extends StatelessWidget {
const FavoriteFoodsScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<FavoriteFoodsBloc>(
create: (context) => FavoriteFoodsBloc(
FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel()))
..add(FavoriteFoodsInitialEvent()),
child: FavoriteFoodsScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
_buildProgressIndicator(context),
SizedBox(height: 19.v),
Container(
width: 327.h,
margin: EdgeInsets.only(left: 8.h, right: 7.h),
child: Text("msg12".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall)),
SizedBox(height: 23.v),
_buildNinetyThree(context),
SizedBox(height: 22.v),
_buildNinetyThree1(context),
SizedBox(height: 27.v),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicator(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
decoration: AppDecoration.outlinePrimary
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Container(
height: 8.v,
width: 279.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(4.h),
border:
Border.all(color: theme.colorScheme.primary, width: 1.h))));
}
/// Section Widget
Widget _buildNinetyThree(BuildContext context) {
return Column(children: [
Text("lbl15".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState,
TextEditingController?>(
selector: (state) => state.enterinformationController,
builder: (context, enterinformationController) {
return CustomTextFormField(
controller: enterinformationController,
hintText: "msg5".tr,
maxLines: 8);
})
]);
}
/// Section Widget
Widget _buildNinetyThree1(BuildContext context) {
return Column(children: [
Text("msg13".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<FavoriteFoodsBloc, FavoriteFoodsState,
TextEditingController?>(
selector: (state) => state.enterinformationController1,
builder: (context, enterinformationController1) {
return CustomTextFormField(
controller: enterinformationController1,
hintText: "msg5".tr,
textInputAction: TextInputAction.done,
maxLines: 8);
})
]);
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [favorite_foods_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class FavoriteFoodsModel extends Equatable {
FavoriteFoodsModel() {}
FavoriteFoodsModel copyWith() {
return FavoriteFoodsModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,23 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/favorite_sports_screen/models/favorite_sports_model.dart';
part 'favorite_sports_event.dart';
part 'favorite_sports_state.dart';
/// A bloc that manages the state of a FavoriteSports according to the event that is dispatched to it.
class FavoriteSportsBloc
extends Bloc<FavoriteSportsEvent, FavoriteSportsState> {
FavoriteSportsBloc(FavoriteSportsState initialState) : super(initialState) {
on<FavoriteSportsInitialEvent>(_onInitialize);
}
_onInitialize(
FavoriteSportsInitialEvent event,
Emitter<FavoriteSportsState> emit,
) async {
emit(state.copyWith(
enterinformationController: TextEditingController(),
));
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'favorite_sports_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///FavoriteSports widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class FavoriteSportsEvent extends Equatable {}
/// Event that is dispatched when the FavoriteSports widget is first created.
class FavoriteSportsInitialEvent extends FavoriteSportsEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,32 @@
// ignore_for_file: must_be_immutable
part of 'favorite_sports_bloc.dart';
/// Represents the state of FavoriteSports in the application.
class FavoriteSportsState extends Equatable {
FavoriteSportsState({
this.enterinformationController,
this.favoriteSportsModelObj,
});
TextEditingController? enterinformationController;
FavoriteSportsModel? favoriteSportsModelObj;
@override
List<Object?> get props => [
enterinformationController,
favoriteSportsModelObj,
];
FavoriteSportsState copyWith({
TextEditingController? enterinformationController,
FavoriteSportsModel? favoriteSportsModelObj,
}) {
return FavoriteSportsState(
enterinformationController:
enterinformationController ?? this.enterinformationController,
favoriteSportsModelObj:
favoriteSportsModelObj ?? this.favoriteSportsModelObj,
);
}
}

View File

@@ -0,0 +1,127 @@
import 'bloc/favorite_sports_bloc.dart';
import 'models/favorite_sports_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class FavoriteSportsScreen extends StatelessWidget {
const FavoriteSportsScreen({Key? key})
: super(
key: key,
);
static Widget builder(BuildContext context) {
return BlocProvider<FavoriteSportsBloc>(
create: (context) => FavoriteSportsBloc(FavoriteSportsState(
favoriteSportsModelObj: FavoriteSportsModel(),
))
..add(FavoriteSportsInitialEvent()),
child: FavoriteSportsScreen(),
);
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: 16.h,
vertical: 5.v,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgLogoEatvio,
height: 50.adaptSize,
width: 50.adaptSize,
),
SizedBox(height: 20.v),
_buildProgressIndicatorSection(context),
SizedBox(height: 38.v),
Text(
"msg11".tr,
style: theme.textTheme.headlineSmall,
),
Spacer(
flex: 32,
),
_buildNinetyThreeSection(context),
Spacer(
flex: 67,
),
CustomOutlinedButton(
text: "lbl2".tr.toUpperCase(),
),
SizedBox(height: 17.v),
Text(
"lbl3".tr,
style: theme.textTheme.bodyLarge,
),
SizedBox(height: 4.v),
],
),
),
),
);
}
/// Section Widget
Widget _buildProgressIndicatorSection(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(
horizontal: 4.h,
vertical: 3.v,
),
decoration: AppDecoration.outlinePrimary.copyWith(
borderRadius: BorderRadiusStyle.circleBorder8,
),
child: Container(
height: 8.v,
width: 259.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(
4.h,
),
border: Border.all(
color: theme.colorScheme.primary,
width: 1.h,
),
),
),
);
}
/// Section Widget
Widget _buildNinetyThreeSection(BuildContext context) {
return Column(
children: [
Text(
"msg4".tr,
style: CustomTextStyles.titleMediumSegoeUI,
),
SizedBox(height: 2.v),
BlocSelector<FavoriteSportsBloc, FavoriteSportsState,
TextEditingController?>(
selector: (state) => state.enterinformationController,
builder: (context, enterinformationController) {
return CustomTextFormField(
controller: enterinformationController,
hintText: "msg5".tr,
textInputAction: TextInputAction.done,
maxLines: 8,
);
},
),
],
);
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [favorite_sports_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class FavoriteSportsModel extends Equatable {
FavoriteSportsModel() {}
FavoriteSportsModel copyWith() {
return FavoriteSportsModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,18 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/gender_screen/models/gender_model.dart';
part 'gender_event.dart';
part 'gender_state.dart';
/// A bloc that manages the state of a Gender according to the event that is dispatched to it.
class GenderBloc extends Bloc<GenderEvent, GenderState> {
GenderBloc(GenderState initialState) : super(initialState) {
on<GenderInitialEvent>(_onInitialize);
}
_onInitialize(
GenderInitialEvent event,
Emitter<GenderState> emit,
) async {}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'gender_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Gender widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class GenderEvent extends Equatable {}
/// Event that is dispatched when the Gender widget is first created.
class GenderInitialEvent extends GenderEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,20 @@
// ignore_for_file: must_be_immutable
part of 'gender_bloc.dart';
/// Represents the state of Gender in the application.
class GenderState extends Equatable {
GenderState({this.genderModelObj});
GenderModel? genderModelObj;
@override
List<Object?> get props => [
genderModelObj,
];
GenderState copyWith({GenderModel? genderModelObj}) {
return GenderState(
genderModelObj: genderModelObj ?? this.genderModelObj,
);
}
}

View File

@@ -0,0 +1,84 @@
import 'bloc/gender_bloc.dart';
import 'models/gender_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
class GenderScreen extends StatelessWidget {
const GenderScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<GenderBloc>(
create: (context) =>
GenderBloc(GenderState(genderModelObj: GenderModel()))
..add(GenderInitialEvent()),
child: GenderScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<GenderBloc, GenderState>(builder: (context, state) {
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding:
EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
_buildProgressIndicator(context),
SizedBox(height: 36.v),
Text("lbl13".tr, style: theme.textTheme.headlineSmall),
Spacer(flex: 33),
Text(""),
SizedBox(height: 20.v),
Text(""),
Spacer(flex: 66),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
});
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicator(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
decoration: AppDecoration.outlinePrimary
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Container(
height: 8.v,
width: 40.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(4.h),
border:
Border.all(color: theme.colorScheme.primary, width: 1.h))));
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [gender_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class GenderModel extends Equatable {
GenderModel() {}
GenderModel copyWith() {
return GenderModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,52 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/language_select_screen/models/language_select_model.dart';
part 'language_select_event.dart';
part 'language_select_state.dart';
/// A bloc that manages the state of a LanguageSelect according to the event that is dispatched to it.
class LanguageSelectBloc
extends Bloc<LanguageSelectEvent, LanguageSelectState> {
LanguageSelectBloc(LanguageSelectState initialState) : super(initialState) {
on<LanguageSelectInitialEvent>(_onInitialize);
on<ChangeDropDownEvent>(_changeDropDown);
}
_onInitialize(
LanguageSelectInitialEvent event,
Emitter<LanguageSelectState> emit,
) async {
emit(state.copyWith(
languageSelectModelObj: state.languageSelectModelObj?.copyWith(
dropdownItemList: fillDropdownItemList(),
)));
}
_changeDropDown(
ChangeDropDownEvent event,
Emitter<LanguageSelectState> emit,
) {
emit(state.copyWith(
selectedDropDownValue: event.value,
));
}
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(
id: 1,
title: "Item One",
isSelected: true,
),
SelectionPopupModel(
id: 2,
title: "Item Two",
),
SelectionPopupModel(
id: 3,
title: "Item Three",
)
];
}
}

View File

@@ -0,0 +1,28 @@
// ignore_for_file: must_be_immutable
part of 'language_select_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///LanguageSelect widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class LanguageSelectEvent extends Equatable {}
/// Event that is dispatched when the LanguageSelect widget is first created.
class LanguageSelectInitialEvent extends LanguageSelectEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeDropDownEvent extends LanguageSelectEvent {
ChangeDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -0,0 +1,32 @@
// ignore_for_file: must_be_immutable
part of 'language_select_bloc.dart';
/// Represents the state of LanguageSelect in the application.
class LanguageSelectState extends Equatable {
LanguageSelectState({
this.selectedDropDownValue,
this.languageSelectModelObj,
});
SelectionPopupModel? selectedDropDownValue;
LanguageSelectModel? languageSelectModelObj;
@override
List<Object?> get props => [
selectedDropDownValue,
languageSelectModelObj,
];
LanguageSelectState copyWith({
SelectionPopupModel? selectedDropDownValue,
LanguageSelectModel? languageSelectModelObj,
}) {
return LanguageSelectState(
selectedDropDownValue:
selectedDropDownValue ?? this.selectedDropDownValue,
languageSelectModelObj:
languageSelectModelObj ?? this.languageSelectModelObj,
);
}
}

View File

@@ -0,0 +1,142 @@
import 'bloc/language_select_bloc.dart';
import 'models/language_select_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
class LanguageSelectScreen extends StatelessWidget {
const LanguageSelectScreen({Key? key})
: super(
key: key,
);
static Widget builder(BuildContext context) {
return BlocProvider<LanguageSelectBloc>(
create: (context) => LanguageSelectBloc(LanguageSelectState(
languageSelectModelObj: LanguageSelectModel(),
))
..add(LanguageSelectInitialEvent()),
child: LanguageSelectScreen(),
);
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: 16.h,
vertical: 5.v,
),
child: Column(
children: [
CustomImageView(
imagePath: ImageConstant.imgLogoEatvio,
height: 50.adaptSize,
width: 50.adaptSize,
),
SizedBox(height: 20.v),
_buildProgressIndicatorSection(context),
SizedBox(height: 20.v),
Container(
width: 262.h,
margin: EdgeInsets.only(
left: 41.h,
right: 39.h,
),
child: Text(
"msg17".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: theme.textTheme.headlineSmall,
),
),
Spacer(
flex: 36,
),
BlocSelector<LanguageSelectBloc, LanguageSelectState,
LanguageSelectModel?>(
selector: (state) => state.languageSelectModelObj,
builder: (context, languageSelectModelObj) {
return CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
1.h,
),
),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize,
),
),
hintText: "lbl_english".tr,
items: languageSelectModelObj?.dropdownItemList ?? [],
onChanged: (value) {
context
.read<LanguageSelectBloc>()
.add(ChangeDropDownEvent(value: value));
},
);
},
),
Spacer(
flex: 63,
),
],
),
),
bottomNavigationBar: _buildContinueButtonSection(context),
),
);
}
/// Section Widget
Widget _buildProgressIndicatorSection(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(
horizontal: 4.h,
vertical: 3.v,
),
decoration: AppDecoration.outlinePrimary.copyWith(
borderRadius: BorderRadiusStyle.circleBorder8,
),
child: Container(
height: 8.v,
width: 20.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(
4.h,
),
border: Border.all(
color: theme.colorScheme.primary,
width: 1.h,
),
),
),
);
}
/// Section Widget
Widget _buildContinueButtonSection(BuildContext context) {
return CustomOutlinedButton(
text: "lbl2".tr.toUpperCase(),
margin: EdgeInsets.only(
left: 16.h,
right: 16.h,
bottom: 50.v,
),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
);
}
}

View File

@@ -0,0 +1,21 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
/// This class defines the variables used in the [language_select_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class LanguageSelectModel extends Equatable {
LanguageSelectModel({this.dropdownItemList = const []}) {}
List<SelectionPopupModel> dropdownItemList;
LanguageSelectModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
return LanguageSelectModel(
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
);
}
@override
List<Object?> get props => [dropdownItemList];
}

View File

@@ -0,0 +1,21 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/medicine_intake_screen/models/medicine_intake_model.dart';
part 'medicine_intake_event.dart';
part 'medicine_intake_state.dart';
/// A bloc that manages the state of a MedicineIntake according to the event that is dispatched to it.
class MedicineIntakeBloc
extends Bloc<MedicineIntakeEvent, MedicineIntakeState> {
MedicineIntakeBloc(MedicineIntakeState initialState) : super(initialState) {
on<MedicineIntakeInitialEvent>(_onInitialize);
}
_onInitialize(
MedicineIntakeInitialEvent event,
Emitter<MedicineIntakeState> emit,
) async {
emit(state.copyWith(enterInformationController: TextEditingController()));
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'medicine_intake_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///MedicineIntake widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class MedicineIntakeEvent extends Equatable {}
/// Event that is dispatched when the MedicineIntake widget is first created.
class MedicineIntakeInitialEvent extends MedicineIntakeEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,32 @@
// ignore_for_file: must_be_immutable
part of 'medicine_intake_bloc.dart';
/// Represents the state of MedicineIntake in the application.
class MedicineIntakeState extends Equatable {
MedicineIntakeState({
this.enterInformationController,
this.medicineIntakeModelObj,
});
TextEditingController? enterInformationController;
MedicineIntakeModel? medicineIntakeModelObj;
@override
List<Object?> get props => [
enterInformationController,
medicineIntakeModelObj,
];
MedicineIntakeState copyWith({
TextEditingController? enterInformationController,
MedicineIntakeModel? medicineIntakeModelObj,
}) {
return MedicineIntakeState(
enterInformationController:
enterInformationController ?? this.enterInformationController,
medicineIntakeModelObj:
medicineIntakeModelObj ?? this.medicineIntakeModelObj,
);
}
}

View File

@@ -0,0 +1,103 @@
import 'bloc/medicine_intake_bloc.dart';
import 'models/medicine_intake_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class MedicineIntakeScreen extends StatelessWidget {
const MedicineIntakeScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<MedicineIntakeBloc>(
create: (context) => MedicineIntakeBloc(
MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel()))
..add(MedicineIntakeInitialEvent()),
child: MedicineIntakeScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.47,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
SizedBox(height: 20.v),
Container(
width: 271.h,
margin: EdgeInsets.only(left: 35.h, right: 36.h),
child: Text("msg6".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: CustomTextStyles.headlineSmallMulish)),
SizedBox(height: 86.v),
_buildNinetyThree(context),
Spacer(),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildNinetyThree(BuildContext context) {
return Column(children: [
Text("msg4".tr, style: CustomTextStyles.titleMediumSegoeUI),
SizedBox(height: 2.v),
BlocSelector<MedicineIntakeBloc, MedicineIntakeState,
TextEditingController?>(
selector: (state) => state.enterInformationController,
builder: (context, enterInformationController) {
return CustomTextFormField(
controller: enterInformationController,
hintText: "msg5".tr,
textInputAction: TextInputAction.done,
maxLines: 8);
})
]);
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [medicine_intake_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class MedicineIntakeModel extends Equatable {
MedicineIntakeModel() {}
MedicineIntakeModel copyWith() {
return MedicineIntakeModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,20 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/schedule_screen/models/schedule_model.dart';
part 'schedule_event.dart';
part 'schedule_state.dart';
/// A bloc that manages the state of a Schedule according to the event that is dispatched to it.
class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
ScheduleBloc(ScheduleState initialState) : super(initialState) {
on<ScheduleInitialEvent>(_onInitialize);
}
_onInitialize(
ScheduleInitialEvent event,
Emitter<ScheduleState> emit,
) async {
emit(state.copyWith(inputPlaceholderController: TextEditingController()));
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'schedule_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Schedule widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class ScheduleEvent extends Equatable {}
/// Event that is dispatched when the Schedule widget is first created.
class ScheduleInitialEvent extends ScheduleEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,31 @@
// ignore_for_file: must_be_immutable
part of 'schedule_bloc.dart';
/// Represents the state of Schedule in the application.
class ScheduleState extends Equatable {
ScheduleState({
this.inputPlaceholderController,
this.scheduleModelObj,
});
TextEditingController? inputPlaceholderController;
ScheduleModel? scheduleModelObj;
@override
List<Object?> get props => [
inputPlaceholderController,
scheduleModelObj,
];
ScheduleState copyWith({
TextEditingController? inputPlaceholderController,
ScheduleModel? scheduleModelObj,
}) {
return ScheduleState(
inputPlaceholderController:
inputPlaceholderController ?? this.inputPlaceholderController,
scheduleModelObj: scheduleModelObj ?? this.scheduleModelObj,
);
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [schedule_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class ScheduleModel extends Equatable {
ScheduleModel() {}
ScheduleModel copyWith() {
return ScheduleModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,105 @@
import 'bloc/schedule_bloc.dart';
import 'models/schedule_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
class ScheduleScreen extends StatelessWidget {
const ScheduleScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<ScheduleBloc>(
create: (context) =>
ScheduleBloc(ScheduleState(scheduleModelObj: ScheduleModel()))
..add(ScheduleInitialEvent()),
child: ScheduleScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
_buildProgressIndicator(context),
SizedBox(height: 38.v),
Text("lbl16".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 67.v),
_buildNinetyThree(context),
Spacer(),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 31.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildProgressIndicator(BuildContext context) {
return Container(
width: 343.h,
padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v),
decoration: AppDecoration.outlinePrimary
.copyWith(borderRadius: BorderRadiusStyle.circleBorder8),
child: Container(
height: 8.v,
width: 297.h,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(4.h),
border:
Border.all(color: theme.colorScheme.primary, width: 1.h))));
}
/// Section Widget
Widget _buildNinetyThree(BuildContext context) {
return Column(children: [
Container(
width: 324.h,
margin: EdgeInsets.symmetric(horizontal: 9.h),
child: Text("msg14".tr,
maxLines: 3,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: CustomTextStyles.titleMediumSegoeUI)),
SizedBox(height: 12.v),
BlocSelector<ScheduleBloc, ScheduleState, TextEditingController?>(
selector: (state) => state.inputPlaceholderController,
builder: (context, inputPlaceholderController) {
return CustomTextFormField(
controller: inputPlaceholderController,
hintText: "msg5".tr,
textInputAction: TextInputAction.done,
maxLines: 8);
})
]);
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,24 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/splash_screen/models/splash_model.dart';
part 'splash_event.dart';
part 'splash_state.dart';
/// A bloc that manages the state of a Splash according to the event that is dispatched to it.
class SplashBloc extends Bloc<SplashEvent, SplashState> {
SplashBloc(SplashState initialState) : super(initialState) {
on<SplashInitialEvent>(_onInitialize);
}
_onInitialize(
SplashInitialEvent event,
Emitter<SplashState> emit,
) async {
Future.delayed(const Duration(milliseconds: 3000), () {
NavigatorService.popAndPushNamed(
AppRoutes.languageSelectScreen,
);
});
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
part of 'splash_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Splash widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class SplashEvent extends Equatable {}
/// Event that is dispatched when the Splash widget is first created.
class SplashInitialEvent extends SplashEvent {
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,20 @@
// ignore_for_file: must_be_immutable
part of 'splash_bloc.dart';
/// Represents the state of Splash in the application.
class SplashState extends Equatable {
SplashState({this.splashModelObj});
SplashModel? splashModelObj;
@override
List<Object?> get props => [
splashModelObj,
];
SplashState copyWith({SplashModel? splashModelObj}) {
return SplashState(
splashModelObj: splashModelObj ?? this.splashModelObj,
);
}
}

View File

@@ -0,0 +1,16 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
/// This class defines the variables used in the [splash_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class SplashModel extends Equatable {
SplashModel() {}
SplashModel copyWith() {
return SplashModel();
}
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,36 @@
import 'bloc/splash_bloc.dart';
import 'models/splash_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
class SplashScreen extends StatelessWidget {
const SplashScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<SplashBloc>(
create: (context) =>
SplashBloc(SplashState(splashModelObj: SplashModel()))
..add(SplashInitialEvent()),
child: SplashScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return BlocBuilder<SplashBloc, SplashState>(builder: (context, state) {
return SafeArea(
child: Scaffold(
body: SizedBox(
width: double.maxFinite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 16.v),
CustomImageView(
imagePath: ImageConstant.img2456927096976,
height: 137.adaptSize,
width: 137.adaptSize)
]))));
});
}
}

View File

@@ -0,0 +1,38 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/weight_screen/models/weight_model.dart';
part 'weight_event.dart';
part 'weight_state.dart';
/// A bloc that manages the state of a Weight according to the event that is dispatched to it.
class WeightBloc extends Bloc<WeightEvent, WeightState> {
WeightBloc(WeightState initialState) : super(initialState) {
on<WeightInitialEvent>(_onInitialize);
on<ChangeDropDownEvent>(_changeDropDown);
}
_onInitialize(
WeightInitialEvent event,
Emitter<WeightState> emit,
) async {
emit(state.copyWith(
weightModelObj: state.weightModelObj
?.copyWith(dropdownItemList: fillDropdownItemList())));
}
_changeDropDown(
ChangeDropDownEvent event,
Emitter<WeightState> emit,
) {
emit(state.copyWith(selectedDropDownValue: event.value));
}
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(id: 1, title: "Item One", isSelected: true),
SelectionPopupModel(id: 2, title: "Item Two"),
SelectionPopupModel(id: 3, title: "Item Three")
];
}
}

View File

@@ -0,0 +1,28 @@
// ignore_for_file: must_be_immutable
part of 'weight_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Weight widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class WeightEvent extends Equatable {}
/// Event that is dispatched when the Weight widget is first created.
class WeightInitialEvent extends WeightEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeDropDownEvent extends WeightEvent {
ChangeDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -0,0 +1,31 @@
// ignore_for_file: must_be_immutable
part of 'weight_bloc.dart';
/// Represents the state of Weight in the application.
class WeightState extends Equatable {
WeightState({
this.selectedDropDownValue,
this.weightModelObj,
});
SelectionPopupModel? selectedDropDownValue;
WeightModel? weightModelObj;
@override
List<Object?> get props => [
selectedDropDownValue,
weightModelObj,
];
WeightState copyWith({
SelectionPopupModel? selectedDropDownValue,
WeightModel? weightModelObj,
}) {
return WeightState(
selectedDropDownValue:
selectedDropDownValue ?? this.selectedDropDownValue,
weightModelObj: weightModelObj ?? this.weightModelObj,
);
}
}

View File

@@ -0,0 +1,21 @@
// ignore_for_file: must_be_immutable
import 'package:equatable/equatable.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
/// This class defines the variables used in the [weight_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class WeightModel extends Equatable {
WeightModel({this.dropdownItemList = const []}) {}
List<SelectionPopupModel> dropdownItemList;
WeightModel copyWith({List<SelectionPopupModel>? dropdownItemList}) {
return WeightModel(
dropdownItemList: dropdownItemList ?? this.dropdownItemList,
);
}
@override
List<Object?> get props => [dropdownItemList];
}

View File

@@ -0,0 +1,112 @@
import 'bloc/weight_bloc.dart';
import 'models/weight_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:eatvio_app/widgets/custom_outlined_button.dart';
import 'package:flutter/material.dart';
class WeightScreen extends StatelessWidget {
const WeightScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<WeightBloc>(
create: (context) =>
WeightBloc(WeightState(weightModelObj: WeightModel()))
..add(WeightInitialEvent()),
child: WeightScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return SafeArea(
child: Scaffold(
appBar: _buildAppBar(context),
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [
SizedBox(height: 7.v),
Container(
height: 16.v,
width: 343.h,
decoration: BoxDecoration(
color: theme.colorScheme.onPrimary,
borderRadius: BorderRadius.circular(8.h),
border: Border.all(
color: theme.colorScheme.primary, width: 1.h)),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.h),
child: LinearProgressIndicator(
value: 0.35,
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(
appTheme.blueA400)))),
SizedBox(height: 39.v),
_buildTwentySix(context),
Spacer(),
CustomOutlinedButton(text: "lbl2".tr.toUpperCase()),
SizedBox(height: 17.v),
Text("lbl3".tr, style: theme.textTheme.bodyLarge)
]))));
}
/// Section Widget
PreferredSizeWidget _buildAppBar(BuildContext context) {
return CustomAppBar(
leadingWidth: 29.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
onTap: () {
onTapArrowLeft(context);
}),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
}
/// Section Widget
Widget _buildTwentySixWidget(BuildContext context) {
return Column(children: [
Text("lbl12".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 4.v),
BlocSelector<WeightBloc, WeightState, WeightModel?>(
selector: (state) => state.weightModelObj,
builder: (context, weightModelObj) {
return CustomDropDown(
icon: Container(
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
decoration:
BoxDecoration(borderRadius: BorderRadius.circular(1.h)),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
height: 12.adaptSize,
width: 12.adaptSize)),
hintText: "lbl_70".tr,
items: weightModelObj?.dropdownItemList ?? [],
onChanged: (value) {
context
.read<WeightBloc>()
.add(ChangeDropDownEvent(value: value));
});
})
]);
}
/// Section Widget
Widget _buildTwentySix(BuildContext context) {
return Column(children: [
Text("lbl11".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 174.v),
_buildTwentySixWidget(context)
]);
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
NavigatorService.goBack();
}
}

View File

@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:eatvio_app/presentation/date_of_birth_screen/date_of_birth_screen.dart';
import 'package:eatvio_app/presentation/city_of_living_screen/city_of_living_screen.dart';
import 'package:eatvio_app/presentation/body_circumferences_screen/body_circumferences_screen.dart';
import 'package:eatvio_app/presentation/weight_screen/weight_screen.dart';
import 'package:eatvio_app/presentation/allergies_screen/allergies_screen.dart';
import 'package:eatvio_app/presentation/medicine_intake_screen/medicine_intake_screen.dart';
import 'package:eatvio_app/presentation/splash_screen/splash_screen.dart';
import 'package:eatvio_app/presentation/gender_screen/gender_screen.dart';
import 'package:eatvio_app/presentation/blood_pressure_screen/blood_pressure_screen.dart';
import 'package:eatvio_app/presentation/favorite_sports_screen/favorite_sports_screen.dart';
import 'package:eatvio_app/presentation/favorite_foods_screen/favorite_foods_screen.dart';
import 'package:eatvio_app/presentation/schedule_screen/schedule_screen.dart';
import 'package:eatvio_app/presentation/additional_information_screen/additional_information_screen.dart';
import 'package:eatvio_app/presentation/language_select_screen/language_select_screen.dart';
import 'package:eatvio_app/presentation/app_navigation_screen/app_navigation_screen.dart';
class AppRoutes {
static const String dateOfBirthScreen = '/date_of_birth_screen';
static const String cityOfLivingScreen = '/city_of_living_screen';
static const String bodyCircumferencesScreen = '/body_circumferences_screen';
static const String weightScreen = '/weight_screen';
static const String allergiesScreen = '/allergies_screen';
static const String medicineIntakeScreen = '/medicine_intake_screen';
static const String splashScreen = '/splash_screen';
static const String genderScreen = '/gender_screen';
static const String bloodPressureScreen = '/blood_pressure_screen';
static const String favoriteSportsScreen = '/favorite_sports_screen';
static const String favoriteFoodsScreen = '/favorite_foods_screen';
static const String scheduleScreen = '/schedule_screen';
static const String additionalInformationScreen =
'/additional_information_screen';
static const String languageSelectScreen = '/language_select_screen';
static const String appNavigationScreen = '/app_navigation_screen';
static const String initialRoute = '/initialRoute';
static Map<String, WidgetBuilder> get routes => {
dateOfBirthScreen: DateOfBirthScreen.builder,
cityOfLivingScreen: CityOfLivingScreen.builder,
bodyCircumferencesScreen: BodyCircumferencesScreen.builder,
weightScreen: WeightScreen.builder,
allergiesScreen: AllergiesScreen.builder,
medicineIntakeScreen: MedicineIntakeScreen.builder,
splashScreen: SplashScreen.builder,
genderScreen: GenderScreen.builder,
bloodPressureScreen: BloodPressureScreen.builder,
favoriteSportsScreen: FavoriteSportsScreen.builder,
favoriteFoodsScreen: FavoriteFoodsScreen.builder,
scheduleScreen: ScheduleScreen.builder,
additionalInformationScreen: AdditionalInformationScreen.builder,
languageSelectScreen: LanguageSelectScreen.builder,
appNavigationScreen: AppNavigationScreen.builder,
initialRoute: SplashScreen.builder
};
}

View File

@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:eatvio_app/core/app_export.dart';
class AppDecoration {
// Fill decorations
static BoxDecoration get fillOnPrimary => BoxDecoration(
color: theme.colorScheme.onPrimary,
);
// Outline decorations
static BoxDecoration get outlineBlueA => BoxDecoration(
color: theme.colorScheme.onPrimary,
border: Border.all(
color: appTheme.blueA400,
width: 1.h,
),
);
static BoxDecoration get outlinePrimary => BoxDecoration(
color: theme.colorScheme.onPrimary,
border: Border.all(
color: theme.colorScheme.primary,
width: 1.h,
),
);
}
class BorderRadiusStyle {
// Circle borders
static BorderRadius get circleBorder8 => BorderRadius.circular(
8.h,
);
// Rounded borders
static BorderRadius get roundedBorder1 => BorderRadius.circular(
1.h,
);
}
// Comment/Uncomment the below code based on your Flutter SDK version.
// For Flutter SDK Version 3.7.2 or greater.
double get strokeAlignInside => BorderSide.strokeAlignInside;
double get strokeAlignCenter => BorderSide.strokeAlignCenter;
double get strokeAlignOutside => BorderSide.strokeAlignOutside;
// For Flutter SDK Version 3.7.1 or less.
// StrokeAlign get strokeAlignInside => StrokeAlign.inside;
//
// StrokeAlign get strokeAlignCenter => StrokeAlign.center;
//
// StrokeAlign get strokeAlignOutside => StrokeAlign.outside;

View File

@@ -0,0 +1,18 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '../../core/app_export.dart';
part 'theme_event.dart';
part 'theme_state.dart';
class ThemeBloc extends Bloc<ThemeEvent, ThemeState> {
ThemeBloc(ThemeState initialState) : super(initialState) {
on<ThemeChangeEvent>(_changeTheme);
}
_changeTheme(
ThemeChangeEvent event,
Emitter<ThemeState> emit,
) async {
emit(state.copyWith(themeType: event.themeType));
}
}

View File

@@ -0,0 +1,15 @@
part of 'theme_bloc.dart';
@immutable
abstract class ThemeEvent extends Equatable {}
class ThemeChangeEvent extends ThemeEvent {
ThemeChangeEvent({required this.themeType}) : super() {
PrefUtils().setThemeData(themeType);
}
final String themeType;
@override
List<Object?> get props => [];
}

View File

@@ -0,0 +1,14 @@
part of 'theme_bloc.dart';
@immutable
class ThemeState extends Equatable {
ThemeState({required this.themeType});
final String themeType;
@override
List<Object?> get props => [themeType];
ThemeState copyWith({String? themeType}) {
return ThemeState(themeType: themeType ?? this.themeType);
}
}

View File

@@ -0,0 +1,23 @@
import 'dart:ui';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
/// A class that offers pre-defined button styles for customizing button appearance.
class CustomButtonStyles {
// Outline button style
static ButtonStyle get outlinePrimaryTL15 => OutlinedButton.styleFrom(
backgroundColor: appTheme.blueA400,
side: BorderSide(
color: theme.colorScheme.primary,
width: 1,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.h),
),
);
// text button style
static ButtonStyle get none => ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.transparent),
elevation: MaterialStateProperty.all<double>(0),
);
}

View File

@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import '../core/app_export.dart';
/// A collection of pre-defined text styles for customizing text appearance,
/// categorized by different font families and weights.
/// Additionally, this class includes extensions on [TextStyle] to easily apply specific font families to text.
class CustomTextStyles {
// Headline style
static get headlineSmallMulish => theme.textTheme.headlineSmall!.mulish;
// Title text style
static get titleMediumSegoeUI =>
theme.textTheme.titleMedium!.segoeUI.copyWith(
fontWeight: FontWeight.w600,
);
}
extension on TextStyle {
TextStyle get mulish {
return copyWith(
fontFamily: 'Mulish',
);
}
TextStyle get segoeUI {
return copyWith(
fontFamily: 'Segoe UI',
);
}
}

128
lib/theme/theme_helper.dart Normal file
View File

@@ -0,0 +1,128 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import '../../core/app_export.dart';
/// Helper class for managing themes and colors.
class ThemeHelper {
// The current app theme
var _appTheme = PrefUtils().getThemeData();
// A map of custom color themes supported by the app
Map<String, PrimaryColors> _supportedCustomColor = {
'primary': PrimaryColors()
};
// A map of color schemes supported by the app
Map<String, ColorScheme> _supportedColorScheme = {
'primary': ColorSchemes.primaryColorScheme
};
/// Returns the primary colors for the current theme.
PrimaryColors _getThemeColors() {
//throw exception to notify given theme is not found or not generated by the generator
if (!_supportedCustomColor.containsKey(_appTheme)) {
throw Exception(
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner");
}
//return theme from map
return _supportedCustomColor[_appTheme] ?? PrimaryColors();
}
/// Returns the current theme data.
ThemeData _getThemeData() {
//throw exception to notify given theme is not found or not generated by the generator
if (!_supportedColorScheme.containsKey(_appTheme)) {
throw Exception(
"$_appTheme is not found.Make sure you have added this theme class in JSON Try running flutter pub run build_runner");
}
//return theme from map
var colorScheme =
_supportedColorScheme[_appTheme] ?? ColorSchemes.primaryColorScheme;
return ThemeData(
visualDensity: VisualDensity.standard,
colorScheme: colorScheme,
textTheme: TextThemes.textTheme(colorScheme),
scaffoldBackgroundColor: colorScheme.onPrimary,
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
backgroundColor: Colors.transparent,
side: BorderSide(
color: colorScheme.primary,
width: 1.h,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.h),
),
visualDensity: const VisualDensity(
vertical: -4,
horizontal: -4,
),
padding: EdgeInsets.zero,
),
),
);
}
/// Returns the primary colors for the current theme.
PrimaryColors themeColor() => _getThemeColors();
/// Returns the current theme data.
ThemeData themeData() => _getThemeData();
}
/// Class containing the supported text theme styles.
class TextThemes {
static TextTheme textTheme(ColorScheme colorScheme) => TextTheme(
bodyLarge: TextStyle(
color: appTheme.blueGray400,
fontSize: 18.fSize,
fontFamily: 'Mulish',
fontWeight: FontWeight.w400,
),
headlineSmall: TextStyle(
color: colorScheme.primary,
fontSize: 24.fSize,
fontFamily: 'Segoe UI',
fontWeight: FontWeight.w600,
),
titleMedium: TextStyle(
color: colorScheme.primary,
fontSize: 18.fSize,
fontFamily: 'Mulish',
fontWeight: FontWeight.w700,
),
titleSmall: TextStyle(
color: colorScheme.onPrimary,
fontSize: 15.fSize,
fontFamily: 'Mulish',
fontWeight: FontWeight.w700,
),
);
}
/// Class containing the supported color schemes.
class ColorSchemes {
static final primaryColorScheme = ColorScheme.light(
// Primary colors
primary: Color(0XFF323F4B),
// On colors(text colors)
onPrimary: Color(0XFFFFFFFF),
onPrimaryContainer: Color(0XFF0B3F56),
);
}
/// Class containing custom colors for a primary theme.
class PrimaryColors {
// Blue
Color get blue400 => Color(0XFF43A6F2);
Color get blueA400 => Color(0XFF2F80ED);
// BlueGray
Color get blueGray400 => Color(0XFF7B8794);
}
PrimaryColors get appTheme => ThemeHelper().themeColor();
ThemeData get theme => ThemeHelper().themeData();

Some files were not shown because too many files have changed in this diff Show More