Refactor button color references to use 'primary' instead of 'buttonColor' across multiple files
- Updated AttendanceButtonHelper to rename getButtonColor to getprimary. - Changed button color references in AttendanceActionButton, ReusableListCard, UserDocumentFilterBottomSheet, and various auth screens to use contentTheme.primary. - Adjusted color references in employee detail, expense, and directory views to align with the new primary color scheme. - Removed unused ThemeOption class in UserProfileBar and updated color references accordingly. - Ensured consistency in color usage for buttons and icons throughout the application.
This commit is contained in:
parent
04da062f4f
commit
7007a86ac7
@ -2,38 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
||||
|
||||
enum LeftBarThemeType { light, dark }
|
||||
|
||||
enum ContentThemeType { light, dark }
|
||||
|
||||
enum RightBarThemeType { light, dark }
|
||||
|
||||
enum ContentThemeColor {
|
||||
primary,
|
||||
secondary,
|
||||
success,
|
||||
info,
|
||||
warning,
|
||||
danger,
|
||||
light,
|
||||
dark,
|
||||
pink,
|
||||
red,
|
||||
brand,
|
||||
button;
|
||||
|
||||
Color get color {
|
||||
return (AdminTheme.theme.contentTheme.getMappedIntoThemeColor[this]
|
||||
?['color']) ??
|
||||
Colors.black;
|
||||
}
|
||||
|
||||
Color get onColor {
|
||||
return (AdminTheme.theme.contentTheme.getMappedIntoThemeColor[this]
|
||||
?['onColor']) ??
|
||||
Colors.white;
|
||||
}
|
||||
}
|
||||
|
||||
class LeftBarTheme {
|
||||
final Color background, onBackground;
|
||||
final Color labelColor;
|
||||
@ -54,7 +25,8 @@ class LeftBarTheme {
|
||||
onBackground: const Color(0xffdcdcdc),
|
||||
labelColor: const Color(0xff32BFAE),
|
||||
activeItemBackground: const Color(0x1532BFAE),
|
||||
activeItemColor: const Color(0xff32BFAE));
|
||||
activeItemColor: const Color(0xff32BFAE),
|
||||
);
|
||||
|
||||
static LeftBarTheme getThemeFromType(LeftBarThemeType leftBarThemeType) {
|
||||
switch (leftBarThemeType) {
|
||||
@ -79,7 +51,8 @@ class TopBarTheme {
|
||||
|
||||
static final TopBarTheme darkTopBarTheme = TopBarTheme(
|
||||
background: const Color(0xff2c3036),
|
||||
onBackground: const Color(0xffdcdcdc));
|
||||
onBackground: const Color(0xffdcdcdc),
|
||||
);
|
||||
}
|
||||
|
||||
class RightBarTheme {
|
||||
@ -97,13 +70,37 @@ class RightBarTheme {
|
||||
disabled: const Color(0xffffffff),
|
||||
onDisabled: const Color(0xffdee2e6),
|
||||
activeSwitchBorderColor: const Color(0xff727cf5),
|
||||
inactiveSwitchBorderColor: const Color(0xffdee2e6));
|
||||
inactiveSwitchBorderColor: const Color(0xffdee2e6),
|
||||
);
|
||||
|
||||
static final RightBarTheme darkRightBarTheme = RightBarTheme(
|
||||
disabled: const Color(0xff444d57),
|
||||
activeSwitchBorderColor: const Color(0xff727cf5),
|
||||
inactiveSwitchBorderColor: const Color(0xffdee2e6),
|
||||
onDisabled: const Color(0xff515a65));
|
||||
onDisabled: const Color(0xff515a65),
|
||||
);
|
||||
}
|
||||
|
||||
enum ContentThemeColor {
|
||||
primary,
|
||||
secondary,
|
||||
success,
|
||||
info,
|
||||
warning,
|
||||
danger,
|
||||
light,
|
||||
dark,
|
||||
pink,
|
||||
green,
|
||||
red;
|
||||
|
||||
Color get color {
|
||||
return (AdminTheme.theme.contentTheme.getMappedIntoThemeColor[this]?['color']) ?? Colors.black;
|
||||
}
|
||||
|
||||
Color get onColor {
|
||||
return (AdminTheme.theme.contentTheme.getMappedIntoThemeColor[this]?['onColor']) ?? Colors.white;
|
||||
}
|
||||
}
|
||||
|
||||
class ContentTheme {
|
||||
@ -117,70 +114,39 @@ class ContentTheme {
|
||||
final Color info, onInfo;
|
||||
final Color light, onLight;
|
||||
final Color dark, onDark;
|
||||
final Color purple, onPurple;
|
||||
final Color pink, onPink;
|
||||
final Color red, onRed;
|
||||
|
||||
final Color brandColor, onBrandColor;
|
||||
final Color buttonColor, onButtonColor;
|
||||
|
||||
final Color cardBackground, cardShadow, cardBorder, cardText, cardTextMuted;
|
||||
final Color title;
|
||||
final Color disabled, onDisabled;
|
||||
|
||||
Map<ContentThemeColor, Map<String, Color>> get getMappedIntoThemeColor {
|
||||
var c = this;
|
||||
return {
|
||||
ContentThemeColor.primary: {'color': c.primary, 'onColor': c.onPrimary},
|
||||
ContentThemeColor.secondary: {
|
||||
'color': c.secondary,
|
||||
'onColor': c.onSecondary
|
||||
},
|
||||
ContentThemeColor.success: {'color': c.success, 'onColor': c.onSuccess},
|
||||
ContentThemeColor.info: {'color': c.info, 'onColor': c.onInfo},
|
||||
ContentThemeColor.warning: {'color': c.warning, 'onColor': c.onWarning},
|
||||
ContentThemeColor.danger: {'color': c.danger, 'onColor': c.onDanger},
|
||||
ContentThemeColor.light: {'color': c.light, 'onColor': c.onLight},
|
||||
ContentThemeColor.dark: {'color': c.dark, 'onColor': c.onDark},
|
||||
ContentThemeColor.pink: {'color': c.pink, 'onColor': c.onPink},
|
||||
ContentThemeColor.red: {'color': c.red, 'onColor': c.onRed},
|
||||
ContentThemeColor.brand: {
|
||||
'color': c.brandColor,
|
||||
'onColor': c.onBrandColor
|
||||
},
|
||||
ContentThemeColor.button: {
|
||||
'color': c.buttonColor,
|
||||
'onColor': c.onButtonColor
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
ContentTheme({
|
||||
this.background = const Color(0xfffafbfe),
|
||||
this.onBackground = const Color(0xff313a46),
|
||||
this.primary = const Color(0xFF49BF3C),
|
||||
this.onPrimary = Colors.white,
|
||||
this.onBackground = const Color(0xffF1F1F2),
|
||||
this.primary = const Color(0xff663399),
|
||||
this.onPrimary = const Color(0xffffffff),
|
||||
this.secondary = const Color(0xff6c757d),
|
||||
this.onSecondary = Colors.white,
|
||||
this.onSecondary = const Color(0xffffffff),
|
||||
this.success = const Color(0xff00be82),
|
||||
this.onSuccess = Colors.white,
|
||||
this.onSuccess = const Color(0xffffffff),
|
||||
this.danger = const Color(0xffdc3545),
|
||||
this.onDanger = Colors.white,
|
||||
this.onDanger = const Color(0xffffffff),
|
||||
this.warning = const Color(0xffffc107),
|
||||
this.onWarning = const Color(0xff313a46),
|
||||
this.info = const Color(0xff0dcaf0),
|
||||
this.onInfo = Colors.white,
|
||||
this.onInfo = const Color(0xffffffff),
|
||||
this.light = const Color(0xffeef2f7),
|
||||
this.onLight = const Color(0xff313a46),
|
||||
this.dark = const Color(0xff313a46),
|
||||
this.onDark = Colors.white,
|
||||
this.pink = const Color(0xffFF1087),
|
||||
this.onPink = Colors.white,
|
||||
this.red = const Color(0xffFF0000),
|
||||
this.onRed = Colors.white,
|
||||
this.brandColor = const Color(0xffff0000),
|
||||
this.onBrandColor = Colors.white,
|
||||
this.buttonColor = const Color(0xFF2196F3),
|
||||
this.onButtonColor = Colors.white,
|
||||
this.onDark = const Color(0xffffffff),
|
||||
this.purple = const Color(0xff800080),
|
||||
this.onPurple = const Color(0xffffffff),
|
||||
this.pink = const Color(0xffff1087),
|
||||
this.onPink = const Color(0xffffffff),
|
||||
this.red = const Color(0xffff0000),
|
||||
this.onRed = const Color(0xffffffff),
|
||||
this.cardBackground = const Color(0xffffffff),
|
||||
this.cardShadow = const Color(0xffffffff),
|
||||
this.cardBorder = const Color(0xffffffff),
|
||||
@ -191,55 +157,103 @@ class ContentTheme {
|
||||
this.onDisabled = const Color(0xffffffff),
|
||||
});
|
||||
|
||||
// copyWith for dynamic updates
|
||||
Map<ContentThemeColor, Map<String, Color>> get getMappedIntoThemeColor {
|
||||
return {
|
||||
ContentThemeColor.primary: {'color': primary, 'onColor': onPrimary},
|
||||
ContentThemeColor.secondary: {'color': secondary, 'onColor': onSecondary},
|
||||
ContentThemeColor.success: {'color': success, 'onColor': onSuccess},
|
||||
ContentThemeColor.info: {'color': info, 'onColor': onInfo},
|
||||
ContentThemeColor.warning: {'color': warning, 'onColor': onWarning},
|
||||
ContentThemeColor.danger: {'color': danger, 'onColor': onDanger},
|
||||
ContentThemeColor.light: {'color': light, 'onColor': onLight},
|
||||
ContentThemeColor.dark: {'color': dark, 'onColor': onDark},
|
||||
ContentThemeColor.pink: {'color': pink, 'onColor': onPink},
|
||||
ContentThemeColor.red: {'color': red, 'onColor': onRed},
|
||||
};
|
||||
}
|
||||
|
||||
ContentTheme copyWith({
|
||||
Color? primary,
|
||||
Color? brandColor,
|
||||
Color? buttonColor,
|
||||
Color? onPrimary,
|
||||
Color? secondary,
|
||||
Color? onSecondary,
|
||||
Color? background,
|
||||
Color? onBackground,
|
||||
}) {
|
||||
return ContentTheme(
|
||||
primary: primary ?? this.primary,
|
||||
brandColor: brandColor ?? this.brandColor,
|
||||
buttonColor: buttonColor ?? this.buttonColor,
|
||||
onPrimary: onPrimary ?? this.onPrimary,
|
||||
secondary: secondary ?? this.secondary,
|
||||
onSecondary: onSecondary ?? this.onSecondary,
|
||||
background: background ?? this.background,
|
||||
onBackground: onBackground ?? this.onBackground,
|
||||
success: success,
|
||||
onSuccess: onSuccess,
|
||||
danger: danger,
|
||||
onDanger: onDanger,
|
||||
warning: warning,
|
||||
onWarning: onWarning,
|
||||
info: info,
|
||||
onInfo: onInfo,
|
||||
light: light,
|
||||
onLight: onLight,
|
||||
dark: dark,
|
||||
onDark: onDark,
|
||||
purple: purple,
|
||||
onPurple: onPurple,
|
||||
pink: pink,
|
||||
onPink: onPink,
|
||||
red: red,
|
||||
onRed: onRed,
|
||||
cardBackground: cardBackground,
|
||||
cardShadow: cardShadow,
|
||||
cardBorder: cardBorder,
|
||||
cardText: cardText,
|
||||
cardTextMuted: cardTextMuted,
|
||||
title: title,
|
||||
disabled: disabled,
|
||||
onDisabled: onDisabled,
|
||||
);
|
||||
}
|
||||
|
||||
static final ContentTheme lightContentTheme = ContentTheme(
|
||||
primary: Colors.indigo,
|
||||
background: const Color(0xfffafbfe),
|
||||
onBackground: const Color(0xff313a46),
|
||||
cardBorder: const Color(0xffe8ecf1),
|
||||
cardBackground: const Color(0xffffffff),
|
||||
cardShadow: const Color(0xff9aa1ab),
|
||||
cardText: const Color(0xff6c757d),
|
||||
title: const Color(0xff6c757d),
|
||||
cardTextMuted: const Color(0xff98a6ad),
|
||||
brandColor: const Color(0xffff0000),
|
||||
onBrandColor: Colors.white,
|
||||
);
|
||||
|
||||
static final ContentTheme darkContentTheme = ContentTheme(
|
||||
primary: Colors.indigo,
|
||||
static ContentTheme withColorTheme(
|
||||
ColorThemeType colorTheme, {
|
||||
ThemeMode mode = ThemeMode.light,
|
||||
}) {
|
||||
final baseTheme = mode == ThemeMode.light
|
||||
? ContentTheme()
|
||||
: ContentTheme(
|
||||
primary: const Color(0xff32BFAE),
|
||||
background: const Color(0xff343a40),
|
||||
onBackground: const Color(0xffF1F1F2),
|
||||
disabled: const Color(0xff444d57),
|
||||
onDisabled: const Color(0xff515a65),
|
||||
cardBorder: const Color(0xff464f5b),
|
||||
cardBackground: const Color(0xff37404a),
|
||||
cardShadow: const Color(0xff01030E),
|
||||
cardText: const Color(0xffaab8c5),
|
||||
title: const Color(0xffaab8c5),
|
||||
cardTextMuted: const Color(0xff8391a2),
|
||||
brandColor: const Color(0xffff0000),
|
||||
onBrandColor: Colors.white,
|
||||
);
|
||||
|
||||
switch (colorTheme) {
|
||||
case ColorThemeType.purple:
|
||||
return baseTheme.copyWith(primary: const Color(0xff663399), onPrimary: Colors.white);
|
||||
case ColorThemeType.red:
|
||||
return baseTheme.copyWith(primary: const Color(0xffff0000), onPrimary: Colors.white);
|
||||
case ColorThemeType.green:
|
||||
return baseTheme.copyWith(primary: const Color(0xff49BF3C), onPrimary: Colors.white);
|
||||
case ColorThemeType.blue:
|
||||
return baseTheme.copyWith(primary: const Color(0xff007bff), onPrimary: Colors.white);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum ColorThemeType { purple, red, green, blue }
|
||||
|
||||
class AdminTheme {
|
||||
final ContentTheme contentTheme;
|
||||
final LeftBarTheme leftBarTheme;
|
||||
final RightBarTheme rightBarTheme;
|
||||
final TopBarTheme topBarTheme;
|
||||
final ContentTheme contentTheme;
|
||||
|
||||
AdminTheme({
|
||||
required this.leftBarTheme,
|
||||
@ -252,39 +266,18 @@ class AdminTheme {
|
||||
leftBarTheme: LeftBarTheme.lightLeftBarTheme,
|
||||
topBarTheme: TopBarTheme.lightTopBarTheme,
|
||||
rightBarTheme: RightBarTheme.lightRightBarTheme,
|
||||
contentTheme: ContentTheme.lightContentTheme);
|
||||
contentTheme: ContentTheme.withColorTheme(ColorThemeType.purple, mode: ThemeMode.light),
|
||||
);
|
||||
|
||||
static void setTheme() {
|
||||
theme = AdminTheme(
|
||||
leftBarTheme: ThemeCustomizer.instance.theme == ThemeMode.dark
|
||||
? LeftBarTheme.darkLeftBarTheme
|
||||
: LeftBarTheme.lightLeftBarTheme,
|
||||
topBarTheme: ThemeCustomizer.instance.theme == ThemeMode.dark
|
||||
? TopBarTheme.darkTopBarTheme
|
||||
: TopBarTheme.lightTopBarTheme,
|
||||
rightBarTheme: ThemeCustomizer.instance.theme == ThemeMode.dark
|
||||
? RightBarTheme.darkRightBarTheme
|
||||
: RightBarTheme.lightRightBarTheme,
|
||||
contentTheme: ThemeCustomizer.instance.theme == ThemeMode.dark
|
||||
? ContentTheme.darkContentTheme
|
||||
: ContentTheme.lightContentTheme);
|
||||
}
|
||||
final themeMode = ThemeCustomizer.instance.theme;
|
||||
final colorTheme = ThemeCustomizer.instance.colorTheme;
|
||||
|
||||
// Dynamic theme color update
|
||||
static void updateThemeColors({
|
||||
Color? primary,
|
||||
Color? brandColor,
|
||||
Color? buttonColor,
|
||||
}) {
|
||||
theme = AdminTheme(
|
||||
leftBarTheme: theme.leftBarTheme,
|
||||
topBarTheme: theme.topBarTheme,
|
||||
rightBarTheme: theme.rightBarTheme,
|
||||
contentTheme: theme.contentTheme.copyWith(
|
||||
primary: primary,
|
||||
brandColor: brandColor,
|
||||
buttonColor: buttonColor,
|
||||
),
|
||||
leftBarTheme: themeMode == ThemeMode.dark ? LeftBarTheme.darkLeftBarTheme : LeftBarTheme.lightLeftBarTheme,
|
||||
topBarTheme: themeMode == ThemeMode.dark ? TopBarTheme.darkTopBarTheme : TopBarTheme.lightTopBarTheme,
|
||||
rightBarTheme: themeMode == ThemeMode.dark ? RightBarTheme.darkRightBarTheme : RightBarTheme.lightRightBarTheme,
|
||||
contentTheme: ContentTheme.withColorTheme(colorTheme, mode: themeMode),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ class ThemeCustomizer {
|
||||
ThemeMode leftBarTheme = ThemeMode.light;
|
||||
ThemeMode rightBarTheme = ThemeMode.light;
|
||||
ThemeMode topBarTheme = ThemeMode.light;
|
||||
|
||||
ColorThemeType colorTheme = ColorThemeType.purple;
|
||||
bool rightBarOpen = false;
|
||||
bool leftBarCondensed = false;
|
||||
|
||||
@ -73,6 +73,11 @@ class ThemeCustomizer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Public method to trigger theme updates externally
|
||||
static void applyThemeChange() {
|
||||
_notify();
|
||||
}
|
||||
|
||||
static void notify() {
|
||||
for (var value in _notifier) {
|
||||
value(oldInstance, instance);
|
||||
|
||||
@ -3,32 +3,53 @@ import 'package:get/get.dart';
|
||||
import 'package:marco/helpers/widgets/my_text.dart';
|
||||
import 'package:marco/helpers/widgets/wave_background.dart';
|
||||
import 'package:marco/helpers/theme/admin_theme.dart';
|
||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
||||
|
||||
class ThemeOption {
|
||||
final String label;
|
||||
final Color primary;
|
||||
final Color button;
|
||||
final Color brand;
|
||||
final ColorThemeType colorThemeType;
|
||||
|
||||
ThemeOption(this.label, this.primary, this.button, this.brand);
|
||||
ThemeOption(
|
||||
this.label, this.primary, this.button, this.brand, this.colorThemeType);
|
||||
}
|
||||
|
||||
// Define your themes
|
||||
final List<ThemeOption> themeOptions = [
|
||||
ThemeOption("Theme 1", Colors.red, Colors.red, Colors.red),
|
||||
ThemeOption("Theme 2", const Color(0xFF49BF3C), const Color(0xFF49BF3C), const Color(0xFF49BF3C)),
|
||||
ThemeOption("Theme 3", const Color(0xFF3F51B5), const Color(0xFF3F51B5), const Color(0xFF3F51B5)),
|
||||
ThemeOption("Theme 4", const Color(0xFF40B7FF), const Color(0xFF40B7FF), const Color(0xFF40B7FF)),
|
||||
ThemeOption(
|
||||
"Theme 1", Colors.red, Colors.red, Colors.red, ColorThemeType.red),
|
||||
ThemeOption(
|
||||
"Theme 2",
|
||||
const Color(0xFF49BF3C),
|
||||
const Color(0xFF49BF3C),
|
||||
const Color(0xFF49BF3C),
|
||||
ColorThemeType.green,
|
||||
),
|
||||
ThemeOption(
|
||||
"Theme 3",
|
||||
const Color(0xFF3F51B5),
|
||||
const Color(0xFF3F51B5),
|
||||
const Color(0xFF3F51B5),
|
||||
ColorThemeType.blue,
|
||||
),
|
||||
ThemeOption(
|
||||
"Theme 4",
|
||||
const Color(0xFF663399),
|
||||
const Color(0xFF663399),
|
||||
const Color(0xFF663399),
|
||||
ColorThemeType.purple,
|
||||
),
|
||||
];
|
||||
|
||||
// Reactive controller
|
||||
class ThemeController extends GetxController {
|
||||
RxInt selectedIndex = 0.obs;
|
||||
RxBool showApplied = false.obs;
|
||||
|
||||
void init() {
|
||||
final currentPrimary = AdminTheme.theme.contentTheme.primary;
|
||||
int index = themeOptions.indexWhere((opt) => opt.primary.value == currentPrimary.value);
|
||||
int index = themeOptions
|
||||
.indexWhere((opt) => opt.primary.value == currentPrimary.value);
|
||||
selectedIndex.value = index == -1 ? 0 : index;
|
||||
}
|
||||
|
||||
@ -36,42 +57,48 @@ class ThemeController extends GetxController {
|
||||
selectedIndex.value = index;
|
||||
showApplied.value = true;
|
||||
|
||||
// Update AdminTheme
|
||||
AdminTheme.updateThemeColors(
|
||||
primary: themeOptions[index].primary,
|
||||
buttonColor: themeOptions[index].button,
|
||||
brandColor: themeOptions[index].brand,
|
||||
);
|
||||
ThemeCustomizer.instance.colorTheme = themeOptions[index].colorThemeType;
|
||||
|
||||
ThemeCustomizer.applyThemeChange();
|
||||
|
||||
await Future.delayed(const Duration(milliseconds: 600));
|
||||
showApplied.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Theme Editor Widget
|
||||
class ThemeEditorWidget extends StatelessWidget {
|
||||
class ThemeEditorWidget extends StatefulWidget {
|
||||
final VoidCallback onClose;
|
||||
ThemeEditorWidget({Key? key, required this.onClose}) : super(key: key);
|
||||
|
||||
const ThemeEditorWidget({super.key, required this.onClose});
|
||||
|
||||
@override
|
||||
_ThemeEditorWidgetState createState() => _ThemeEditorWidgetState();
|
||||
}
|
||||
|
||||
class _ThemeEditorWidgetState extends State<ThemeEditorWidget> {
|
||||
final ThemeController themeController = Get.put(ThemeController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
void initState() {
|
||||
super.initState();
|
||||
themeController.init();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header
|
||||
// Header row with title and close button
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MyText.bodyLarge("Theme Customization", fontWeight: 600),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: onClose,
|
||||
onPressed: widget.onClose,
|
||||
tooltip: "Back",
|
||||
iconSize: 20,
|
||||
),
|
||||
@ -79,38 +106,101 @@ class ThemeEditorWidget extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Theme Cards
|
||||
// Theme cards wrapped in reactive Obx widget
|
||||
Center(
|
||||
child: Obx(() => Wrap(
|
||||
child: Obx(
|
||||
() => Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 12,
|
||||
alignment: WrapAlignment.center,
|
||||
children: List.generate(themeOptions.length, (i) {
|
||||
final theme = themeOptions[i];
|
||||
final isSelected = themeController.selectedIndex.value == i;
|
||||
return ThemeCard(
|
||||
themeOption: themeOptions[i],
|
||||
isSelected: themeController.selectedIndex.value == i,
|
||||
onTap: () => themeController.applyTheme(i),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Applied indicator reactive widget
|
||||
Obx(
|
||||
() => themeController.showApplied.value
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color:
|
||||
themeOptions[themeController.selectedIndex.value]
|
||||
.brand,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
"Theme Applied!",
|
||||
style: TextStyle(
|
||||
color: themeOptions[
|
||||
themeController.selectedIndex.value]
|
||||
.brand,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
"Preview and select a theme. You can change this anytime.",
|
||||
style: TextStyle(fontSize: 13, color: Colors.black54),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ThemeCard extends StatelessWidget {
|
||||
final ThemeOption themeOption;
|
||||
final bool isSelected;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const ThemeCard({
|
||||
Key? key,
|
||||
required this.themeOption,
|
||||
required this.isSelected,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 80,
|
||||
child: GestureDetector(
|
||||
onTap: () => themeController.applyTheme(i),
|
||||
child: Material(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
elevation: isSelected ? 4 : 1,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: onTap,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
curve: Curves.easeInOut,
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isSelected ? theme.brand : Colors.transparent,
|
||||
color: isSelected ? themeOption.brand : Colors.transparent,
|
||||
width: 2,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -123,8 +213,7 @@ class ThemeEditorWidget extends StatelessWidget {
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
CustomPaint(
|
||||
painter: RedWavePainter(theme.brand, 0.15),
|
||||
),
|
||||
painter: RedWavePainter(themeOption.brand, 0.15)),
|
||||
Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -134,7 +223,7 @@ class ThemeEditorWidget extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.primary,
|
||||
color: themeOption.primary,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
@ -143,8 +232,9 @@ class ThemeEditorWidget extends StatelessWidget {
|
||||
height: 18,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: theme.button,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 0),
|
||||
backgroundColor: themeOption.button,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8, vertical: 0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
@ -164,7 +254,7 @@ class ThemeEditorWidget extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
theme.label,
|
||||
themeOption.label,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
@ -175,41 +265,6 @@ class ThemeEditorWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
)),
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Applied Indicator
|
||||
Obx(() => themeController.showApplied.value
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.check_circle,
|
||||
color: themeOptions[themeController.selectedIndex.value].brand, size: 20),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
"Theme Applied!",
|
||||
style: TextStyle(
|
||||
color: themeOptions[themeController.selectedIndex.value].brand,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const SizedBox()),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
"Preview and select a theme. You can change this anytime.",
|
||||
style: TextStyle(fontSize: 13, color: Colors.black54),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class AttendanceButtonHelper {
|
||||
}
|
||||
}
|
||||
|
||||
static Color getButtonColor({
|
||||
static Color getprimary({
|
||||
required bool isYesterday,
|
||||
required bool isTodayApproved,
|
||||
required int activity,
|
||||
|
||||
@ -235,7 +235,7 @@ class _AttendanceActionButtonState extends State<AttendanceActionButton> {
|
||||
isTodayApproved: isTodayApproved,
|
||||
);
|
||||
|
||||
final buttonColor = AttendanceButtonHelper.getButtonColor(
|
||||
final primary = AttendanceButtonHelper.getprimary(
|
||||
isYesterday: isYesterday,
|
||||
isTodayApproved: isTodayApproved,
|
||||
activity: emp.activity,
|
||||
@ -245,7 +245,7 @@ class _AttendanceActionButtonState extends State<AttendanceActionButton> {
|
||||
isUploading: isUploading,
|
||||
isButtonDisabled: isButtonDisabled,
|
||||
buttonText: buttonText,
|
||||
buttonColor: buttonColor,
|
||||
primary: primary,
|
||||
onPressed: isButtonDisabled ? null : _handleButtonPressed,
|
||||
);
|
||||
});
|
||||
@ -256,7 +256,7 @@ class AttendanceActionButtonUI extends StatelessWidget {
|
||||
final bool isUploading;
|
||||
final bool isButtonDisabled;
|
||||
final String buttonText;
|
||||
final Color buttonColor;
|
||||
final Color primary;
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
const AttendanceActionButtonUI({
|
||||
@ -264,7 +264,7 @@ class AttendanceActionButtonUI extends StatelessWidget {
|
||||
required this.isUploading,
|
||||
required this.isButtonDisabled,
|
||||
required this.buttonText,
|
||||
required this.buttonColor,
|
||||
required this.primary,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
@ -275,7 +275,7 @@ class AttendanceActionButtonUI extends StatelessWidget {
|
||||
child: ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: buttonColor,
|
||||
backgroundColor: primary,
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
||||
textStyle: const TextStyle(fontSize: 12),
|
||||
),
|
||||
|
||||
@ -15,7 +15,7 @@ class ReusableListCard<T> extends StatelessWidget {
|
||||
final String Function(T item)? getOutTimeText;
|
||||
final bool Function(T item)? isUploading;
|
||||
final String Function(T item)? getButtonText;
|
||||
final Color Function(String buttonText)? getButtonColor;
|
||||
final Color Function(String buttonText)? getprimary;
|
||||
|
||||
const ReusableListCard({
|
||||
Key? key,
|
||||
@ -30,7 +30,7 @@ class ReusableListCard<T> extends StatelessWidget {
|
||||
this.getOutTimeText,
|
||||
this.isUploading,
|
||||
this.getButtonText,
|
||||
this.getButtonColor,
|
||||
this.getprimary,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -47,8 +47,8 @@ class ReusableListCard<T> extends StatelessWidget {
|
||||
final item = items[index];
|
||||
final buttonText = getButtonText?.call(item) ?? 'Action';
|
||||
final uploading = isUploading?.call(item) ?? false;
|
||||
final buttonColor =
|
||||
getButtonColor?.call(buttonText) ?? Theme.of(context).primaryColor;
|
||||
final primary =
|
||||
getprimary?.call(buttonText) ?? Theme.of(context).primaryColor;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
@ -121,7 +121,7 @@ class ReusableListCard<T> extends StatelessWidget {
|
||||
? null
|
||||
: () => onActionPressed(item),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: buttonColor,
|
||||
backgroundColor: primary,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
textStyle: const TextStyle(fontSize: 12),
|
||||
),
|
||||
|
||||
@ -101,7 +101,7 @@ class UserDocumentFilterBottomSheet extends StatelessWidget with UIMixin {
|
||||
vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: docController.isUploadedAt.value
|
||||
? contentTheme.buttonColor
|
||||
? contentTheme.primary
|
||||
: Colors.transparent,
|
||||
borderRadius:
|
||||
const BorderRadius.horizontal(
|
||||
@ -132,7 +132,7 @@ class UserDocumentFilterBottomSheet extends StatelessWidget with UIMixin {
|
||||
vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: !docController.isUploadedAt.value
|
||||
? contentTheme.buttonColor
|
||||
? contentTheme.primary
|
||||
: Colors.transparent,
|
||||
borderRadius:
|
||||
const BorderRadius.horizontal(
|
||||
@ -265,7 +265,7 @@ class UserDocumentFilterBottomSheet extends StatelessWidget with UIMixin {
|
||||
onChanged: (val) =>
|
||||
docController.isVerified.value = val,
|
||||
activeColor:
|
||||
contentTheme.buttonColor,
|
||||
contentTheme.primary,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
|
||||
@ -94,7 +94,7 @@ class _EmailLoginFormState extends State<EmailLoginForm> with UIMixin {
|
||||
MaterialStateProperty.resolveWith<Color>(
|
||||
(states) =>
|
||||
states.contains(WidgetState.selected)
|
||||
? contentTheme.brandColor
|
||||
? contentTheme.primary
|
||||
: Colors.white,
|
||||
),
|
||||
checkColor: contentTheme.onPrimary,
|
||||
@ -132,7 +132,7 @@ class _EmailLoginFormState extends State<EmailLoginForm> with UIMixin {
|
||||
elevation: 2,
|
||||
padding: MySpacing.xy(80, 16),
|
||||
borderRadiusAll: 10,
|
||||
backgroundColor: contentTheme.brandColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
child: MyText.labelLarge(
|
||||
isLoading ? 'Logging in...' : 'Login',
|
||||
fontWeight: 700,
|
||||
|
||||
@ -60,7 +60,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen>
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
RedWaveBackground(brandRed: contentTheme.brandColor),
|
||||
RedWaveBackground(brandRed: contentTheme.primary),
|
||||
SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
@ -231,8 +231,8 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen>
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 16),
|
||||
borderRadiusAll: 10,
|
||||
backgroundColor: _isLoading
|
||||
? contentTheme.brandColor.withOpacity(0.6)
|
||||
: contentTheme.brandColor,
|
||||
? contentTheme.primary.withOpacity(0.6)
|
||||
: contentTheme.primary,
|
||||
child: _isLoading
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
@ -254,10 +254,10 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen>
|
||||
Widget _buildBackButton() {
|
||||
return TextButton.icon(
|
||||
onPressed: () async => await LocalStorage.logout(),
|
||||
icon: Icon(Icons.arrow_back, size: 18, color: contentTheme.brandColor,),
|
||||
icon: Icon(Icons.arrow_back, size: 18, color: contentTheme.primary,),
|
||||
label: MyText.bodyMedium(
|
||||
'Back to Login',
|
||||
color: contentTheme.brandColor,
|
||||
color: contentTheme.primary,
|
||||
fontWeight: 600,
|
||||
fontSize: 14,
|
||||
),
|
||||
|
||||
@ -102,7 +102,7 @@ class _WelcomeScreenState extends State<WelcomeScreen>
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
RedWaveBackground(brandRed: contentTheme.brandColor),
|
||||
RedWaveBackground(brandRed: contentTheme.primary),
|
||||
SafeArea(
|
||||
child: Center(
|
||||
child: SingleChildScrollView(
|
||||
@ -235,7 +235,7 @@ class _WelcomeScreenState extends State<WelcomeScreen>
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: contentTheme.brandColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||||
|
||||
@ -53,7 +53,7 @@ class _MPINAuthScreenState extends State<MPINAuthScreen>
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
RedWaveBackground(brandRed: contentTheme.brandColor),
|
||||
RedWaveBackground(brandRed: contentTheme.primary),
|
||||
SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
@ -283,8 +283,8 @@ class _MPINAuthScreenState extends State<MPINAuthScreen>
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
|
||||
borderRadiusAll: 10,
|
||||
backgroundColor: controller.isLoading.value
|
||||
? contentTheme.brandColor.withOpacity(0.6)
|
||||
: contentTheme.brandColor,
|
||||
? contentTheme.primary.withOpacity(0.6)
|
||||
: contentTheme.primary,
|
||||
child: controller.isLoading.value
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
@ -318,10 +318,10 @@ class _MPINAuthScreenState extends State<MPINAuthScreen>
|
||||
TextButton.icon(
|
||||
onPressed: () => Get.toNamed('/dashboard'),
|
||||
icon: Icon(Icons.arrow_back,
|
||||
size: 18, color: contentTheme.brandColor),
|
||||
size: 18, color: contentTheme.primary),
|
||||
label: MyText.bodyMedium(
|
||||
'Back to Home Page',
|
||||
color: contentTheme.brandColor,
|
||||
color: contentTheme.primary,
|
||||
fontWeight: 600,
|
||||
fontSize: 14,
|
||||
),
|
||||
@ -333,7 +333,7 @@ class _MPINAuthScreenState extends State<MPINAuthScreen>
|
||||
size: 18, color: Colors.redAccent),
|
||||
label: MyText.bodyMedium(
|
||||
'Go back to Login Screen',
|
||||
color: contentTheme.brandColor,
|
||||
color: contentTheme.primary,
|
||||
fontWeight: 600,
|
||||
fontSize: 14,
|
||||
),
|
||||
|
||||
@ -81,7 +81,7 @@ class _OTPLoginScreenState extends State<OTPLoginScreen> with UIMixin {
|
||||
elevation: 2,
|
||||
padding: MySpacing.xy(24, 16),
|
||||
borderRadiusAll: 10,
|
||||
backgroundColor: isDisabled ? Colors.grey : contentTheme.brandColor,
|
||||
backgroundColor: isDisabled ? Colors.grey : contentTheme.primary,
|
||||
child: controller.isSending.value
|
||||
? SizedBox(
|
||||
width: 20,
|
||||
@ -170,7 +170,7 @@ class _OTPLoginScreenState extends State<OTPLoginScreen> with UIMixin {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: contentTheme.brandColor, width: 2),
|
||||
borderSide: BorderSide(color: contentTheme.primary, width: 2),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -220,7 +220,7 @@ class _OTPLoginScreenState extends State<OTPLoginScreen> with UIMixin {
|
||||
elevation: 2,
|
||||
padding: MySpacing.xy(24, 16),
|
||||
borderRadiusAll: 10,
|
||||
backgroundColor: contentTheme.brandColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
child: MyText.labelMedium(
|
||||
'Verify OTP',
|
||||
fontWeight: 600,
|
||||
|
||||
@ -182,10 +182,10 @@ class _OrganizationFormState extends State<_OrganizationForm> with UIMixin {
|
||||
setState(() => _agreed = val ?? false),
|
||||
fillColor: MaterialStateProperty.resolveWith(
|
||||
(states) => states.contains(MaterialState.selected)
|
||||
? contentTheme.brandColor
|
||||
? contentTheme.primary
|
||||
: Colors.white),
|
||||
checkColor: Colors.white,
|
||||
side: BorderSide(color: contentTheme.brandColor, width: 2),
|
||||
side: BorderSide(color: contentTheme.primary, width: 2),
|
||||
),
|
||||
Flexible(
|
||||
child: Wrap(
|
||||
@ -196,7 +196,7 @@ class _OrganizationFormState extends State<_OrganizationForm> with UIMixin {
|
||||
),
|
||||
MyText(
|
||||
'privacy policy & terms',
|
||||
color: contentTheme.brandColor,
|
||||
color: contentTheme.primary,
|
||||
fontWeight: 600,
|
||||
),
|
||||
],
|
||||
@ -249,7 +249,7 @@ class _OrganizationFormState extends State<_OrganizationForm> with UIMixin {
|
||||
fontWeight: 600,
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
@ -266,12 +266,12 @@ class _OrganizationFormState extends State<_OrganizationForm> with UIMixin {
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
size: 18,
|
||||
color: contentTheme.brandColor,
|
||||
color: contentTheme.primary,
|
||||
),
|
||||
label: MyText.bodySmall(
|
||||
'Back to log in',
|
||||
fontWeight: 600,
|
||||
color: contentTheme.brandColor,
|
||||
color: contentTheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -334,7 +334,7 @@ class _OrganizationFormState extends State<_OrganizationForm> with UIMixin {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: contentTheme.brandColor, width: 1.5),
|
||||
borderSide: BorderSide(color: contentTheme.primary, width: 1.5),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@ -411,7 +411,7 @@ class _OrganizationFormState extends State<_OrganizationForm> with UIMixin {
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide:
|
||||
BorderSide(color: contentTheme.brandColor, width: 1.5),
|
||||
BorderSide(color: contentTheme.primary, width: 1.5),
|
||||
),
|
||||
errorText: fieldState.errorText,
|
||||
),
|
||||
|
||||
@ -127,7 +127,7 @@ class _DirectoryViewState extends State<DirectoryView> with UIMixin {
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
@ -173,7 +173,7 @@ class _DirectoryViewState extends State<DirectoryView> with UIMixin {
|
||||
backgroundColor: Colors.grey[100],
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
heroTag: 'createContact',
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
onPressed: _handleCreateContact,
|
||||
icon: const Icon(Icons.person_add_alt_1, color: Colors.white),
|
||||
label: const Text("Add Contact", style: TextStyle(color: Colors.white)),
|
||||
@ -325,7 +325,7 @@ class _DirectoryViewState extends State<DirectoryView> with UIMixin {
|
||||
SizedBox(width: 10),
|
||||
Expanded(child: Text("Create Bucket")),
|
||||
Icon(Icons.chevron_right,
|
||||
size: 20, color: contentTheme.buttonColor),
|
||||
size: 20, color: contentTheme.primary),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
@ -358,7 +358,7 @@ class _DirectoryViewState extends State<DirectoryView> with UIMixin {
|
||||
SizedBox(width: 10),
|
||||
Expanded(child: Text("Manage Buckets")),
|
||||
Icon(Icons.chevron_right,
|
||||
size: 20, color: contentTheme.buttonColor),
|
||||
size: 20, color: contentTheme.primary),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
@ -395,7 +395,7 @@ class _DirectoryViewState extends State<DirectoryView> with UIMixin {
|
||||
child: Text('Show Deleted Contacts')),
|
||||
Switch.adaptive(
|
||||
value: !controller.isActive.value,
|
||||
activeColor: contentTheme.buttonColor,
|
||||
activeColor: contentTheme.primary,
|
||||
onChanged: (val) {
|
||||
controller.isActive.value = !val;
|
||||
controller.fetchContacts(active: !val);
|
||||
|
||||
@ -135,7 +135,7 @@ class _NotesViewState extends State<NotesView> with UIMixin {
|
||||
if (note.isActive) ...[
|
||||
IconButton(
|
||||
icon: Icon(isEditing ? Icons.close : Icons.edit,
|
||||
color: contentTheme.buttonColor, size: 18),
|
||||
color: contentTheme.primary, size: 18),
|
||||
splashRadius: 18,
|
||||
onPressed: () {
|
||||
controller.editingNoteId.value =
|
||||
@ -224,7 +224,7 @@ class _NotesViewState extends State<NotesView> with UIMixin {
|
||||
fontWeight: 600,
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
|
||||
@ -397,7 +397,7 @@ class _UserDocumentsPageState extends State<UserDocumentsPage> with UIMixin {
|
||||
const Expanded(child: Text('Show Deleted Documents')),
|
||||
Switch.adaptive(
|
||||
value: docController.showInactive.value,
|
||||
activeColor: contentTheme.buttonColor,
|
||||
activeColor: contentTheme.primary,
|
||||
onChanged: (val) {
|
||||
docController.showInactive.value = val;
|
||||
docController.fetchDocuments(
|
||||
@ -616,7 +616,7 @@ class _UserDocumentsPageState extends State<UserDocumentsPage> with UIMixin {
|
||||
color: Colors.white,
|
||||
fontWeight: 600,
|
||||
),
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
)
|
||||
: SizedBox.shrink();
|
||||
}),
|
||||
|
||||
@ -254,7 +254,7 @@ class _EmployeeDetailPageState extends State<EmployeeDetailPage> with UIMixin {
|
||||
),
|
||||
IconButton(
|
||||
icon:
|
||||
Icon(Icons.edit, size: 24, color: contentTheme.buttonColor),
|
||||
Icon(Icons.edit, size: 24, color: contentTheme.primary),
|
||||
onPressed: () async {
|
||||
final result =
|
||||
await showModalBottomSheet<Map<String, dynamic>>(
|
||||
@ -315,7 +315,7 @@ class _EmployeeDetailPageState extends State<EmployeeDetailPage> with UIMixin {
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
icon: const Icon(Icons.assignment),
|
||||
label: const Text(
|
||||
'Assign to Project',
|
||||
|
||||
@ -267,7 +267,7 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: contentTheme.buttonColor,
|
||||
color: contentTheme.primary,
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
@ -426,11 +426,11 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
|
||||
value: _employeeController.isAllEmployeeSelected.value,
|
||||
onChanged: (_) => Navigator.pop(context, 'all_employees'),
|
||||
checkColor: Colors.white,
|
||||
activeColor: contentTheme.buttonColor,
|
||||
activeColor: contentTheme.primary,
|
||||
side: const BorderSide(color: Colors.black, width: 1.5),
|
||||
fillColor: MaterialStateProperty.resolveWith<Color>(
|
||||
(states) => states.contains(MaterialState.selected)
|
||||
? contentTheme.buttonColor
|
||||
? contentTheme.primary
|
||||
: Colors.white),
|
||||
),
|
||||
const Text('All Employees'),
|
||||
|
||||
@ -196,7 +196,7 @@ final permissionController = Get.put(PermissionController());
|
||||
await showAddExpenseBottomSheet(isEdit: true);
|
||||
await controller.fetchExpenseDetails();
|
||||
},
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
icon: const Icon(Icons.edit),
|
||||
label: MyText.bodyMedium(
|
||||
"Edit Expense", fontWeight: 600, color: Colors.white),
|
||||
@ -257,10 +257,10 @@ final permissionController = Get.put(PermissionController());
|
||||
|
||||
Widget _statusButton(BuildContext context, ExpenseDetailController controller,
|
||||
ExpenseDetailModel expense, dynamic next) {
|
||||
Color buttonColor = Colors.red;
|
||||
Color primary = Colors.red;
|
||||
if (next.color.isNotEmpty) {
|
||||
try {
|
||||
buttonColor = Color(int.parse(next.color.replaceFirst('#', '0xff')));
|
||||
primary = Color(int.parse(next.color.replaceFirst('#', '0xff')));
|
||||
} catch (_) {}
|
||||
}
|
||||
DateTime onlyDate(DateTime date) {
|
||||
@ -271,7 +271,7 @@ final permissionController = Get.put(PermissionController());
|
||||
style: ElevatedButton.styleFrom(
|
||||
minimumSize: const Size(100, 40),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
backgroundColor: buttonColor,
|
||||
backgroundColor: primary,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
@ -46,7 +46,7 @@ class _ExpenseFilterBottomSheetState extends State<ExpenseFilterBottomSheet>
|
||||
Get.back();
|
||||
},
|
||||
submitText: 'Submit',
|
||||
submitColor: contentTheme.buttonColor,
|
||||
submitColor: contentTheme.primary,
|
||||
submitIcon: Icons.check_circle_outline,
|
||||
child: SingleChildScrollView(
|
||||
controller: widget.scrollController,
|
||||
|
||||
@ -148,7 +148,7 @@ class _ExpenseMainScreenState extends State<ExpenseMainScreen>
|
||||
|
||||
return canUpload
|
||||
? FloatingActionButton.extended(
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
onPressed: showAddExpenseBottomSheet,
|
||||
icon: const Icon(Icons.add, color: Colors.white),
|
||||
label: const Text(
|
||||
|
||||
@ -41,7 +41,7 @@ class _OfflineScreenState extends State<OfflineScreen>
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
RedWaveBackground(brandRed: contentTheme.brandColor),
|
||||
RedWaveBackground(brandRed: contentTheme.primary),
|
||||
SafeArea(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
|
||||
@ -5,29 +5,12 @@ import 'package:marco/helpers/widgets/my_text.dart';
|
||||
import 'package:marco/widgets/custom_switch.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// typedef void OnLeftBarColorSchemeChange(LeftBarThemeType leftBarThemeType);
|
||||
// typedef void OnTopBarColorSchemeChange(TopBarThemeType topBarThemeType);
|
||||
// typedef void OnRightBarColorSchemeChange(RightBarThemeType topBarThemeType);
|
||||
// typedef void OnContentSchemeChange(ContentThemeType contentThemeType);
|
||||
|
||||
class RightBar extends StatefulWidget {
|
||||
// final RightBarThemeType rightBarThemeType;
|
||||
// final LeftBarThemeType leftBarThemeType;
|
||||
// final TopBarThemeType topBarThemeType;
|
||||
// final ContentThemeType contentThemeType;
|
||||
// final OnLeftBarColorSchemeChange onLeftBarColorSchemeChange;
|
||||
// final OnTopBarColorSchemeChange onTopBarColorSchemeChange;
|
||||
// final OnRightBarColorSchemeChange onRightBarColorSchemeChange;
|
||||
// final OnContentSchemeChange onContentSchemeChange;
|
||||
|
||||
|
||||
const RightBar({
|
||||
super.key, // this.leftBarThemeType,
|
||||
// this.topBarThemeType,
|
||||
// this.contentThemeType,
|
||||
// this.onLeftBarColorSchemeChange,
|
||||
// this.onTopBarColorSchemeChange,
|
||||
// this.onContentSchemeChange,
|
||||
// this.onRightBarColorSchemeChange
|
||||
super.key,
|
||||
|
||||
});
|
||||
|
||||
@override
|
||||
@ -116,194 +99,12 @@ class _RightBarState extends State<RightBar>
|
||||
)
|
||||
],
|
||||
),
|
||||
// Spacing.height(8),
|
||||
// Row(
|
||||
// children: [
|
||||
// CustomSwitch.small(
|
||||
// value: widget.contentThemeType == ContentThemeType.dark,
|
||||
// activeBorderColor: rightBarTheme.activeSwitchBorderColor,
|
||||
// inactiveBorderColor: rightBarTheme.inactiveSwitchBorderColor,
|
||||
// inactiveTrackColor: rightBarTheme.disabled,
|
||||
// activeTrackColor: rightBarTheme.primary,
|
||||
// inactiveThumbColor: rightBarTheme.onDisabled,
|
||||
// activeThumbColor: rightBarTheme.onPrimary,
|
||||
// onChanged: (value) {
|
||||
// if (value && widget.onContentSchemeChange != null) {
|
||||
// widget.onContentSchemeChange(ContentThemeType.dark);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// Spacing.width(12),
|
||||
// Text(
|
||||
// "Dark",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText2,
|
||||
// color: rightBarTheme.onBackground),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// Spacing.height(36),
|
||||
// Text("Left Bar",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText1,
|
||||
// color: rightBarTheme.onBackground, fontWeight: 600)),
|
||||
|
||||
Divider(),
|
||||
// Spacing.height(8),
|
||||
// Row(
|
||||
// children: [
|
||||
// CustomSwitch.small(
|
||||
// value: widget.leftBarThemeType == LeftBarThemeType.light,
|
||||
// activeBorderColor: rightBarTheme.activeSwitchBorderColor,
|
||||
// inactiveBorderColor: rightBarTheme.inactiveSwitchBorderColor,
|
||||
// inactiveTrackColor: rightBarTheme.disabled,
|
||||
// activeTrackColor: rightBarTheme.primary,
|
||||
// inactiveThumbColor: rightBarTheme.onDisabled,
|
||||
// activeThumbColor: rightBarTheme.onPrimary,
|
||||
// onChanged: (value) {
|
||||
// if (value && widget.onLeftBarColorSchemeChange != null) {
|
||||
// widget.onLeftBarColorSchemeChange(LeftBarThemeType.light);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// Spacing.width(12),
|
||||
// Text(
|
||||
// "Light",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText2,
|
||||
// color: rightBarTheme.onBackground),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// Spacing.height(8),
|
||||
// Row(
|
||||
// children: [
|
||||
// CustomSwitch.small(
|
||||
// value: widget.leftBarThemeType == LeftBarThemeType.dark,
|
||||
// activeBorderColor: rightBarTheme.activeSwitchBorderColor,
|
||||
// inactiveBorderColor: rightBarTheme.inactiveSwitchBorderColor,
|
||||
// inactiveTrackColor: rightBarTheme.disabled,
|
||||
// activeTrackColor: rightBarTheme.primary,
|
||||
// inactiveThumbColor: rightBarTheme.onDisabled,
|
||||
// activeThumbColor: rightBarTheme.onPrimary,
|
||||
// onChanged: (value) {
|
||||
// if (value && widget.onLeftBarColorSchemeChange != null) {
|
||||
// widget.onLeftBarColorSchemeChange(LeftBarThemeType.dark);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// Spacing.width(12),
|
||||
// Text(
|
||||
// "Dark",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText2,
|
||||
// color: rightBarTheme.onBackground),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// Spacing.height(36),
|
||||
|
||||
Text("Top Bar"),
|
||||
Divider(),
|
||||
// Spacing.height(8),
|
||||
// Row(
|
||||
// children: [
|
||||
// CustomSwitch.small(
|
||||
// value: widget.topBarThemeType == TopBarThemeType.light,
|
||||
// inactiveTrackColor: rightBarTheme.disabled,
|
||||
// activeBorderColor: rightBarTheme.activeSwitchBorderColor,
|
||||
// inactiveBorderColor: rightBarTheme.inactiveSwitchBorderColor,
|
||||
// activeTrackColor: rightBarTheme.primary,
|
||||
// inactiveThumbColor: rightBarTheme.onDisabled,
|
||||
// activeThumbColor: rightBarTheme.onPrimary,
|
||||
// onChanged: (value) {
|
||||
// if (value && widget.onTopBarColorSchemeChange != null) {
|
||||
// widget.onTopBarColorSchemeChange(TopBarThemeType.light);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// Spacing.width(12),
|
||||
// Text(
|
||||
// "Light",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText2,
|
||||
// color: rightBarTheme.onBackground),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// Spacing.height(8),
|
||||
// Row(
|
||||
// children: [
|
||||
// CustomSwitch.small(
|
||||
// value: widget.topBarThemeType == TopBarThemeType.dark,
|
||||
// inactiveTrackColor: rightBarTheme.disabled,
|
||||
// activeBorderColor: rightBarTheme.activeSwitchBorderColor,
|
||||
// inactiveBorderColor: rightBarTheme.inactiveSwitchBorderColor,
|
||||
// activeTrackColor: rightBarTheme.primary,
|
||||
// inactiveThumbColor: rightBarTheme.onDisabled,
|
||||
// activeThumbColor: rightBarTheme.onPrimary,
|
||||
// onChanged: (value) {
|
||||
// if (value && widget.onTopBarColorSchemeChange != null) {
|
||||
// widget.onTopBarColorSchemeChange(TopBarThemeType.dark);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// Spacing.width(12),
|
||||
// Text(
|
||||
// "Dark",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText2,
|
||||
// color: rightBarTheme.onBackground),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// Spacing.height(36),
|
||||
// Text("Right Bar",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText1,
|
||||
// color: rightBarTheme.onBackground, fontWeight: 600)),
|
||||
// Divider(),
|
||||
// Spacing.height(8),
|
||||
// Row(
|
||||
// children: [
|
||||
// CustomSwitch.small(
|
||||
// value: widget.rightBarThemeType == RightBarThemeType.light,
|
||||
// inactiveTrackColor: rightBarTheme.disabled,
|
||||
// activeBorderColor: rightBarTheme.activeSwitchBorderColor,
|
||||
// inactiveBorderColor: rightBarTheme.inactiveSwitchBorderColor,
|
||||
// activeTrackColor: rightBarTheme.primary,
|
||||
// inactiveThumbColor: rightBarTheme.onDisabled,
|
||||
// activeThumbColor: rightBarTheme.onPrimary,
|
||||
// onChanged: (value) {
|
||||
// if (value && widget.onRightBarColorSchemeChange != null) {
|
||||
// widget.onRightBarColorSchemeChange(RightBarThemeType.light);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// Spacing.width(12),
|
||||
// Text(
|
||||
// "Light",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText2,
|
||||
// color: rightBarTheme.onBackground),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// Spacing.height(8),
|
||||
// Row(
|
||||
// children: [
|
||||
// CustomSwitch.small(
|
||||
// value: widget.rightBarThemeType == RightBarThemeType.dark,
|
||||
// inactiveTrackColor: rightBarTheme.disabled,
|
||||
// activeBorderColor: rightBarTheme.activeSwitchBorderColor,
|
||||
// inactiveBorderColor: rightBarTheme.inactiveSwitchBorderColor,
|
||||
// activeTrackColor: rightBarTheme.primary,
|
||||
// inactiveThumbColor: rightBarTheme.onDisabled,
|
||||
// activeThumbColor: rightBarTheme.onPrimary,
|
||||
// onChanged: (value) {
|
||||
// if (value && widget.onRightBarColorSchemeChange != null) {
|
||||
// widget.onRightBarColorSchemeChange(RightBarThemeType.dark);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// Spacing.width(12),
|
||||
// Text(
|
||||
// "Dark",
|
||||
// style: AppTheme.getTextStyle(themeData.textTheme.bodyText2,
|
||||
// color: rightBarTheme.onBackground),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
|
||||
],
|
||||
),
|
||||
))
|
||||
|
||||
@ -15,14 +15,6 @@ import 'package:marco/view/tenant/tenant_selection_screen.dart';
|
||||
import 'package:marco/controller/tenant/tenant_switch_controller.dart';
|
||||
import 'package:marco/helpers/theme/theme_editor_widget.dart';
|
||||
|
||||
class ThemeOption {
|
||||
final String label;
|
||||
final Color primary;
|
||||
final Color button;
|
||||
final Color brand;
|
||||
ThemeOption(this.label, this.primary, this.button, this.brand);
|
||||
}
|
||||
|
||||
|
||||
class UserProfileBar extends StatefulWidget {
|
||||
final bool isCondensed;
|
||||
@ -189,14 +181,14 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
? FontWeight.bold
|
||||
: FontWeight.w600,
|
||||
color: tenant.id == selectedTenant?.id
|
||||
? contentTheme.buttonColor
|
||||
? contentTheme.primary
|
||||
: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (tenant.id == selectedTenant?.id)
|
||||
Icon(Icons.check_circle,
|
||||
color: contentTheme.buttonColor, size: 18),
|
||||
color: contentTheme.primary, size: 18),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -206,7 +198,7 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Icon(Icons.swap_horiz, color: contentTheme.buttonColor),
|
||||
Icon(Icons.swap_horiz, color: contentTheme.primary),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
@ -215,12 +207,12 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: contentTheme.buttonColor,
|
||||
color: contentTheme.primary,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(Icons.arrow_drop_down, color: contentTheme.buttonColor),
|
||||
Icon(Icons.arrow_drop_down, color: contentTheme.primary),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -415,9 +407,9 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
fontWeight: 700,
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: contentTheme.buttonColor,
|
||||
backgroundColor: contentTheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shadowColor: contentTheme.buttonColor,
|
||||
shadowColor: contentTheme.primary,
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: condensed ? 14 : 18,
|
||||
horizontal: condensed ? 14 : 22,
|
||||
@ -440,7 +432,7 @@ class _UserProfileBarState extends State<UserProfileBar>
|
||||
|
||||
Widget _buildLogoutDialog(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final primaryColor = contentTheme.buttonColor;
|
||||
final primaryColor = contentTheme.primary;
|
||||
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
||||
|
||||
@ -64,7 +64,7 @@ class _TenantSelectionScreenState extends State<TenantSelectionScreen>
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
RedWaveBackground(brandRed: contentTheme.brandColor),
|
||||
RedWaveBackground(brandRed: contentTheme.primary),
|
||||
SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
@ -234,10 +234,10 @@ class TenantCardList extends StatelessWidget with UIMixin {
|
||||
await LocalStorage.logout();
|
||||
},
|
||||
icon:
|
||||
Icon(Icons.arrow_back, size: 20, color: contentTheme.brandColor,),
|
||||
Icon(Icons.arrow_back, size: 20, color: contentTheme.primary,),
|
||||
label: MyText(
|
||||
'Back to Login',
|
||||
color: contentTheme.brandColor,
|
||||
color: contentTheme.primary,
|
||||
fontWeight: 600,
|
||||
fontSize: 14,
|
||||
),
|
||||
@ -297,7 +297,7 @@ class _TenantCard extends StatelessWidget with UIMixin {
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(Icons.arrow_forward_ios, size: 24, color: contentTheme.brandColor,),
|
||||
Icon(Icons.arrow_forward_ios, size: 24, color: contentTheme.primary,),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user