Initial commit
This commit is contained in:
322
lib/themes/app_them_data.dart
Normal file
322
lib/themes/app_them_data.dart
Normal file
@@ -0,0 +1,322 @@
|
||||
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);
|
||||
|
||||
static const Color secondary50 = Color(0xFFEBE5FF);
|
||||
static const Color secondary100 = Color(0xFFC0ABFF);
|
||||
static const Color secondary200 = Color(0xFF9472FF);
|
||||
static Color secondary300 = const Color(0xFF6839FF);
|
||||
static const Color secondary400 = Color(0xFF4826B2);
|
||||
static const Color secondary500 = Color(0xFF271366);
|
||||
static const Color secondary600 = Color(0xFF06001A);
|
||||
|
||||
// === 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);
|
||||
|
||||
static const Color driverApp50 = Color(0xFFEFF9EB);
|
||||
static const Color driverApp100 = Color(0xFFBDE6AE);
|
||||
static const Color driverApp200 = Color(0xFF8CD472);
|
||||
static Color driverApp300 = const Color(0xFF5BC236);
|
||||
static const Color driverApp400 = Color(0xFF3F8826);
|
||||
static const Color driverApp500 = Color(0xFF244E16);
|
||||
static const Color driverApp600 = Color(0xFF091406);
|
||||
|
||||
// === 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(0xFFEAFBF3);
|
||||
static const Color primary100 = Color(0xFFAAEFCF);
|
||||
static const Color primary200 = Color(0xFF6AE2AB);
|
||||
static Color primary300 = Color(0xFF1E955E);
|
||||
static const Color primary400 = Color(0xFF1E955E);
|
||||
static const Color primary500 = Color(0xFF115536);
|
||||
static const Color primary600 = Color(0xFF04150E);
|
||||
|
||||
|
||||
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 List<dynamic> get homePageGradiant => [Color(0xFFF5F7FF), Color(0xFFFFF5F5), Color(0xFFF1FEF7)];
|
||||
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
126
lib/themes/custom_dialog_box.dart
Normal file
126
lib/themes/custom_dialog_box.dart
Normal file
@@ -0,0 +1,126 @@
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:driver/themes/responsive.dart';
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class CustomDialogBox extends StatelessWidget {
|
||||
final String title, descriptions, positiveString, negativeString;
|
||||
final Widget? widget;
|
||||
final Widget? img;
|
||||
final Function() positiveClick;
|
||||
final Function() negativeClick;
|
||||
|
||||
const CustomDialogBox({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.descriptions,
|
||||
this.widget,
|
||||
this.img,
|
||||
required this.positiveClick,
|
||||
required this.negativeClick,
|
||||
required this.positiveString,
|
||||
required this.negativeString,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
child: contentBox(context),
|
||||
);
|
||||
}
|
||||
|
||||
Container contentBox(context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(left: 20, top: 20, right: 20, bottom: 20),
|
||||
decoration: BoxDecoration(shape: BoxShape.rectangle, color: isDark ? AppThemeData.grey800 : AppThemeData.grey100, borderRadius: BorderRadius.circular(20)),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
if (img != null) img!,
|
||||
const SizedBox(height: 20),
|
||||
Visibility(
|
||||
visible: title.isNotEmpty,
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(fontSize: 18, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Visibility(
|
||||
visible: descriptions.isNotEmpty,
|
||||
child: Text(
|
||||
descriptions,
|
||||
style: TextStyle(fontSize: 14, fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey200 : AppThemeData.grey700),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
if (widget != null) Column(crossAxisAlignment: CrossAxisAlignment.start, children: [widget!, const SizedBox(height: 10)]),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
negativeClick();
|
||||
},
|
||||
child: Container(
|
||||
width: Responsive.width(100, context),
|
||||
height: Responsive.height(5, context),
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey200,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(200)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
negativeString.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, color: isDark ? AppThemeData.grey100 : AppThemeData.grey900, fontSize: 14, fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
positiveClick();
|
||||
},
|
||||
child: Container(
|
||||
width: Responsive.width(100, context),
|
||||
height: Responsive.height(5, context),
|
||||
decoration: ShapeDecoration(
|
||||
color: AppThemeData.warning400,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(200)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
positiveString.toString(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontFamily: AppThemeData.medium, color: AppThemeData.grey50, fontSize: 14, fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
21
lib/themes/easy_loading_config.dart
Normal file
21
lib/themes/easy_loading_config.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.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);
|
||||
}
|
||||
}
|
||||
90
lib/themes/round_button_border.dart
Normal file
90
lib/themes/round_button_border.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
import 'package:driver/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 Color? color;
|
||||
final Color? borderColor;
|
||||
final Color? textColor;
|
||||
final Widget? icon;
|
||||
final bool isRight;
|
||||
final bool isCenter;
|
||||
final double iconSpacing;
|
||||
final Function()? onPress;
|
||||
|
||||
const RoundedButtonBorder({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.onPress,
|
||||
this.width,
|
||||
this.height,
|
||||
this.fontSizes,
|
||||
this.color,
|
||||
this.borderColor,
|
||||
this.textColor,
|
||||
this.icon,
|
||||
this.isRight = false,
|
||||
this.isCenter = false,
|
||||
this.iconSpacing = 6.0,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget content = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: isRight
|
||||
? [
|
||||
Text(
|
||||
title.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: fontSizes ?? 14, color: textColor ?? AppThemeData.grey800),
|
||||
),
|
||||
if (icon != null) ...[
|
||||
SizedBox(width: iconSpacing),
|
||||
icon!,
|
||||
]
|
||||
]
|
||||
: [
|
||||
if (icon != null) ...[
|
||||
icon!,
|
||||
SizedBox(width: iconSpacing),
|
||||
],
|
||||
Text(
|
||||
title.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppThemeData.semiBoldTextStyle(fontSize: fontSizes ?? 14, color: textColor ?? AppThemeData.grey800),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
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(50),
|
||||
side: BorderSide(color: borderColor ?? AppThemeData.danger300),
|
||||
),
|
||||
),
|
||||
child: isCenter
|
||||
? Center(child: content)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
76
lib/themes/round_button_fill.dart
Normal file
76
lib/themes/round_button_fill.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:driver/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 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(
|
||||
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),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
19
lib/themes/styles.dart
Normal file
19
lib/themes/styles.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Styles {
|
||||
static ThemeData themeData(bool isDarkTheme, BuildContext context) {
|
||||
return ThemeData(
|
||||
scaffoldBackgroundColor: isDarkTheme ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
primaryColor: isDarkTheme ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
brightness: isDarkTheme ? Brightness.dark : Brightness.light,
|
||||
timePickerTheme: TimePickerThemeData(
|
||||
backgroundColor: isDarkTheme ? AppThemeData.grey700 : AppThemeData.grey300,
|
||||
dialTextStyle: TextStyle(fontWeight: FontWeight.bold, color: isDarkTheme ? AppThemeData.grey800 : AppThemeData.grey800),
|
||||
dialTextColor: isDarkTheme ? AppThemeData.grey800 : AppThemeData.grey800,
|
||||
hourMinuteTextColor: isDarkTheme ? AppThemeData.grey800 : AppThemeData.grey800,
|
||||
dayPeriodTextColor: isDarkTheme ? AppThemeData.grey800 : AppThemeData.grey800,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
142
lib/themes/text_field_widget.dart
Normal file
142
lib/themes/text_field_widget.dart
Normal file
@@ -0,0 +1,142 @@
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'app_them_data.dart';
|
||||
|
||||
class TextFieldWidget extends StatefulWidget {
|
||||
final String? title;
|
||||
final String? initialValue;
|
||||
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 int? maxLength;
|
||||
final TextInputType? textInputType;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final ValueChanged<String>? onchange;
|
||||
final TextInputAction? textInputAction;
|
||||
final FocusNode? focusNode;
|
||||
final ValueChanged<String>? onFieldSubmitted;
|
||||
final Function()? onClick;
|
||||
|
||||
const TextFieldWidget({
|
||||
super.key,
|
||||
this.textInputType,
|
||||
this.initialValue,
|
||||
this.enable,
|
||||
this.readOnly,
|
||||
this.obscureText,
|
||||
this.prefix,
|
||||
this.suffix,
|
||||
this.title,
|
||||
required this.hintText,
|
||||
required this.controller,
|
||||
this.maxLine,
|
||||
this.maxLength,
|
||||
this.inputFormatters,
|
||||
this.onchange,
|
||||
this.textInputAction,
|
||||
this.focusNode,
|
||||
this.onClick,
|
||||
this.onFieldSubmitted,
|
||||
});
|
||||
|
||||
@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
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeController themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
|
||||
// Theme-aware colors
|
||||
final borderColor = _focusNode.hasFocus ? (isDark ? AppThemeData.greyDark400 : AppThemeData.grey400) : (isDark ? AppThemeData.greyDark200 : AppThemeData.grey200);
|
||||
|
||||
final fillColor = isDark ? (AppThemeData.greyDark100) : (AppThemeData.grey100);
|
||||
|
||||
final textColor = isDark ? AppThemeData.greyDark900 : AppThemeData.grey900;
|
||||
|
||||
final hintColor = isDark ? AppThemeData.greyDark400 : AppThemeData.grey400;
|
||||
|
||||
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,
|
||||
onTap: widget.onClick,
|
||||
initialValue: widget.initialValue,
|
||||
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,
|
||||
maxLength: widget.maxLength,
|
||||
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, width: 1.2),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: borderColor, width: 1.2),
|
||||
),
|
||||
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, width: 1.2),
|
||||
),
|
||||
hintText: widget.hintText.tr,
|
||||
hintStyle: AppThemeData.regularTextStyle(fontSize: 14, color: hintColor),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
25
lib/themes/theme_controller.dart
Normal file
25
lib/themes/theme_controller.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../utils/preferences.dart';
|
||||
|
||||
class ThemeController extends GetxController {
|
||||
RxBool isDark = false.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
loadTheme();
|
||||
}
|
||||
|
||||
void loadTheme() {
|
||||
isDark.value = Preferences.getBoolean(Preferences.themKey);
|
||||
}
|
||||
|
||||
void toggleTheme() {
|
||||
isDark.value = !isDark.value;
|
||||
Preferences.setBoolean(Preferences.themKey, isDark.value);
|
||||
}
|
||||
|
||||
ThemeMode get themeMode => isDark.value ? ThemeMode.dark : ThemeMode.light;
|
||||
}
|
||||
Reference in New Issue
Block a user