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

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();