initTheme method
void
initTheme({
- ThemeData? lightTheme,
- ThemeData? darkTheme,
- double? altoCampos,
- EdgeInsets? paddingInput,
- double? bordeRadius,
- double? sizeTituloTextfield,
- double? sizeDescripcionTextfield,
- Color? colorTitulosCajasDeTexto,
- Color? cdmBlanco,
- Color? cdmAzul,
- Color? cdmRojo,
- Color colorPrimario = const Color.fromARGB(255, 255, 60, 50),
Implementation
void initTheme(
{ThemeData? lightTheme,
ThemeData? darkTheme,
double? altoCampos,
EdgeInsets? paddingInput,
double? bordeRadius,
double? sizeTituloTextfield,
double? sizeDescripcionTextfield,
Color? colorTitulosCajasDeTexto,
Color? cdmBlanco,
Color? cdmAzul,
Color? cdmRojo,
Color colorPrimario = const Color.fromARGB(255, 255, 60, 50)}) {
if (init ?? false) {
return;
}
init = true;
this.bordeRadius = bordeRadius ?? 10;
this.altoCampos = altoCampos ?? 40;
this.sizeDescripcionTextfield = sizeDescripcionTextfield ?? 14;
this.colorTitulosCajasDeTexto = colorTitulosCajasDeTexto ?? colorPrimario;
this.sizeTituloTextfield = sizeTituloTextfield ?? 17;
this.paddingInput =
paddingInput ?? const EdgeInsets.symmetric(horizontal: 5);
TextStyle style = GoogleFonts.notoSans();
this.colorPrimario = colorPrimario;
this.lightTheme = lightTheme ??
FlexThemeData.light(
scheme: scheme,
// colorScheme: ColorScheme.light(
// // secondaryContainer: Colors.white,
// tertiaryContainer: colorVerde,
// ),
scaffoldBackground: Colors.white, //colorFondoMarron,
surfaceMode: FlexSurfaceMode.levelSurfacesLowScaffold,
blendLevel: 9,
tooltipsMatchBackground: true,
appBarStyle: FlexAppBarStyle.scaffoldBackground,
// scaffoldBackground: const Color.fromARGB(255, 243, 245, 247),
subThemesData: FlexSubThemesData(
interactionEffects: true,
tintedDisabledControls: true,
useM2StyleDividerInM3: true,
inputDecoratorIsFilled: true,
inputDecoratorBorderType: FlexInputBorderType.outline,
alignedDropdown: true,
navigationRailUseIndicator: true,
navigationRailLabelType: NavigationRailLabelType.all,
defaultRadius: bordeRadius,
filledButtonRadius: 40,
inputDecoratorFillColor: Colors.white,
),
///Color para las tarjetas de los dialogos
surfaceTint: Colors.white,
textTheme: TextTheme(
bodySmall:
style.copyWith(fontSize: defaultTextSmall, color: colorMarron),
///Esto usan los botones
bodyMedium:
style.copyWith(fontSize: defaultTextMedium, color: colorMarron),
bodyLarge: style.copyWith(fontSize: defaultTextLarge),
///fuente para titulos
titleSmall: style.copyWith(
fontSize: defaultTextTitleSmall,
fontWeight: FontWeight.w500,
color: colorMarron),
titleMedium: style.copyWith(
fontSize: defaultTextTitleMedium,
fontWeight: FontWeight.w500,
),
titleLarge: style.copyWith(
fontSize: defaultTextTitleLarge, color: Color(0xFF11131D)),
///Contenido con un tamaño mayor que el titulo
headlineSmall: style.copyWith(
fontSize: defaultTextHeadlineSmall, color: Color(0xFF11131D)),
headlineMedium: style.copyWith(
fontSize: defaultTextHeadlineMedium, color: Color(0xFF11131D)),
headlineLarge: style.copyWith(
fontSize: defaultTextHeadlineLarge, color: Color(0xFF11131D)),
),
tones: FlexTones.vivid(Brightness.light),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
cupertinoOverrideTheme:
const CupertinoThemeData(applyThemeToAll: true),
useMaterial3: true,
fontFamily: GoogleFonts.robotoFlex().fontFamily,
swapLegacyOnMaterial3: true,
).copyWith(
// iconTheme: IconThemeData(color: colorAzul),
dividerTheme:
const DividerThemeData(thickness: 0.3, color: Colors.grey));
this.darkTheme = darkTheme ??
FlexThemeData.dark(
// colorScheme: const ColorScheme.dark(
// secondaryContainer: Color(0xff23241f),
// tertiaryContainer: Colors.white70,
// ),
scheme: scheme,
surfaceMode: FlexSurfaceMode.levelSurfacesLowScaffold,
blendLevel: 15,
tooltipsMatchBackground: true,
appBarStyle: FlexAppBarStyle.scaffoldBackground,
// scaffoldBackground: const Color(0xff23241f),
subThemesData: FlexSubThemesData(
defaultRadius: bordeRadius, interactionEffects: false,
elevatedButtonRadius: bordeRadius,
inputDecoratorIsFilled: false,
switchThumbFixedSize: true,
filledButtonRadius: 40,
buttonPadding:
const EdgeInsets.symmetric(horizontal: 15, vertical: 7),
// tooltipRadius: bordeRadius,
// textButtonTextStyle: WidgetStatePropertyAll(
// GoogleFonts.workSans().copyWith(color: colorAzul)),
// inputDecoratorRadius: bordeRadius,
inputDecoratorBorderType: FlexInputBorderType.outline,
inputDecoratorBorderWidth: 0.4,
inputDecoratorFocusedBorderWidth: 1.2,
outlinedButtonBorderWidth: 0.2,
// appBarBackgroundSchemeColor: SchemeColor.primary,
),
textTheme: TextTheme(
bodySmall:
style.copyWith(fontSize: defaultTextSmall, color: Colors.white),
///Esto usan los botones
bodyMedium: style.copyWith(
fontSize: defaultTextMedium, color: Colors.white),
bodyLarge:
style.copyWith(fontSize: defaultTextLarge, color: Colors.white),
///fuente para titulos
titleSmall: style.copyWith(
fontSize: defaultTextTitleSmall,
fontWeight: FontWeight.w500,
color: Colors.white),
titleMedium: style.copyWith(
fontSize: defaultTextTitleMedium,
fontWeight: FontWeight.bold,
color: Colors.white),
titleLarge: style.copyWith(
fontSize: defaultTextTitleLarge, color: Colors.white),
///Contenido con un tamaño mayor que el titulo
headlineSmall: style.copyWith(
fontSize: defaultTextHeadlineSmall, color: Colors.white),
headlineMedium: style.copyWith(
fontSize: defaultTextHeadlineMedium, color: Colors.white),
headlineLarge: style.copyWith(
fontSize: defaultTextHeadlineLarge, color: Colors.white),
),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
useMaterial3: true,
fontFamily: style.fontFamily,
swapLegacyOnMaterial3: true,
).copyWith(
dividerTheme:
const DividerThemeData(thickness: 0.3, color: Colors.grey));
}