This commit is contained in:
Venba 2024-06-14 09:53:25 +05:30
parent 86cd662522
commit 17280b1bb8
5 changed files with 225 additions and 180 deletions

View File

@ -11,24 +11,32 @@ fi
# Copy the .env.development file to .env
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file
if ! grep -q BASE_HREF .env; then
echo "BASE_HREF not found in .env file"
exit 1
fi
# Verify .env file contains correct values
source .env
# Extract the BASE_HREF value
BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2)
# Check if the BASE_HREF value is empty
if [ -z "$BASE_HREF" ]; then
echo "BASE_HREF value is empty"
exit 1
fi
if [ -z "$API_URL" ]; then
echo "API_URL value is empty"
exit 1
fi
# Print loaded values for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
# Build the web app for development with base href
flutter build web --release --base-href "$BASE_HREF"
# Optionally, remove the .env file after the build
# rm .env
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Flutter dev build failed"
exit 1
fi
echo "Flutter dev build succeeded"

View File

@ -1,34 +1,42 @@
#!/bin/bash
# Define the path to the .env file for production
# Define the path to the .env.production file
ENV_FILE_PATH=".env.production"
# Check if the .env file exists
# Check if the .env.production file exists
if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist"
exit 1
fi
# Copy the .env file for production to .env
# Copy the .env.production file to .env
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file
if ! grep -q BASE_HREF .env; then
echo "BASE_HREF not found in .env file"
exit 1
fi
# Verify .env file contains correct values
source .env
# Extract the BASE_HREF value
BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2)
# Check if the BASE_HREF value is empty
if [ -z "$BASE_HREF" ]; then
echo "BASE_HREF value is empty"
exit 1
fi
# Build the web app for production environment with base href
if [ -z "$API_URL" ]; then
echo "API_URL value is empty"
exit 1
fi
# Print loaded values for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
# Build the web app for production with base href
flutter build web --release --base-href "$BASE_HREF"
# Optionally, remove the .env file after the build
# rm .env
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Flutter prod build failed"
exit 1
fi
echo "Flutter prod build succeeded"

View File

@ -1,34 +1,42 @@
#!/bin/bash
# Define the path to the .env file for testing
# Define the path to the .env.test file
ENV_FILE_PATH=".env.test"
# Check if the .env file exists
# Check if the .env.test file exists
if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist"
exit 1
fi
# Copy the .env file for testing to .env
# Copy the .env.test file to .env
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Check if the BASE_HREF variable exists in the .env file
if ! grep -q BASE_HREF .env; then
echo "BASE_HREF not found in .env file"
exit 1
fi
# Verify .env file contains correct values
source .env
# Extract the BASE_HREF value
BASE_HREF=$(grep BASE_HREF .env | cut -d '=' -f2)
# Check if the BASE_HREF value is empty
if [ -z "$BASE_HREF" ]; then
echo "BASE_HREF value is empty"
exit 1
fi
# Build the web app for test environment with base href
if [ -z "$API_URL" ]; then
echo "API_URL value is empty"
exit 1
fi
# Print loaded values for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
# Build the web app for the test environment with base href
flutter build web --release --base-href "$BASE_HREF"
# Optionally, remove the .env file after the build
# rm .env
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Flutter test build failed"
exit 1
fi
echo "Flutter test build succeeded"

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:google_fonts/google_fonts.dart';
@ -451,155 +452,168 @@ class _hrDashboardState extends State<hrDashboard> {
),
),
SizedBox(height: 8),
Row(
children: List.generate(
policyDetails.length,
(index) => Container(
width: 300,
height: policyHeight,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(
context,
'hrPolicyDetails',
arguments:
policyDetails[
index]);
},
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Card(
elevation: 3,
color:
cardColor, // Use the determined color
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
ListTile(
title:
SizedBox(
height: 50,
child: Text(
'${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})',
style: GoogleFonts
.poppins(
fontSize:
16,
fontWeight:
FontWeight.w500,
color: Color(
0xFF000000),
height:
1.5,
SingleChildScrollView(
scrollDirection:
Axis.horizontal,
controller:
ScrollController(), // Adding ScrollController
dragStartBehavior:
DragStartBehavior.start,
child: Row(
children: List.generate(
policyDetails.length,
(index) => Container(
width: 300,
height: policyHeight,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(
context,
'hrPolicyDetails',
arguments:
policyDetails[
index]);
},
child: MouseRegion(
cursor:
SystemMouseCursors
.click,
child: Card(
elevation: 3,
color:
cardColor, // Use the determined color
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
ListTile(
title:
SizedBox(
height:
50,
child:
Text(
'${policyDetails[index]['policy_name']} - (${policyDetails[index]['type']})',
style: GoogleFonts
.poppins(
fontSize:
16,
fontWeight:
FontWeight.w500,
color:
Color(0xFF000000),
height:
1.5,
),
softWrap:
true, // Allow text to wrap to the next line if needed
),
softWrap:
true, // Allow text to wrap to the next line if needed
),
),
),
SizedBox(
height: 8),
Padding(
padding: EdgeInsets
.only(
left:
15,
right:
15),
child: Row(
children: [
Expanded(
flex: 4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
'Draft',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
SizedBox(
height:
8),
Padding(
padding: EdgeInsets.only(
left:
15,
right:
15),
child: Row(
children: [
Expanded(
flex:
4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
'Draft',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
),
),
),
Text(
policyDetails[index]['membersCountOfDraft'].toString(),
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
height: 1.5,
Text(
policyDetails[index]['membersCountOfDraft'].toString(),
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
height: 1.5,
),
),
),
],
],
),
),
),
Expanded(
flex: 4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
'Enrolled',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
Expanded(
flex:
4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
'Enrolled',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
),
),
),
Text(
policyDetails[index]['membersCountOfEnrolled'].toString(),
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
height: 1.5,
Text(
policyDetails[index]['membersCountOfEnrolled'].toString(),
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
height: 1.5,
),
),
),
],
],
),
),
),
Expanded(
flex: 4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
'Total',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
Expanded(
flex:
4,
child:
Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
'Total',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF000000),
height: 1.5,
),
),
),
Text(
policyDetails[index]['totalMembersCount'].toString(),
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
height: 1.5,
Text(
policyDetails[index]['totalMembersCount'].toString(),
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Color(0xFF000000),
height: 1.5,
),
),
),
],
],
),
),
),
],
), // Adjust the horizontal padding as needed
)
],
],
), // Adjust the horizontal padding as needed
)
],
),
),
),
),

View File

@ -1,12 +1,14 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../home.dart';
class Environment {
static String get fileName {
const bool isProduction =
bool.fromEnvironment('dart.vm.product', defaultValue: false);
const bool isTest =
bool.fromEnvironment('dart.vm.environment', defaultValue: false);
const bool isTest = bool.fromEnvironment('ENV', defaultValue: false);
if (isProduction) {
return '.env.production';
@ -29,3 +31,8 @@ class Environment {
return dotenv.env['ENV'] ?? 'ENV not found!';
}
}
Future<void> main() async {
await dotenv.load(fileName: Environment.fileName);
runApp(MyApp());
}