INFRA: Set Up Project.
This commit is contained in:
301
lib/themes/app_them_data.dart
Normal file
301
lib/themes/app_them_data.dart
Normal file
@@ -0,0 +1,301 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppThemeData {
|
||||
static const Color surface = Color(0xFFFFFFFF);
|
||||
static const Color surfaceDark = Color(0xFF010309);
|
||||
|
||||
// === Car-Rent (Light) ===
|
||||
static const Color carRent50 = Color(0xFFEBFAF2);
|
||||
static const Color carRent100 = Color(0xFFB7EBCE);
|
||||
static const Color carRent200 = Color(0xFF83DDAB);
|
||||
static const Color carRent300 = Color(0xFF47CF88);
|
||||
static const Color carRent400 = Color(0xFF37905E);
|
||||
static const Color carRent500 = Color(0xFF1E5235);
|
||||
static const Color carRent600 = Color(0xFF05140C);
|
||||
|
||||
// === Car-Rent (Dark) ===
|
||||
static const Color carRentDark50 = Color(0xFF05140C);
|
||||
static const Color carRentDark100 = Color(0xFF1E5235);
|
||||
static const Color carRentDark200 = Color(0xFF37905E);
|
||||
static const Color carRentDark300 = Color(0xFF4FCF88);
|
||||
static const Color carRentDark400 = Color(0xFF83DDAB);
|
||||
static const Color carRentDark500 = Color(0xFFB7EBCE);
|
||||
static const Color carRentDark600 = Color(0xFFEBFAF2);
|
||||
|
||||
// === E-Commerce (Light) ===
|
||||
static const Color ecommerce50 = Color(0xFFE5EDFF);
|
||||
static const Color ecommerce100 = Color(0xFFABC4FF);
|
||||
static const Color ecommerce200 = Color(0xFF72BCFF);
|
||||
static Color ecommerce300 = const Color(0xFF3974FF);
|
||||
static const Color ecommerce400 = Color(0xFF2650B2);
|
||||
static const Color ecommerce500 = Color(0xFF132C66);
|
||||
static const Color ecommerce600 = Color(0xFF00081A);
|
||||
|
||||
// === E-Commerce (Dark) ===
|
||||
static const Color ecommerceDark50 = Color(0xFF00081A);
|
||||
static const Color ecommerceDark100 = Color(0xFF132C66);
|
||||
static const Color ecommerceDark200 = Color(0xFF2650B2);
|
||||
static const Color ecommerceDark300 = Color(0xFF3974FF);
|
||||
static const Color ecommerceDark400 = Color(0xFF729CFF);
|
||||
static const Color ecommerceDark500 = Color(0xFFABC4FF);
|
||||
static const Color ecommerceDark600 = Color(0xFFE5EDFF);
|
||||
|
||||
// === Multi-Vendor ===
|
||||
static const Color multiVendor50 = Color(0xFFFFE6E6);
|
||||
static const Color multiVendor100 = Color(0xFFFEB9B9);
|
||||
static const Color multiVendor200 = Color(0xFFEB8B8B);
|
||||
static const Color multiVendor300 = Color(0xFFFE5D5D);
|
||||
static const Color multiVendor400 = Color(0xFFB13E3E);
|
||||
static const Color multiVendor500 = Color(0xFF651F1F);
|
||||
static const Color multiVendor600 = Color(0xFF910000);
|
||||
|
||||
static const Color multiVendorDark50 = Color(0xFF910000);
|
||||
static const Color multiVendorDark100 = Color(0xFF651F1F);
|
||||
static const Color multiVendorDark200 = Color(0xFFB13E3E);
|
||||
static const Color multiVendorDark300 = Color(0xFFFE5D5D);
|
||||
static const Color multiVendorDark400 = Color(0xFFFE8B8B);
|
||||
static const Color multiVendorDark500 = Color(0xFFFEB9B9);
|
||||
static const Color multiVendorDark600 = Color(0xFFFFE6E6);
|
||||
|
||||
// === On-Demand ===
|
||||
static const Color onDemand50 = Color(0xFFE6F8FF);
|
||||
static const Color onDemand100 = Color(0xFF9DE5FF);
|
||||
static const Color onDemand200 = Color(0xFF55D1FE);
|
||||
static const Color onDemand300 = Color(0xFF0DBDFD);
|
||||
static const Color onDemand400 = Color(0xFF0885B1);
|
||||
static const Color onDemand500 = Color(0xFF044C65);
|
||||
static const Color onDemand600 = Color(0xFF001319);
|
||||
|
||||
static const Color onDemandDark50 = Color(0xFF001319);
|
||||
static const Color onDemandDark100 = Color(0xFF004C65);
|
||||
static const Color onDemandDark200 = Color(0xFF0885B1);
|
||||
static const Color onDemandDark300 = Color(0xFF55D1FE);
|
||||
static const Color onDemandDark400 = Color(0xFF55D1FE);
|
||||
static const Color onDemandDark500 = Color(0xFF00A1F1);
|
||||
static const Color onDemandDark600 = Color(0xFFE6F8FF);
|
||||
|
||||
// === Taxi-Booking ===
|
||||
static const Color taxiBooking50 = Color(0xFFFFF6E5);
|
||||
static const Color taxiBooking100 = Color(0xFFFFDFA8);
|
||||
static const Color taxiBooking200 = Color(0xFFFFC06A);
|
||||
static const Color taxiBooking300 = Color(0xFFFFB32C);
|
||||
static const Color taxiBooking400 = Color(0xFFB27C1E);
|
||||
static const Color taxiBooking500 = Color(0xFF66460F);
|
||||
static const Color taxiBooking600 = Color(0xFF1A1000);
|
||||
|
||||
static const Color taxiBookingDark50 = Color(0xFF1A1000);
|
||||
static const Color taxiBookingDark100 = Color(0xFF1A1000);
|
||||
static const Color taxiBookingDark200 = Color(0xFFFFC96A);
|
||||
static const Color taxiBookingDark300 = Color(0xFFFFB32C);
|
||||
static const Color taxiBookingDark400 = Color(0xFFFFC06A);
|
||||
static const Color taxiBookingDark500 = Color(0xFFFFDFA8);
|
||||
static const Color taxiBookingDark600 = Color(0xFFFFF6E5);
|
||||
|
||||
// === Parcel-Service ===
|
||||
static const Color parcelService50 = Color(0xFFEAFBF3);
|
||||
static const Color parcelService100 = Color(0xFFAAEFCF);
|
||||
static const Color parcelService200 = Color(0xFF6AE2AB);
|
||||
static const Color parcelService300 = Color(0xFF2AD587);
|
||||
static const Color parcelService400 = Color(0xFF1E955E);
|
||||
static const Color parcelService500 = Color(0xFF115536);
|
||||
static const Color parcelService600 = Color(0xFF04150E);
|
||||
|
||||
static const Color parcelServiceDark50 = Color(0xFF04150E);
|
||||
static const Color parcelServiceDark100 = Color(0xFFAAEFCF);
|
||||
static const Color parcelServiceDark200 = Color(0xFF1E955E);
|
||||
static const Color parcelServiceDark300 = Color(0xFF2AD587);
|
||||
static const Color parcelServiceDark400 = Color(0xFF6AE2AB);
|
||||
static const Color parcelServiceDark500 = Color(0xFFAAEFCF);
|
||||
static const Color parcelServiceDark600 = Color(0xFFEAFBF3);
|
||||
|
||||
// === Grey ===
|
||||
static const Color grey50 = Color(0xFFF9FAFB);
|
||||
static const Color grey100 = Color(0xFFF3F4F6);
|
||||
static const Color grey200 = Color(0xFFE5E7EB);
|
||||
static const Color grey300 = Color(0xFFD1D5DB);
|
||||
static const Color grey400 = Color(0xFF9CA3AF);
|
||||
static const Color grey500 = Color(0xFF6B7280);
|
||||
static const Color grey600 = Color(0xFF4B5563);
|
||||
static const Color grey700 = Color(0xFF374151);
|
||||
static const Color grey800 = Color(0xFF1F2937);
|
||||
static const Color grey900 = Color(0xFF0C111C);
|
||||
|
||||
static const Color greyDark50 = Color(0xFF0C111C);
|
||||
static const Color greyDark100 = Color(0xFF1F2937);
|
||||
static const Color greyDark200 = Color(0xFF374151);
|
||||
static const Color greyDark300 = Color(0xFF4B5563);
|
||||
static const Color greyDark400 = Color(0xFF6B7280);
|
||||
static const Color greyDark500 = Color(0xFF9CA3AF);
|
||||
static const Color greyDark600 = Color(0xFFD1D5DB);
|
||||
static const Color greyDark700 = Color(0xFFE5E7EB);
|
||||
static const Color greyDark800 = Color(0xFFF3F4F6);
|
||||
static const Color greyDark900 = Color(0xFFF9FAFB);
|
||||
|
||||
// === Danger ===
|
||||
static const Color danger50 = Color(0xFFFFE5E6);
|
||||
static const Color danger100 = Color(0xFFFFACAE);
|
||||
static const Color danger200 = Color(0xFFFF7277);
|
||||
static const Color danger300 = Color(0xFFFF3840);
|
||||
static const Color danger400 = Color(0xFFB2262B);
|
||||
static const Color danger500 = Color(0xFF661316);
|
||||
static const Color danger600 = Color(0xFF1A0001);
|
||||
|
||||
static const Color dangerDark50 = Color(0xFF1A0001);
|
||||
static const Color dangerDark100 = Color(0xFF661316);
|
||||
static const Color dangerDark200 = Color(0xFFB2262B);
|
||||
static const Color dangerDark300 = Color(0xFFFF3840);
|
||||
static const Color dangerDark400 = Color(0xFFFF7277);
|
||||
static const Color dangerDark500 = Color(0xFFFFACAE);
|
||||
static const Color dangerDark600 = Color(0xFFFFE5E6);
|
||||
|
||||
// === Info ===
|
||||
static const Color info50 = Color(0xFFE5F9FF);
|
||||
static const Color info100 = Color(0xFFACECFF);
|
||||
static const Color info200 = Color(0xFF72DEFF);
|
||||
static const Color info300 = Color(0xFF38D0FF);
|
||||
static const Color info400 = Color(0xFF2692B2);
|
||||
static const Color info500 = Color(0xFF135366);
|
||||
static const Color info600 = Color(0xFF00141A);
|
||||
|
||||
static const Color infoDark50 = Color(0xFF00141A);
|
||||
static const Color infoDark100 = Color(0xFF135366);
|
||||
static const Color infoDark200 = Color(0xFF2692B2);
|
||||
static const Color infoDark300 = Color(0xFF38D0FF);
|
||||
static const Color infoDark400 = Color(0xFF72DEFF);
|
||||
static const Color infoDark500 = Color(0xFFACECFF);
|
||||
static const Color infoDark600 = Color(0xFFE5F9FF);
|
||||
|
||||
// === Success ===
|
||||
static const Color success50 = Color(0xFFE5FFEB);
|
||||
static const Color success100 = Color(0xFFACFFBF);
|
||||
static const Color success200 = Color(0xFF72FF93);
|
||||
static const Color success300 = Color(0xFF38FF67);
|
||||
static const Color success400 = Color(0xFF26B246);
|
||||
static const Color success500 = Color(0xFF136626);
|
||||
static const Color success600 = Color(0xFF001A06);
|
||||
|
||||
static const Color successDark50 = Color(0xFF001A06);
|
||||
static const Color successDark100 = Color(0xFF136626);
|
||||
static const Color successDark200 = Color(0xFF26B246);
|
||||
static const Color successDark300 = Color(0xFF38FF67);
|
||||
static const Color successDark400 = Color(0xFF72FF93);
|
||||
static const Color successDark500 = Color(0xFFACFFBF);
|
||||
static const Color successDark600 = Color(0xFFE5FFEB);
|
||||
|
||||
// === Warning ===
|
||||
static const Color warning50 = Color(0xFFFFF8E5);
|
||||
static const Color warning100 = Color(0xFFFFE9AB);
|
||||
static const Color warning200 = Color(0xFFFFDA72);
|
||||
static const Color warning300 = Color(0xFFFFCB39);
|
||||
static const Color warning400 = Color(0xFFB28D26);
|
||||
static const Color warning500 = Color(0xFF665013);
|
||||
static const Color warning600 = Color(0xFF191200);
|
||||
|
||||
static const Color warningDark50 = Color(0xFF191200);
|
||||
static const Color warningDark100 = Color(0xFF666655);
|
||||
static const Color warningDark200 = Color(0xFFB28D26);
|
||||
static const Color warningDark300 = Color(0xFFFFCB39);
|
||||
static const Color warningDark400 = Color(0xFFFFDA72);
|
||||
static const Color warningDark500 = Color(0xFFFFE9AB);
|
||||
static const Color warningDark600 = Color(0xFFFFF8E5);
|
||||
|
||||
static const Color primary50 = Color(0xFFFFEBE5);
|
||||
static const Color primary100 = Color(0xFFFFC0AB);
|
||||
static const Color primary200 = Color(0xFFFF9472);
|
||||
static Color primary300 = const Color(0xFFFF6839);
|
||||
static const Color primary400 = Color(0xFFB24826);
|
||||
static const Color primary500 = Color(0xFF662713);
|
||||
static const Color primary600 = Color(0xFF1A0600);
|
||||
|
||||
static const String fontFamily = 'EssentialSans';
|
||||
|
||||
static const String black = 'EssentialSans';
|
||||
static const String bold = 'EssentialSans';
|
||||
static const String extraBold = 'EssentialSans';
|
||||
static const String extraLight = 'EssentialSans';
|
||||
static const String light = 'EssentialSans';
|
||||
static const String medium = 'EssentialSans';
|
||||
static const String regular = 'EssentialSans';
|
||||
static const String semiBold = 'EssentialSans';
|
||||
static const String thin = 'EssentialSans';
|
||||
|
||||
static TextStyle regularTextStyle({
|
||||
double? fontSize,
|
||||
Color? color,
|
||||
TextDecoration? decoration,
|
||||
Color? decorationColor,
|
||||
TextDecorationStyle? decorationStyle,
|
||||
double? decorationThickness,
|
||||
}) {
|
||||
return TextStyle(
|
||||
fontSize: fontSize ?? 14,
|
||||
color: color ?? grey900,
|
||||
fontFamily: fontFamily,
|
||||
fontWeight: FontWeight.w400,
|
||||
decoration: decoration ?? TextDecoration.none,
|
||||
decorationColor: decorationColor ?? color ?? grey900,
|
||||
decorationStyle: decorationStyle,
|
||||
decorationThickness: decorationThickness,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle mediumTextStyle({
|
||||
double? fontSize,
|
||||
Color? color,
|
||||
TextDecoration? decoration,
|
||||
Color? decorationColor,
|
||||
TextDecorationStyle? decorationStyle,
|
||||
double? decorationThickness,
|
||||
}) {
|
||||
return TextStyle(
|
||||
fontSize: fontSize ?? 14,
|
||||
color: color ?? grey900,
|
||||
fontFamily: fontFamily,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: decoration ?? TextDecoration.none,
|
||||
decorationColor: decorationColor ?? color ?? grey900,
|
||||
decorationStyle: decorationStyle,
|
||||
decorationThickness: decorationThickness,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle semiBoldTextStyle({
|
||||
double? fontSize,
|
||||
Color? color,
|
||||
TextDecoration? decoration,
|
||||
Color? decorationColor,
|
||||
TextDecorationStyle? decorationStyle,
|
||||
double? decorationThickness,
|
||||
}) {
|
||||
return TextStyle(
|
||||
fontSize: fontSize ?? 14,
|
||||
color: color ?? grey900,
|
||||
fontFamily: fontFamily,
|
||||
fontWeight: FontWeight.w600,
|
||||
decoration: decoration ?? TextDecoration.none,
|
||||
decorationColor: decorationColor ?? color ?? grey900,
|
||||
decorationStyle: decorationStyle,
|
||||
decorationThickness: decorationThickness,
|
||||
);
|
||||
}
|
||||
|
||||
static TextStyle boldTextStyle({
|
||||
double? fontSize,
|
||||
Color? color,
|
||||
TextDecoration? decoration,
|
||||
Color? decorationColor,
|
||||
TextDecorationStyle? decorationStyle,
|
||||
double? decorationThickness,
|
||||
}) {
|
||||
return TextStyle(
|
||||
fontSize: fontSize ?? 22,
|
||||
color: color ?? grey900,
|
||||
fontFamily: fontFamily,
|
||||
fontWeight: FontWeight.w700,
|
||||
decoration: decoration ?? TextDecoration.none,
|
||||
decorationColor: decorationColor ?? color ?? grey900,
|
||||
decorationStyle: decorationStyle,
|
||||
decorationThickness: decorationThickness,
|
||||
);
|
||||
}
|
||||
}
|
||||
82
lib/themes/custom_dialog_box.dart
Normal file
82
lib/themes/custom_dialog_box.dart
Normal file
@@ -0,0 +1,82 @@
|
||||
import 'package:customer/themes/responsive.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../controllers/theme_controller.dart';
|
||||
import 'app_them_data.dart';
|
||||
|
||||
class CustomDialogBox extends StatelessWidget {
|
||||
final String title, descriptions, positiveString, negativeString;
|
||||
final Widget? img;
|
||||
final Function() positiveClick;
|
||||
final Function() negativeClick;
|
||||
|
||||
const CustomDialogBox({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.descriptions,
|
||||
required this.img,
|
||||
required this.positiveClick,
|
||||
required this.negativeClick,
|
||||
required this.positiveString,
|
||||
required this.negativeString,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeController themeController = Get.find<ThemeController>();
|
||||
|
||||
return Obx(() {
|
||||
final isDark = themeController.isDark.value;
|
||||
|
||||
return Dialog(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), elevation: 0, backgroundColor: Colors.transparent, child: contentBox(context, isDark));
|
||||
});
|
||||
}
|
||||
|
||||
Widget contentBox(BuildContext context, bool isDark) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(shape: BoxShape.rectangle, color: isDark ? AppThemeData.greyDark100 : AppThemeData.grey100, borderRadius: BorderRadius.circular(20)),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
img ?? const SizedBox(),
|
||||
const SizedBox(height: 20),
|
||||
if (title.isNotEmpty) Text(title.tr, style: AppThemeData.boldTextStyle(fontSize: 20, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
const SizedBox(height: 5),
|
||||
if (descriptions.isNotEmpty)
|
||||
Text(descriptions.tr, textAlign: TextAlign.center, style: AppThemeData.regularTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: negativeClick,
|
||||
child: Container(
|
||||
width: Responsive.width(100, context),
|
||||
height: Responsive.height(5, context),
|
||||
decoration: BoxDecoration(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, borderRadius: BorderRadius.circular(200)),
|
||||
child: Center(
|
||||
child: Text(negativeString.tr, textAlign: TextAlign.center, style: AppThemeData.mediumTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark100 : AppThemeData.grey100)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: positiveClick,
|
||||
child: Container(
|
||||
width: Responsive.width(100, context),
|
||||
height: Responsive.height(5, context),
|
||||
decoration: BoxDecoration(color: AppThemeData.success300, borderRadius: BorderRadius.circular(200)),
|
||||
child: Center(child: Text('Confirm'.tr, textAlign: TextAlign.center, style: AppThemeData.mediumTextStyle(fontSize: 14, color: AppThemeData.grey100))),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
21
lib/themes/easy_loading_config.dart
Normal file
21
lib/themes/easy_loading_config.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../controllers/theme_controller.dart';
|
||||
|
||||
Future<void> configEasyLoading() async {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
|
||||
final isDark = themeController.isDark.value;
|
||||
|
||||
EasyLoading.instance
|
||||
..indicatorType = EasyLoadingIndicatorType.fadingCircle
|
||||
..loadingStyle = EasyLoadingStyle.custom
|
||||
..backgroundColor = isDark ? AppThemeData.greyDark50 : AppThemeData.grey800
|
||||
..indicatorColor = isDark ? Colors.white : Colors.white
|
||||
..textColor = isDark ? Colors.white : AppThemeData.greyDark900
|
||||
..maskColor = Colors.black.withOpacity(0.5)
|
||||
..userInteractions = false
|
||||
..dismissOnTap = false;
|
||||
}
|
||||
11
lib/themes/responsive.dart
Normal file
11
lib/themes/responsive.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Responsive {
|
||||
static double width(double size, BuildContext context) {
|
||||
return MediaQuery.of(context).size.width * (size / 100);
|
||||
}
|
||||
|
||||
static double height(double size, BuildContext context) {
|
||||
return MediaQuery.of(context).size.height * (size / 100);
|
||||
}
|
||||
}
|
||||
76
lib/themes/round_button_border.dart
Normal file
76
lib/themes/round_button_border.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:customer/controllers/theme_controller.dart';
|
||||
import 'package:customer/themes/responsive.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'app_them_data.dart';
|
||||
|
||||
class RoundedButtonBorder extends StatelessWidget {
|
||||
final String title;
|
||||
final double? width;
|
||||
final double? height;
|
||||
final double? fontSizes;
|
||||
final double? radius;
|
||||
final Color? color;
|
||||
final Color? borderColor;
|
||||
final Color? textColor;
|
||||
final Widget? icon;
|
||||
final bool? isRight;
|
||||
final bool? isCenter;
|
||||
final Function()? onPress;
|
||||
|
||||
const RoundedButtonBorder({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.height,
|
||||
required this.onPress,
|
||||
this.width,
|
||||
this.radius,
|
||||
this.color,
|
||||
this.icon,
|
||||
this.fontSizes,
|
||||
this.textColor,
|
||||
this.isRight,
|
||||
this.borderColor,
|
||||
this.isCenter,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
onPress?.call();
|
||||
},
|
||||
child: Container(
|
||||
width: Responsive.width(width ?? 100, context),
|
||||
height: Responsive.height(height ?? 6, context),
|
||||
decoration: ShapeDecoration(
|
||||
color: color ?? Colors.transparent,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius ?? 50), side: BorderSide(color: borderColor ?? AppThemeData.danger300)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (isRight == false) Padding(padding: const EdgeInsets.only(right: 10, left: 0), child: icon),
|
||||
isCenter == true
|
||||
? Text(title.tr, textAlign: TextAlign.center, style: AppThemeData.semiBoldTextStyle(fontSize: fontSizes ?? 14, color: textColor ?? AppThemeData.grey800))
|
||||
: Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: isRight == null ? 0 : 30),
|
||||
child: Text(
|
||||
title.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: fontSizes ?? 14, color: textColor ?? (isDark ? AppThemeData.grey100 : AppThemeData.grey700)),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isRight == true) Padding(padding: const EdgeInsets.only(left: 10, right: 20), child: icon),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
67
lib/themes/round_button_fill.dart
Normal file
67
lib/themes/round_button_fill.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
import 'package:customer/themes/responsive.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'app_them_data.dart';
|
||||
|
||||
class RoundedButtonFill extends StatelessWidget {
|
||||
final String title;
|
||||
final double? width;
|
||||
final double? height;
|
||||
final double? fontSizes;
|
||||
final double? borderRadius;
|
||||
final Color? color;
|
||||
final Color? textColor;
|
||||
final Widget? icon;
|
||||
final bool? isRight;
|
||||
final bool? isCenter;
|
||||
final VoidCallback? onPress;
|
||||
|
||||
// final Function()? onPress;
|
||||
|
||||
const RoundedButtonFill({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.borderRadius,
|
||||
this.height,
|
||||
required this.onPress,
|
||||
this.width,
|
||||
this.color,
|
||||
this.isCenter,
|
||||
this.icon,
|
||||
this.fontSizes,
|
||||
this.textColor,
|
||||
this.isRight,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
borderRadius: BorderRadius.circular(borderRadius ?? 50),
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
onPress?.call();
|
||||
},
|
||||
child: Container(
|
||||
width: Responsive.width(width ?? 100, context),
|
||||
height: Responsive.height(height ?? 6, context),
|
||||
decoration: ShapeDecoration(color: color, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(borderRadius ?? 50))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (isRight == false) Padding(padding: const EdgeInsets.only(right: 10, left: 10), child: icon),
|
||||
isCenter == true
|
||||
? Text(title.tr, textAlign: TextAlign.center, style: AppThemeData.semiBoldTextStyle(fontSize: fontSizes ?? 16, color: textColor ?? AppThemeData.grey50))
|
||||
: Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: isRight == null ? 0 : 30),
|
||||
child: Text(title.tr, textAlign: TextAlign.center, style: AppThemeData.semiBoldTextStyle(fontSize: fontSizes ?? 16, color: textColor ?? AppThemeData.grey50)),
|
||||
),
|
||||
),
|
||||
if (isRight == true) Padding(padding: const EdgeInsets.only(left: 10, right: 10), child: icon),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
26
lib/themes/show_toast_dialog.dart
Normal file
26
lib/themes/show_toast_dialog.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
|
||||
class ShowToastDialog {
|
||||
/// Show a toast message with customizable position.
|
||||
static void showToast(
|
||||
String? message, {
|
||||
EasyLoadingToastPosition position = EasyLoadingToastPosition.top,
|
||||
}) {
|
||||
if (message == null || message.isEmpty) return;
|
||||
EasyLoading.showToast(message, toastPosition: position);
|
||||
}
|
||||
|
||||
/// Show a loading indicator with a status message.
|
||||
static void showLoader(String message) {
|
||||
EasyLoading.show(
|
||||
status: message,
|
||||
dismissOnTap: false,
|
||||
maskType: EasyLoadingMaskType.clear,
|
||||
);
|
||||
}
|
||||
|
||||
/// Dismiss any active loading indicator.
|
||||
static void closeLoader() {
|
||||
EasyLoading.dismiss();
|
||||
}
|
||||
}
|
||||
22
lib/themes/styles.dart
Normal file
22
lib/themes/styles.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'app_them_data.dart';
|
||||
|
||||
class Styles {
|
||||
static ThemeData themeData(bool isDarkTheme, BuildContext context) {
|
||||
return ThemeData(
|
||||
scaffoldBackgroundColor: isDarkTheme ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
primaryColor: isDarkTheme ? AppThemeData.dangerDark300 : AppThemeData.danger300,
|
||||
brightness: isDarkTheme ? Brightness.dark : Brightness.light,
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: isDarkTheme ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
),
|
||||
timePickerTheme: TimePickerThemeData(
|
||||
backgroundColor: isDarkTheme ? AppThemeData.greyDark100 : AppThemeData.grey100,
|
||||
dialTextStyle: TextStyle(fontWeight: FontWeight.bold, color: isDarkTheme ? AppThemeData.greyDark100 : AppThemeData.grey100),
|
||||
dialTextColor: isDarkTheme ? AppThemeData.greyDark50 : AppThemeData.grey50,
|
||||
hourMinuteTextColor: isDarkTheme ? AppThemeData.greyDark100 : AppThemeData.grey100,
|
||||
dayPeriodTextColor: isDarkTheme ? AppThemeData.greyDark100 : AppThemeData.grey100,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
130
lib/themes/text_field_widget.dart
Normal file
130
lib/themes/text_field_widget.dart
Normal file
@@ -0,0 +1,130 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../controllers/theme_controller.dart';
|
||||
import 'app_them_data.dart';
|
||||
|
||||
class TextFieldWidget extends StatefulWidget {
|
||||
final String? title;
|
||||
final String hintText;
|
||||
final TextEditingController? controller;
|
||||
final Widget? prefix;
|
||||
final Widget? suffix;
|
||||
final bool? enable;
|
||||
final bool? readOnly;
|
||||
final bool? obscureText;
|
||||
final int? maxLine;
|
||||
final TextInputType? textInputType;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final ValueChanged<String>? onchange;
|
||||
final TextInputAction? textInputAction;
|
||||
final FocusNode? focusNode;
|
||||
final ValueChanged<String>? onFieldSubmitted;
|
||||
final Color? hintColor;
|
||||
final Color? backgroundColor;
|
||||
final Color? borderColor;
|
||||
|
||||
const TextFieldWidget({
|
||||
super.key,
|
||||
this.textInputType,
|
||||
this.enable,
|
||||
this.readOnly,
|
||||
this.obscureText,
|
||||
this.prefix,
|
||||
this.suffix,
|
||||
this.title,
|
||||
required this.hintText,
|
||||
required this.controller,
|
||||
this.maxLine,
|
||||
this.inputFormatters,
|
||||
this.onchange,
|
||||
this.textInputAction,
|
||||
this.focusNode,
|
||||
this.onFieldSubmitted,
|
||||
this.borderColor,
|
||||
this.hintColor,
|
||||
this.backgroundColor,
|
||||
});
|
||||
|
||||
@override
|
||||
State<TextFieldWidget> createState() => _TextFieldWidgetState();
|
||||
}
|
||||
|
||||
class _TextFieldWidgetState extends State<TextFieldWidget> {
|
||||
late FocusNode _focusNode;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_focusNode = widget.focusNode ?? FocusNode();
|
||||
_focusNode.addListener(() {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// if (widget.focusNode == null) {
|
||||
// _focusNode.dispose();
|
||||
// }
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
|
||||
final borderColor = widget.borderColor ?? (_focusNode.hasFocus ? (isDark ? AppThemeData.greyDark400 : AppThemeData.grey400) : (isDark ? AppThemeData.greyDark200 : AppThemeData.grey200));
|
||||
|
||||
final fillColor =
|
||||
widget.backgroundColor ?? (isDark ? (_focusNode.hasFocus ? AppThemeData.greyDark50 : AppThemeData.greyDark100) : (_focusNode.hasFocus ? AppThemeData.grey100 : Colors.transparent));
|
||||
|
||||
final textColor = isDark ? AppThemeData.greyDark900 : AppThemeData.grey900;
|
||||
|
||||
final hintColor = widget.hintColor ?? (isDark ? AppThemeData.grey400 : AppThemeData.greyDark400);
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (widget.title != null) ...[
|
||||
Text(widget.title!.tr, style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
const SizedBox(height: 5),
|
||||
],
|
||||
TextFormField(
|
||||
keyboardType: widget.textInputType ?? TextInputType.text,
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
controller: widget.controller,
|
||||
maxLines: widget.maxLine ?? 1,
|
||||
focusNode: _focusNode,
|
||||
textInputAction: widget.textInputAction ?? TextInputAction.done,
|
||||
inputFormatters: widget.inputFormatters,
|
||||
obscureText: widget.obscureText ?? false,
|
||||
obscuringCharacter: '●',
|
||||
onChanged: widget.onchange,
|
||||
readOnly: widget.readOnly ?? false,
|
||||
onFieldSubmitted: widget.onFieldSubmitted,
|
||||
style: AppThemeData.semiBoldTextStyle(color: textColor),
|
||||
decoration: InputDecoration(
|
||||
errorStyle: const TextStyle(color: Colors.red),
|
||||
filled: true,
|
||||
enabled: widget.enable ?? true,
|
||||
fillColor: fillColor,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: widget.title == null ? 15 : (widget.enable == false ? 13 : 8), horizontal: 10),
|
||||
prefixIcon: widget.prefix,
|
||||
suffixIcon: widget.suffix,
|
||||
prefixIconConstraints: const BoxConstraints(minHeight: 20, minWidth: 20),
|
||||
suffixIconConstraints: const BoxConstraints(minHeight: 20, minWidth: 20),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: borderColor)),
|
||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: borderColor)),
|
||||
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: borderColor, width: 1.2)),
|
||||
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: Colors.red)),
|
||||
disabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: borderColor)),
|
||||
hintText: widget.hintText.tr,
|
||||
hintStyle: AppThemeData.regularTextStyle(fontSize: 14, color: hintColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user